Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-20 16:36:36 +01:00
commit 11ad1e88e1
4 changed files with 42 additions and 5 deletions

View file

@ -2794,12 +2794,11 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '')
print '</td>';
} elseif ($value == 'department_buyer') {
if ($context == 'edit') {
print '<td>';
print '<td class="nowraponall">';
// 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 '</td>';

View file

@ -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);

View file

@ -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");

View file

@ -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;