- // don't modify mobile if you don't have the right
- if (isset($b['mobile_pub']) && !has_user_right($b['mobile_pub'], $view) && isset($c['mobile']))
- unset($c['mobile']);
- if (isset($b['web_pub']) && !has_user_right($b['web_pub'], $view) && isset($c['web']))
- unset($c['web']);
- if (isset($b['freetext_pub']) && !has_user_right($b['freetext_pub'], $view) && isset($c['freetext']))
- unset($c['freetext']);
- if (!count($c))
- return false;
- return $c;
-}
-
-function same_tel(&$a, &$b) {
- $numbera = preg_replace('/[^0-9]/', '', (string) $a);
- $numberb = preg_replace('/[^0-9]/', '', (string) $b);
- return $numbera === $numberb;
-}
-function same_address(&$a, &$b) {
- return
- (same_field($a['adr1'],$b['adr1'])) &&
- (same_field($a['adr1'],$b['adr1'])) &&
- (same_field($a['adr1'],$b['adr1'])) &&
- (same_field($a['postcode'],$b['postcode'])) &&
- (same_field($a['city'],$b['city'])) &&
- (same_field($a['countrytxt'],$b['countrytxt'])) &&
- true;
-}
-function same_pro(&$a, &$b) {
- return
- (same_field($a['entreprise'],$b['entreprise'])) &&
- (same_field($a['fonction'],$b['fonction'])) &&
- true;
-}
-function same_field(&$a, &$b) {
- if ($a == $b) return true;
- if (is_array($a)) {
- if (!is_array($b) || count($a) != count($b)) return false;
- foreach ($a as $val => $avar)
- if (!isset($b[$val]) || !same_field($avar, $b[$val])) return false;
- return true;
- } elseif (is_string($a))
- return (mb_strtoupper($a) == mb_strtoupper($b));
-}
-function diff_user_tel(&$a, &$b) {
- $c = $a;
- if (isset($b['tel_pub']) && isset($a['tel_pub']) && has_user_right($b['tel_pub'], $a['tel_pub']))
- $c['tel_pub'] = $b['tel_pub'];
- foreach ($b as $val => $bvar) {
- if (isset($a[$val])) {
- if ($a[$val] == $bvar)
- unset($c[$val]);
- }
+ $tel = preg_replace('/\(0\)/', '', $tel);
+ $tel = preg_replace('/[^0-9]/', '', $tel);
+ if (substr($tel, 0, 2) === '00') {
+ $tel = substr($tel, 2);
+ } else if(substr($tel, 0, 1) === '0') {
+ $tel = '33' . substr($tel, 1);