Clean code
This commit is contained in:
parent
33fe5eb85f
commit
3ace9f638a
@ -238,8 +238,8 @@ class mailing_fraise extends MailingTargets
|
||||
$cibles = array();
|
||||
$now = dol_now();
|
||||
|
||||
$dateendsubscriptionafter = dol_mktime($_POST['subscriptionafterhour'], $_POST['subscriptionaftermin'], $_POST['subscriptionaftersec'], $_POST['subscriptionaftermonth'], $_POST['subscriptionafterday'], $_POST['subscriptionafteryear']);
|
||||
$dateendsubscriptionbefore = dol_mktime($_POST['subscriptionbeforehour'], $_POST['subscriptionbeforemin'], $_POST['subscriptionbeforesec'], $_POST['subscriptionbeforemonth'], $_POST['subscriptionbeforeday'], $_POST['subscriptionbeforeyear']);
|
||||
$dateendsubscriptionafter = dol_mktime(GETPOST('subscriptionafterhour', 'int'), GETPOST('subscriptionaftermin', 'int'), GETPOST('subscriptionaftersec', 'int'), GETPOST('subscriptionaftermonth', 'int'), GETPOST('subscriptionafterday', 'int'), GETPOST('subscriptionafteryear', 'int'));
|
||||
$dateendsubscriptionbefore = dol_mktime(GETPOST('subscriptionbeforehour', 'int'), GETPOST('subscriptionbeforemin', 'int'), GETPOST('subscriptionbeforesec', 'int'), GETPOST('subscriptionbeforemonth', 'int'), GETPOST('subscriptionbeforeday', 'int'), GETPOST('subscriptionbeforeyear', 'int'));
|
||||
|
||||
// La requete doit retourner: id, email, fk_contact, name, firstname
|
||||
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
||||
@ -255,18 +255,18 @@ class mailing_fraise extends MailingTargets
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$this->db->escape($mailing_id).")";
|
||||
// Filter on status
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') {
|
||||
if (GETPOST("filter") == '-1') {
|
||||
$sql .= " AND a.statut=-1";
|
||||
}
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql .= " AND a.statut=0";
|
||||
if (GETPOST("filter", 'aZ09') == '1a') $sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
if (GETPOST("filter", 'aZ09') == '1b') $sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
if (GETPOST("filter", 'aZ09') === '0') $sql .= " AND a.statut=0";
|
||||
// Filter on date
|
||||
if ($dateendsubscriptionafter > 0) $sql .= " AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
||||
if ($dateendsubscriptionbefore > 0) $sql .= " AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
// Filter on type
|
||||
if (GETPOSTISSET('filter_type') && GETPOST('filter_type') > 0) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'";
|
||||
if (GETPOST('filter_type', 'int') > 0) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type', 'int'))."'";
|
||||
$sql .= " ORDER BY a.email";
|
||||
//print $sql;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user