FIX pn in language selection on target for emailing

This commit is contained in:
Laurent Destailleur 2023-07-30 15:20:16 +02:00
parent 71abe871ef
commit a72fac7c3d
2 changed files with 15 additions and 11 deletions

View file

@ -219,7 +219,8 @@ class mailing_contacts1 extends MailingTargets
if ($level == $obj->code) {
$level = $langs->trans($obj->label);
}
$s .= '<option value="prospectslevel'.$obj->code.'">'.$langs->trans("ThirdPartyProspects").' ('.$langs->trans("ProspectLevelShort").'='.$level.')</option>';
$labeltoshow = $langs->trans("ThirdPartyProspects").' <span class="opacitymedium">('.$langs->trans("ProspectLevelShort").'='.$level.')</span>';
$s .= '<option value="prospectslevel'.$obj->code.'" data-html="'.dol_escape_htmltag($labeltoshow).'">'.$labeltoshow.'</option>';
$i++;
}
} else {
@ -311,7 +312,7 @@ class mailing_contacts1 extends MailingTargets
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang', 'aZ09'), 'filter_lang', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
}
return $s;
@ -412,7 +413,7 @@ class mailing_contacts1 extends MailingTargets
}
// Filter on language
if (!empty($filter_lang)) {
if (!empty($filter_lang) && $filter_lang != '-1') {
$sql .= " AND sp.default_lang LIKE '".$this->db->escape($filter_lang)."%'";
}
@ -442,8 +443,9 @@ class mailing_contacts1 extends MailingTargets
}
$sql .= " ORDER BY sp.email";
// print "wwwwwwx".$sql;
// Stocke destinataires dans cibles
//print "wwwwwwx".$sql;
// Store recipients in target tables
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);

View file

@ -126,11 +126,11 @@ class mailing_thirdparties extends MailingTargets
$addDescription .= $langs->trans("Disabled");
}
}
if (GETPOST('default_lang', 'alpha')) {
if (GETPOST('default_lang', 'alpha') && GETPOST('default_lang', 'alpha') != '-1') {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
if (GETPOST('filter_lang_thirdparties', 'alpha')) {
if (GETPOST('filter_lang_thirdparties', 'alpha') && GETPOST('filter_lang_thirdparties', 'alpha') != '-1') {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('filter_lang_thirdparties', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
@ -280,7 +280,7 @@ class mailing_thirdparties extends MailingTargets
$langs->load("companies");
// filter
$s = '<select id="filter_thirdparties" name="filter_thirdparties" class="flat">';
$s = '<select id="filter_thirdparties" name="filter_thirdparties" class="flat maxwidth200">';
// Show categories
$sql = "SELECT rowid, label, type, visible";
@ -316,10 +316,12 @@ class mailing_thirdparties extends MailingTargets
if ($obj->type == 2) {
$type = $langs->trans("Customer");
}
$s .= '<option value="'.$obj->rowid.'">'.dol_trunc($obj->label, 38, 'middle');
$labeltoshow = $obj->label;
if ($type) {
$s .= ' ('.$type.')';
$labeltoshow .= ' <span class="opacitymedium">('.$type.')</span>';
}
$s .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
$s .= $labeltoshow;
$s .= '</option>';
$i++;
}
@ -370,7 +372,7 @@ class mailing_thirdparties extends MailingTargets
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
//$s .= '<span class="opacitymedium">'.$langs->trans("DefaultLang").':</span> ';
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang_thirdparties', 'aZ09'), 'filter_lang_thirdparties', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
}
return $s;