1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

Fix and use the new setting: country. International mapping can now be okay and will remove duplicates. We need a little more fix"

This commit is contained in:
Loic Blot
2015-01-09 18:02:41 +00:00
parent 74ed1e7527
commit 38d0cea3df
4 changed files with 42 additions and 21 deletions
+11 -4
View File
@@ -120,9 +120,12 @@ class SmsController extends Controller {
$contacts = array();
$photos = $this->app->getContactPhotos();
// Cache country because of loops
$configuredCountry = $this->configMapper->getCountry();
$countPhone = count($phoneList);
foreach ($phoneList as $number => $ts) {
$fmtPN = PhoneNumberFormatter::format($number);
$fmtPN = PhoneNumberFormatter::format($configuredCountry, $number);
if (isset($contactsSrc[$number])) {
$contacts[$number] = $contactsSrc[$number];
} elseif (isset($contactsSrc[$fmtPN])) {
@@ -145,7 +148,11 @@ class SmsController extends Controller {
$contacts = $this->app->getContacts();
$iContacts = $this->app->getInvertedContacts();
$contactName = "";
$fmtPN = PhoneNumberFormatter::format($phoneNumber);
// Cache country because of loops
$configuredCountry = $this->configMapper->getCountry();
$fmtPN = PhoneNumberFormatter::format($configuredCountry, $phoneNumber);
if (isset($contacts[$fmtPN])) {
$contactName = $contacts[$fmtPN];
}
@@ -159,7 +166,7 @@ class SmsController extends Controller {
foreach($iContacts[$contactName] as $cnumber) {
$messages = $messages + $this->smsMapper->getAllMessagesForPhoneNumber($this->userId, $cnumber, $lastDate);
$msgCount += $this->smsMapper->countMessagesForPhoneNumber($this->userId, $cnumber);
$phoneNumbers[] = PhoneNumberFormatter::format($cnumber);
$phoneNumbers[] = PhoneNumberFormatter::format($configuredCountry, $cnumber);
}
}
else {
@@ -171,7 +178,7 @@ class SmsController extends Controller {
$msgCount += $this->smsMapper->countMessagesForPhoneNumber($this->userId, $cnumber);
}
}
$phoneNumbers[] = PhoneNumberFormatter::format($phoneNumber);
$phoneNumbers[] = PhoneNumberFormatter::format($configuredCountry, $phoneNumber);
}
// Order by id (date)
ksort($messages);