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

Drop spaces from contactcache to dedup some more contacts

This commit is contained in:
Loic Blot 2016-11-11 10:04:06 +01:00
parent 38072d3766
commit 5a737b609e

View File

@ -84,11 +84,13 @@ class ContactCache {
if (is_array($phoneIds)) {
$countPhone = count($phoneIds);
for ($i=0; $i < $countPhone; $i++) {
$this->pushPhoneNumberToCache($phoneIds[$i], $r["FN"], $configuredCountry);
$phoneNumber = preg_replace("#[ ]#","", $phoneIds[$i]);
$this->pushPhoneNumberToCache($phoneNumber, $r["FN"], $configuredCountry);
}
}
else {
$this->pushPhoneNumberToCache($phoneIds, $r["FN"], $configuredCountry);
$phoneNumber = preg_replace("#[ ]#","", $phoneIds);
$this->pushPhoneNumberToCache($phoneNumber, $r["FN"], $configuredCountry);
}
if (isset ($r["PHOTO"])) {
@ -102,7 +104,6 @@ class ContactCache {
}
private function pushPhoneNumberToCache($rawPhone, $contactName, $country) {
$phoneNb = PhoneNumberFormatter::format($country, $rawPhone);
$this->contacts[$phoneNb] = $contactName;
// Inverted contacts