Merge pull request #4148 from AlainRnet/develop
Update fraise.modules.php
This commit is contained in:
commit
2b149aa514
@ -63,7 +63,7 @@ class mailing_fraise extends MailingTargets
|
|||||||
* array of SQL request that returns two field:
|
* array of SQL request that returns two field:
|
||||||
* One called "label", One called "nb".
|
* One called "label", One called "nb".
|
||||||
*
|
*
|
||||||
* @return string[] Array with SQL requests
|
* @return array Array with SQL requests
|
||||||
*/
|
*/
|
||||||
function getSqlArrayForStats()
|
function getSqlArrayForStats()
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ class mailing_fraise extends MailingTargets
|
|||||||
*/
|
*/
|
||||||
function formFilter()
|
function formFilter()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
$form=new Form($this->db);
|
$form=new Form($this->db);
|
||||||
@ -121,6 +121,36 @@ class mailing_fraise extends MailingTargets
|
|||||||
$s.='<option value="1a">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusPaidShort").')</option>';
|
$s.='<option value="1a">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusPaidShort").')</option>';
|
||||||
$s.='<option value="1b">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusActiveLateShort").')</option>';
|
$s.='<option value="1b">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusActiveLateShort").')</option>';
|
||||||
$s.='<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
$s.='<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
||||||
|
$s.='</select> ';
|
||||||
|
$s.=$langs->trans("Type").': ';
|
||||||
|
$s.='<select name="filter" class="flat">';
|
||||||
|
$sql = "SELECT rowid, libelle, statut";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
$sql.= " ORDER BY rowid";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
$s.='<option value="0"> </option>';
|
||||||
|
if (! $num) $s.='<option value="0" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$s.='<option value="'.$obj->rowid.'">'.dol_trunc($obj->libelle,38,'middle');
|
||||||
|
$s.='</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
$s.='</select>';
|
$s.='</select>';
|
||||||
$s.='<br>';
|
$s.='<br>';
|
||||||
$s.=$langs->trans("DateEndSubscription").': ';
|
$s.=$langs->trans("DateEndSubscription").': ';
|
||||||
@ -172,7 +202,7 @@ class mailing_fraise extends MailingTargets
|
|||||||
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
||||||
$sql.= " a.lastname, a.firstname,";
|
$sql.= " a.lastname, a.firstname,";
|
||||||
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||||
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
||||||
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
||||||
@ -181,6 +211,8 @@ class mailing_fraise extends MailingTargets
|
|||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";
|
||||||
if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
||||||
if ($dateendsubscriptionbefore > 0) $sql.=" AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
if ($dateendsubscriptionbefore > 0) $sql.=" AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
||||||
|
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
||||||
|
if ($_POST['filter']) $sql.= " AND ta.rowid='".$_POST['filter']."'";
|
||||||
$sql.= " ORDER BY a.email";
|
$sql.= " ORDER BY a.email";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -233,4 +265,3 @@ class mailing_fraise extends MailingTargets
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user