NEW Can filter on status employee when building emailing from users
This commit is contained in:
parent
fb5497f3d6
commit
a10d97cce0
@ -26,8 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
/**
|
||||
* \class mailing_pomme
|
||||
* \brief Class to offer a selector of emailing targets with Rule 'Peche'.
|
||||
* Class to offer a selector of emailing targets with Rule 'Peche'.
|
||||
*/
|
||||
class mailing_pomme extends MailingTargets
|
||||
{
|
||||
@ -112,11 +111,21 @@ class mailing_pomme extends MailingTargets
|
||||
$langs->load("users");
|
||||
|
||||
$s='';
|
||||
$s.=$langs->trans("Status").': ';
|
||||
$s.='<select name="filter" class="flat">';
|
||||
$s.='<option value="-1"></option>';
|
||||
$s.='<option value="-1"> </option>';
|
||||
$s.='<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s.='<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s.='</select>';
|
||||
|
||||
$s.=' ';
|
||||
$s.=$langs->trans("Employee").': ';
|
||||
$s.='<select name="filteremployee" class="flat">';
|
||||
$s.='<option value="-1"> </option>';
|
||||
$s.='<option value="1">'.$langs->trans("Yes").'</option>';
|
||||
$s.='<option value="0">'.$langs->trans("No").'</option>';
|
||||
$s.='</select>';
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
@ -142,7 +151,12 @@ class mailing_pomme extends MailingTargets
|
||||
*/
|
||||
function add_to_target($mailing_id,$filtersarray=array())
|
||||
{
|
||||
global $conf, $langs;
|
||||
// Deprecation warning
|
||||
if ($filtersarray) {
|
||||
dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING);
|
||||
}
|
||||
|
||||
global $conf, $langs;
|
||||
$langs->load("companies");
|
||||
|
||||
$cibles = array();
|
||||
@ -154,11 +168,10 @@ class mailing_pomme extends MailingTargets
|
||||
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
|
||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||
foreach($filtersarray as $key)
|
||||
{
|
||||
if ($key == '1') $sql.= " AND u.statut=1";
|
||||
if ($key == '0') $sql.= " AND u.statut=0";
|
||||
}
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql.= " AND u.statut=1";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND u.statut=0";
|
||||
if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql.= " AND u.employee=1";
|
||||
if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql.= " AND u.employee=0";
|
||||
$sql.= " ORDER BY u.email";
|
||||
|
||||
// Stocke destinataires dans cibles
|
||||
|
||||
Loading…
Reference in New Issue
Block a user