From: Stéphane Jacob Date: Thu, 2 Sep 2010 14:25:08 +0000 (+0200) Subject: Use (+33) prefix for French phones (Closes #1172). X-Git-Tag: xorg/1.0.1~232 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=555a45120355ea375ddf874ca13cc2f941b4a7a4;hp=becfe71d177475717c5625e3f93de009e760446c;p=platal.git Use (+33) prefix for French phones (Closes #1172). Signed-off-by: Stéphane Jacob --- diff --git a/classes/phone.php b/classes/phone.php index 29f06df..cf227ed 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -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: diff --git a/upgrade/1.0.1/04_phones.sql b/upgrade/1.0.1/04_phones.sql index 1c7630d..70c1ea9 100644 --- a/upgrade/1.0.1/04_phones.sql +++ b/upgrade/1.0.1/04_phones.sql @@ -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: diff --git a/upgrade/1.0.1/phone.php b/upgrade/1.0.1/phone.php index 4239ece..3946619 100755 --- a/upgrade/1.0.1/phone.php +++ b/upgrade/1.0.1/phone.php @@ -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: */ ?>