From 555a45120355ea375ddf874ca13cc2f941b4a7a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 2 Sep 2010 16:25:08 +0200 Subject: [PATCH] Use (+33) prefix for French phones (Closes #1172). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/phone.php | 2 +- upgrade/1.0.1/04_phones.sql | 2 ++ upgrade/1.0.1/phone.php | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) 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: */ ?> -- 2.1.4