diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 6218c894c62..c201ca97b73 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2794,12 +2794,11 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; } elseif ($value == 'department_buyer') { if ($context == 'edit') { - print ''; + print ''; // show department buyer list $country_code = (!empty($obj->country_code) ? $obj->country_code : ''); $department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0); if ($country_code != '') { - print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state($department_buyer_id, $country_code, 'department_buyer_id', 'minwidth100 maxwidth150 maxwidthonsmartphone'); } print ''; diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 1d798698e84..22a1d2d84d2 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -52,6 +52,21 @@ class Ccountry extends CommonDict 'label' => array('type' => 'varchar(250)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 15, 'notnull' => -1, 'showoncombobox' => 1) ); + /** + * @var int + */ + public $favorite; + + /** + * @var int + */ + public $eec; + + /** + * @var string + */ + public $numeric_code; + /** * Constructor @@ -150,7 +165,10 @@ class Ccountry extends CommonDict $sql .= " t.code,"; $sql .= " t.code_iso,"; $sql .= " t.label,"; - $sql .= " t.active"; + $sql .= " t.eec,"; + $sql .= " t.active,"; + $sql .= " t.favorite,"; + $sql .= " t.numeric_code"; $sql .= " FROM ".$this->db->prefix()."c_country as t"; if ($id) { $sql .= " WHERE t.rowid = ".((int) $id); @@ -161,6 +179,7 @@ class Ccountry extends CommonDict } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { @@ -172,6 +191,9 @@ class Ccountry extends CommonDict $this->code_iso = $obj->code_iso; $this->label = $obj->label; $this->active = $obj->active; + $this->favorite = $obj->favorite; + $this->eec = $obj->eec; + $this->numeric_code = $obj->numeric_code; } $this->db->free($resql); diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 4e3cc764659..db16c74ab21 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -194,8 +194,16 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice // Send warning of error to administrator if ($sendemail) { + // Get default language to use for the company for supervision emails + $myCompanyDefaultLang = $mysoc->default_lang; + if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') { + // We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision + // so it must always be into the same language. + $myCompanyDefaultLang = getLanguageCodeFromCountryCode($mysoc->country_code); + } + $companylangs = new Translate('', $conf); - $companylangs->setDefaultLang($mysoc->default_lang); + $companylangs->setDefaultLang($myCompanyDefaultLang); $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox', 'stripe')); $from = getDolGlobalString("MAIN_MAIL_EMAIL_FROM"); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index cbfaae76079..aa46e7ccf0b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1957,8 +1957,16 @@ if ($ispaymentok) { // Send an email to the admins if ($sendemail) { + // Get default language to use for the company for supervision emails + $myCompanyDefaultLang = $mysoc->default_lang; + if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') { + // We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision + // so it must always be into the same language. + $myCompanyDefaultLang = getLanguageCodeFromCountryCode($mysoc->country_code); + } + $companylangs = new Translate('', $conf); - $companylangs->setDefaultLang($mysoc->default_lang); + $companylangs->setDefaultLang($myCompanyDefaultLang); $companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox', 'stripe')); $sendto = $sendemail;