Use (+33) prefix for French phones (Closes #1172).
authorStéphane Jacob <sj@m4x.org>
Thu, 2 Sep 2010 14:25:08 +0000 (16:25 +0200)
committerStéphane Jacob <sj@m4x.org>
Thu, 2 Sep 2010 14:25:08 +0000 (16:25 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/phone.php
upgrade/1.0.1/04_phones.sql
upgrade/1.0.1/phone.php

index 29f06df..cf227ed 100644 (file)
@@ -220,7 +220,7 @@ class Phone
         if ($format['format'] == '') {
             // If the country does not have a phone number format, the number will be displayed
             // as "+prefix ## ## ## ##...".
-            $format['format'] = '+p';
+            $format['format'] = '(+p)';
         }
 
         /* Formats the phone number according t the template with these rules:
index 1c7630d..70c1ea9 100644 (file)
@@ -3,4 +3,6 @@ ALTER TABLE profile_phones MODIFY COLUMN link_id INT(6) NOT NULL DEFAULT 0;
 
 DELETE FROM profile_phones WHERE search_tel = '' OR display_tel = '' OR link_type = 'hq';
 
+UPDATE geoloc_countries SET phoneFormat = '(+p) # ## ## ## ##' WHERE phoneFormat = '0# ## ## ## ##';
+
 -- vim:set syntax=mysql:
index 4239ece..3946619 100755 (executable)
@@ -54,5 +54,19 @@ foreach ($phones as $country => $phone) {
                  $phone, $country);
 }
 
+$res = XDB::iterator('SELECT  pid, link_type, link_id, tel_id AS id, search_tel AS search, search_tel AS display
+                        FROM  profile_phones
+                       WHERE  search_tel LIKE \'33%\'');
+while ($item = $res->next()) {
+    $phone = new Phone($item);
+    $phone->format();
+    XDB::execute('UPDATE  profile_phones
+                     SET  display_tel = {?}
+                   WHERE  pid = {?} AND link_type = {?}
+                          AND link_id = {?} AND tel_id = {?}',
+                 $phone->display, $phone->pid(), $phone->linkType(),
+                 $phone->linkId(), $phone->id());
+}
+
 /* vim:set et sw=4 sts=4 ts=4: */
 ?>