1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-08 16:36:25 +00:00

Little fix for contact load, but this isn't working yet

This commit is contained in:
Loic Blot 2014-09-30 18:54:30 +00:00
parent b17cf11020
commit b75a8b3547
2 changed files with 4 additions and 3 deletions

View File

@ -82,11 +82,12 @@ class Application extends App {
public function getContacts() { public function getContacts() {
// Only load contacts if they aren't in the buffer // Only load contacts if they aren't in the buffer
if(count(self::$contacts) == 0) { if(count(self::$contacts) == 0) {
self::$contacts = array();
$cm = $this->c['ContactsManager']; $cm = $this->c['ContactsManager'];
$result = $cm->search('',array('FN')); $result = $cm->search('',array('FN'));
foreach ($result as $r) { foreach ($result as $r) {
if (isset ($r["phone"])) { if (isset ($r["TEL"])) {
self::$contacts[$r["phone"]] = $r["FN"]; self::$contacts[$r["TEL"]] = $r["FN"];
} }
} }
} }

View File

@ -82,7 +82,7 @@ class SmsController extends Controller {
public function getConversation ($phoneNumber, $lastDate = 0) { public function getConversation ($phoneNumber, $lastDate = 0) {
$messages = $this->smsMapper->getAllMessagesForPhoneNumber($this->userId, $phoneNumber, $lastDate); $messages = $this->smsMapper->getAllMessagesForPhoneNumber($this->userId, $phoneNumber, $lastDate);
// @ TODO: filter correctly // @ TODO: filter correctly
return new JSONResponse(array("conversation" => $messages, $contacts => $this->app->getContacts())); return new JSONResponse(array("conversation" => $messages, "contacts" => $this->app->getContacts()));
} }
/** /**