diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e362285bd91..8ca2705348a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2019-2026 Frédéric France - * Copyright (C) 2020-2022 Open-Dsi + * Copyright (C) 2020-2026 Open-Dsi * Copyright (C) 2024-2025 Charlene Benke * Copyright (C) 2024 MDW * @@ -270,7 +270,7 @@ $tabsql = array(); $tabsql[DICT_FORME_JURIDIQUE] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[DICT_DEPARTEMENTS] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[DICT_REGIONS] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; -$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; +$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.phone_code, c.trunk_prefix, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[DICT_CIVILITY] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[DICT_ACTIONCOMM] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; @@ -364,7 +364,7 @@ $tabfield = array(); $tabfield[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfield[DICT_DEPARTEMENTS] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country" $tabfield[DICT_REGIONS] = "code,libelle,country_id,country"; -$tabfield[DICT_COUNTRY] = "code,label"; +$tabfield[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfield[DICT_CIVILITY] = "code,label"; $tabfield[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -411,7 +411,7 @@ $tabfieldvalue = array(); $tabfieldvalue[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfieldvalue[DICT_DEPARTEMENTS] = "code,libelle,region"; // "code,libelle,region" $tabfieldvalue[DICT_REGIONS] = "code,libelle,country"; -$tabfieldvalue[DICT_COUNTRY] = "code,label"; +$tabfieldvalue[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldvalue[DICT_CIVILITY] = "code,label"; $tabfieldvalue[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldvalue[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -458,7 +458,7 @@ $tabfieldinsert = array(); $tabfieldinsert[DICT_FORME_JURIDIQUE] = "code,libelle,fk_pays"; $tabfieldinsert[DICT_DEPARTEMENTS] = "code_departement,nom,fk_region"; $tabfieldinsert[DICT_REGIONS] = "code_region,nom,fk_pays"; -$tabfieldinsert[DICT_COUNTRY] = "code,label"; +$tabfieldinsert[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldinsert[DICT_CIVILITY] = "code,label"; $tabfieldinsert[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldinsert[DICT_CHARGESOCIALES] = "code,libelle,fk_pays,accountancy_code"; @@ -613,7 +613,7 @@ $tabcomplete = array( 'picto' => 'region', 'help' => array('code' => $langs->trans("EnterAnyCode")) ), - 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"))), + 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'phone_code' => 'e.g. 33', 'trunk_prefix' => 'e.g. 0')), 'c_civility' => array('picto' => 'contact', 'help' => array('code' => $langs->trans("EnterAnyCode"))), 'c_actioncomm' => array('picto' => 'action', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'color' => $langs->trans("ColorFormat"), 'position' => $langs->trans("PositionIntoComboList"))), 'c_chargesociales' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))), @@ -2117,6 +2117,12 @@ if ($id > 0) { if ($value == 'country') { $valuetoshow = $langs->trans("Country"); } + if ($value == 'phone_code') { + $valuetoshow = $langs->trans("PhoneCode"); + } + if ($value == 'trunk_prefix') { + $valuetoshow = $langs->trans("TrunkPrefix"); + } if ($value == 'department_buyer') { $valuetoshow = $langs->trans('DepartmentBuyer'); } @@ -2434,7 +2440,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = (isset($obj->$value) && $obj->$value !== null && $obj->$value !== '') ? $obj->$value : ''; $titletoshow = ''; if ($value == 'entity') { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f8c6f00940c..dc1c24d232d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2019 Josep Lluís Amador - * Copyright (C) 2020 Open-Dsi + * Copyright (C) 2020-2026 Open-Dsi * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -793,28 +793,30 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Phone / Fax print ''.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; print ''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; print ''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; print ''.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; print ''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; print ''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->email)) == 0) { @@ -1072,27 +1074,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Phone print ''.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; print ''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''; + + print ''.$form->editfieldkey('PhonePerso', 'phone_perso', GETPOST('phone_perso', 'alpha'), $object, 0).''; print ''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; print ''.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; print ''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; print ''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150', 80); + print ''; // EMail print ''.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (int) (getDolGlobalInt('SOCIETE_EMAIL_MANDATORY'))).''; diff --git a/htdocs/core/ajax/getphonecode.php b/htdocs/core/ajax/getphonecode.php new file mode 100644 index 00000000000..b45c87829db --- /dev/null +++ b/htdocs/core/ajax/getphonecode.php @@ -0,0 +1,58 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/ajax/getphonecode.php + * \brief Returns JSON phone_code for a given country_id + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/phone.lib.php'; +/** + * @var DoliDB $db + * @var User $user + */ + +$country_id = GETPOSTINT('country_id'); + +// Security check - user must be logged in +if (empty($user->id)) { + http_response_code(403); + echo json_encode(array('error' => 'Not authorized')); + exit; +} + +/* + * View + */ + +top_httphead('application/json'); + +$phone_code = dol_get_phone_code_from_country($db, $country_id); + +echo json_encode(array('phone_code' => $phone_code)); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f841299868b..2edd9c39a4d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -26,6 +26,7 @@ * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2026 Lenin Rivas + * Copyright (C) 2026 Open-Dsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,6 +99,11 @@ class Form /** @var array */ public $cache_rule_for_lines_dates = array(); + /** + * @var bool Whether the shared phone input JS (country-sync) has been emitted + */ + private $phoneInputSharedJsLoaded = false; + /** * Constructor @@ -1114,6 +1120,285 @@ class Form return $out; } + /** + * Return a select list of country phone calling codes + * + * @param string $selected Pre-selected phone code value (e.g. "+33") + * @param string $htmlname Name of HTML select element + * @param string $morecss More CSS classes + * @param int $showempty Show empty option (1) or not (0) + * @param int $country_id_hint Country ID to prefer when multiple countries share a code + * @return string HTML select string + */ + public function selectPhoneCode($selected = '', $htmlname = 'phone_code', $morecss = 'maxwidth150', $showempty = 0, $country_id_hint = 0) + { + global $langs; + + $langs->load("dict"); + + $out = ''; + $codeArray = array(); + $favorite = array(); + $label = array(); + $atleastonefavorite = 0; + + $sql = "SELECT rowid, code, label, phone_code, favorite, trunk_prefix"; + $sql .= " FROM ".$this->db->prefix()."c_country"; + $sql .= " WHERE active > 0 AND phone_code IS NOT NULL AND phone_code != ''"; + + dol_syslog(get_class($this)."::selectPhoneCode", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $translabel = ($obj->code && $langs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langs->transnoentitiesnoconv("Country".$obj->code) : $obj->label; + + $codeArray[$i]['rowid'] = $obj->rowid; + $codeArray[$i]['code'] = $obj->code; + $codeArray[$i]['label'] = $translabel; + $codeArray[$i]['phone_code'] = '+'.$obj->phone_code; + $codeArray[$i]['favorite'] = $obj->favorite; + $codeArray[$i]['trunk_prefix'] = $obj->trunk_prefix; + $favorite[$i] = $obj->favorite; + $label[$i] = dol_string_unaccent($translabel); + $i++; + } + + $array1_sort_order = SORT_DESC; + $array2_sort_order = SORT_ASC; + array_multisort($favorite, $array1_sort_order, $label, $array2_sort_order, $codeArray); + + $out .= ''; + + // Picto + $out .= img_picto('', $picto, 'class="pictofixedwidth"'); + + // Phone code select (display-only name, not submitted as separate POST param) + $out .= $this->selectPhoneCode($selectedCode, $codename, 'maxwidth75 phone_code_select', 0, $country_id_hint); + + // Visible number input (no name — not POSTed) + $out .= ' 0) { + $out .= ' maxlength="'.$maxlength.'"'; + } + $out .= ' value="'.dol_escape_htmltag($numberValue).'">'; + + // Per-field JS to sync hidden field + $out .= $this->getPhoneInputFieldJs($htmlname, $codename); + + // Shared JS for country-sync (output once per page) + $out .= $this->getPhoneInputSharedJs($countrySelectorId); + + return $out; + } + + /** + * Return inline JS that syncs the hidden phone field from select + text input. + * + * Strips formatting chars and trunk prefix from the number, then builds + * the hidden value as "{code} {number}" or just "{number}" if no code. + * + * @param string $htmlname Base name (e.g. "phone_pro") + * @param string $codename Code select name (e.g. "phone_pro_code") + * @return string Inline '."\n"; + + return $out; + } + + /** + * Return inline JS for country-selector → phone code sync (output once per page). + * + * When the country select changes, fetches the phone code via AJAX and updates + * all .phone_code_select dropdowns, which in turn triggers per-field sync. + * + * @param string $countrySelectorId ID of the country select element + * @return string Inline '."\n"; + + return $out; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 5b4b8cd17c6..851bab3f36c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 Open-Dsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -557,6 +558,11 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = }, templateSelection: function (selection) { /* Format visible output of selected value */ if (selection.id == \''.(dol_escape_js($idforemptyvalue)).'\') return \'\'+selection.text+\'\'; + if (selection.element && $(selection.element).attr("data-select-html") != undefined) { + if (typeof htmlEntityDecodeJs === "function") { + return htmlEntityDecodeJs($(selection.element).attr("data-select-html")); + } + } return selection.text; }, escapeMarkup: function(markup) { diff --git a/htdocs/core/lib/phone.lib.php b/htdocs/core/lib/phone.lib.php new file mode 100644 index 00000000000..bc241061382 --- /dev/null +++ b/htdocs/core/lib/phone.lib.php @@ -0,0 +1,160 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/lib/phone.lib.php + * \ingroup core + * \brief Helper functions for phone number formatting + */ + +/** + * Parse a stored phone number into country code and number parts + * + * Stored format is "+{code} {number}" (e.g. "+33 644986885"). + * If no code is found, returns empty code and the full string as number. + * + * @param string $phone Stored phone number + * @return array{code:string,number:string} Array with 'code' and 'number' keys + */ +function dol_parse_phone($phone) +{ + $phone = trim((string) $phone); + if ($phone === '') { + return array('code' => '', 'number' => ''); + } + + if (strpos($phone, '+') === 0) { + $pos = strpos($phone, ' '); + if ($pos !== false) { + return array( + 'code' => substr($phone, 0, $pos), + 'number' => substr($phone, $pos + 1) + ); + } + // Phone starts with + but has no space: try to keep it as-is in code + return array('code' => '', 'number' => $phone); + } + + return array('code' => '', 'number' => $phone); +} + +/** + * Build a normalized phone string from code and number parts + * + * Strips formatting characters (spaces, dashes, dots, parentheses) from number. + * Also strips the national trunk prefix for the country matching $code + * (e.g. leading "0" for France, "8" for Russia, "06" for Hungary). + * Returns "+{code} {number}" or just the number if code is empty. + * + * @param DoliDB $db Database handler + * @param string $code Country calling code (e.g. "+33") + * @param string $number Phone number (may contain formatting) + * @return string Normalized phone string + */ +function dol_build_phone($db, $code, $number) +{ + $number = preg_replace('/[\s\-\.\(\)]/', '', trim((string) $number)); + $code = trim((string) $code); + + if ($number === '') { + return ''; + } + + if ($code !== '') { + // Strip national trunk prefix (e.g. leading "0" for France) + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $prefix = $obj->trunk_prefix; + if (strpos($number, $prefix) === 0) { + $number = substr($number, strlen($prefix)); + } + } + $db->free($resql); + } + } + + if ($code !== '') { + return $code.' '.$number; + } + + return $number; +} + +/** + * Get the national trunk prefix for a phone code + * + * @param DoliDB $db Database handler + * @param string $phone_code Phone code (e.g. "+33") + * @return string Trunk prefix (e.g. "0") or empty string + */ +function dol_get_trunk_prefix($db, $phone_code) +{ + $phone_code = trim((string) $phone_code); + if ($phone_code === '') { + return ''; + } + + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($phone_code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $db->free($resql); + return $obj->trunk_prefix; + } + $db->free($resql); + } + + return ''; +} + +/** + * Get the phone calling code for a country + * + * @param DoliDB $db Database handler + * @param int $country_id Country rowid + * @return string Phone code (e.g. "+33") or empty string + */ +function dol_get_phone_code_from_country($db, $country_id) +{ + $country_id = (int) $country_id; + if ($country_id <= 0) { + return ''; + } + + $sql = "SELECT phone_code FROM ".$db->prefix()."c_country WHERE rowid = ".((int) $country_id); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && !empty($obj->phone_code)) { + $db->free($resql); + return '+'.$obj->phone_code; + } + $db->free($resql); + } + + return ''; +} diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 4a0e4035eb6..5d3c28c55ca 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2021-2022 Udo Tamm -- Copyright (C) 2025 Nick Fragoulis +-- Copyright (C) 2026 Open-Dsi -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -544,3 +545,381 @@ UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','D -- Source: https://www.europeanpaymentscouncil.eu/document-library/other/epc-list-sepa-scheme-countries -- Set field sepa UPDATE llx_c_country SET sepa = 1 WHERE code IN ('AD','AL','AT','AX','BE','BG','BL','CH','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GF','GG','GI','GP','GR','HR','HU','IE','IM','IS','IT','JE','LI','LT','LU','LV','MC','MD','ME','MF','MK','MQ','MT','NL','NO','PL','PM','PT','RE','RO','RS','SE','SI','SK','SM','VA','YT'); + +-- Set field phone_code (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Set field trunk_prefix (national trunk prefix stripped in international format) +-- Trunk prefix '0' (~101 countries) +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'HR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ME'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'XK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ID'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IQ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ET'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ER'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EC'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AX'; +-- Trunk prefix '8' (post-Soviet countries) +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'RU'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'BY'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'KZ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TJ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TM'; +-- Trunk prefix '06' (Hungary) +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Trunk prefix '1' (NANP countries) +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'US'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'CA'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'PR'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GU'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MP'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'JM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BB'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GD'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KN'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'LC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TT'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DO'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KY'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'SX'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MH'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'FM'; diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index 07dee3352dd..c10522dd4b2 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -224,6 +224,8 @@ ALTER TABLE llx_prelevement_lignes ADD COLUMN bic varchar(11); -- 11 accordi ALTER TABLE llx_prelevement_lignes ADD COLUMN iban varchar(80); -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information ALTER TABLE llx_prelevement_lignes ADD COLUMN rum varchar(32); -- rum used +-- Add phone_code column to country table +ALTER TABLE llx_c_country ADD COLUMN phone_code integer; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax1_tx localtax1_tx varchar(20) DEFAULT '0'; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax2_tx localtax2_tx varchar(20) DEFAULT '0'; @@ -438,4 +440,262 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 4, 'PCG08-PYME-CAT', 'The PYME accountancy spanish plan in catalan language', 1); +-- Populate phone codes (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Add trunk_prefix column to llx_c_country +ALTER TABLE llx_c_country ADD COLUMN trunk_prefix varchar(5); + +-- Populate trunk_prefix for countries with trunk prefix '0' +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code IN ('FR','BE','DE','CH','GB','IE','NL','SE','AT','GR','FI','HR','BA','BG','RO','RS','ME','MK','AL','SK','SI','LT','MD','UA','GE','XK','TR','CN','IN','ID','JP','KR','TH','VN','MY','PH','BD','PK','AF','IR','IQ','JO','LB','SA','AE','IL','SY','YE','AM','AZ','KH','LA','MM','NP','LK','TW','MN','KG','UZ','PS','KP','MA','DZ','EG','ZA','NG','GH','KE','ET','TZ','UG','SD','LY','NA','SL','ZM','ZW','ER','CD','AO','EH','AU','NZ','AR','BR','CU','VE','PE','EC','BO','PY','SR','GF','YT','PM','BL','MF','GG','JE','IM','AX'); +-- Populate trunk_prefix for post-Soviet countries with trunk prefix '8' +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code IN ('RU','BY','KZ','TJ','TM'); +-- Populate trunk_prefix for Hungary with trunk prefix '06' +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Populate trunk_prefix for NANP countries with trunk prefix '1' +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code IN ('US','CA','PR','VI','GU','AS','MP','JM','BS','BB','AG','DM','GD','KN','LC','VC','TT','DO','AI','BM','VG','KY','MS','TC','SX','MH','FM'); + +-- Strip formatting sugar from existing phone numbers in llx_socpeople +UPDATE llx_socpeople SET phone = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone IS NOT NULL AND phone != ''; +UPDATE llx_socpeople SET phone_perso = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_perso, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_perso IS NOT NULL AND phone_perso != ''; +UPDATE llx_socpeople SET phone_mobile = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_mobile, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_mobile IS NOT NULL AND phone_mobile != ''; +UPDATE llx_socpeople SET fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(fax, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE fax IS NOT NULL AND fax != ''; + -- end of migration diff --git a/htdocs/install/mysql/tables/llx_c_country.sql b/htdocs/install/mysql/tables/llx_c_country.sql index f7936deefe1..5e2bd0bf9a3 100644 --- a/htdocs/install/mysql/tables/llx_c_country.sql +++ b/htdocs/install/mysql/tables/llx_c_country.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2022 Juanjo Menent +-- Copyright (C) 2026 Open-Dsi -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -29,5 +30,7 @@ create table llx_c_country eec tinyint DEFAULT 0 NOT NULL, sepa tinyint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, - favorite tinyint DEFAULT 0 NOT NULL + favorite tinyint DEFAULT 0 NOT NULL, + phone_code integer, + trunk_prefix varchar(5) )ENGINE=innodb; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 9fcda8b5a2d..017a086f1b7 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Payment Term - Vendor PaymentTypeBoth=Payment Type - Customer and Vendor MulticurrencyUsed=Use Multicurrency MulticurrencyCurrency=Currency +PhoneCode=Phone code +TrunkPrefix=Trunk prefix InEEC=Europe (EEC) RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 394b059f9f4..21bf748b59f 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Conditions de paiement - fournisseur PaymentTypeBoth=Type de paiement - Client et fournisseur MulticurrencyUsed=Utiliser plusieurs devises MulticurrencyCurrency=Devise +PhoneCode=Indicatif tél. +TrunkPrefix=Préfixe trunk InEEC=Union Européenne (UE) RestOfEurope=Reste de l'Union Européenne (UE) OutOfEurope=Hors Union Européenne (UE)