fix: [AdvTargetEmailling] bad table from select and use of dict for prospect status

This commit is contained in:
Florian HENRY 2022-10-03 13:38:15 +02:00
parent 2e8734a950
commit 3777b7dffe
2 changed files with 12 additions and 8 deletions

View File

@ -111,6 +111,8 @@ class AdvanceTargetingMailing extends CommonObject
global $langs;
$langs->load('customers');
$this->db = $db;
$this->select_target_type = array(
@ -119,13 +121,15 @@ class AdvanceTargetingMailing extends CommonObject
'3' => $langs->trans('ThirdParty'),
'4' => $langs->trans('ContactsWithThirdpartyFilter')
);
$this->type_statuscommprospect = array(
-1 => $langs->trans("StatusProspect-1"),
0 => $langs->trans("StatusProspect0"),
1 => $langs->trans("StatusProspect1"),
2 => $langs->trans("StatusProspect2"),
3 => $langs->trans("StatusProspect3")
);
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
$customerStatic = new Client($this->db);
$customerStatic->loadCacheOfProspStatus();
if (!empty($customerStatic->cacheprospectstatus)) {
foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) {
$this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label'];
}
}
}
/**

View File

@ -355,7 +355,7 @@ class FormAdvTargetEmailing extends Form
$out = '';
$sql = "SELECT c.rowid, c.name, c.fk_element";
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as c";
$sql .= " WHERE type_element = '".$this->db->escape($type_element)."'";
$sql .= " ORDER BY c.name";