diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index cbd05d1b15d..acf4a316660 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013 florian HENRY + * Copyright (C) 2013 Florian HENRY * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,8 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; /** - * \class mailing_contacts4 - * \brief Class to manage a list of personalised recipients for mailing feature + * Class to manage a list of personalised recipients for mailing feature */ class mailing_contacts4 extends MailingTargets { @@ -78,7 +77,7 @@ class mailing_contacts4 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; - $sql.= " sp.lastname, sp.firstname, sp.civility_id,"; + $sql.= " sp.lastname, sp.firstname, sp.civilite as civility_id,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; if ($filtersarray[0] <> 'all')$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie_contact as cs ON cs.fk_socpeople=sp.rowid"; diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 6df8204695a..0e79a1f6e91 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; /** - * \class mailing_fraise - * \brief Class to generate target according to rule Fraise + * Class to generate target according to rule Fraise */ class mailing_fraise extends MailingTargets { diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index 815fc4bf4eb..2408f0faff8 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -19,8 +19,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; /** - * \class mailing_framboise - * \brief Class to manage a list of personalised recipients for mailing feature + * Class to manage a list of personalised recipients for mailing feature */ class mailing_framboise extends MailingTargets { @@ -58,11 +57,14 @@ class mailing_framboise extends MailingTargets function add_to_target($mailing_id,$filtersarray=array()) { global $conf, $langs; - + $langs->load("members"); + $langs->load("companies"); + $cibles = array(); // Select the members from category $sql = "SELECT a.rowid as id, a.email as email, a.lastname, null as fk_contact, a.firstname,"; + $sql.= " a.datefin, a.civilite as civility_id, a.login, a.societe,"; // Other fields if ($_POST['filter']) $sql.= " c.label"; else $sql.=" null as label"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; @@ -97,7 +99,12 @@ class mailing_framboise extends MailingTargets 'fk_contact' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, - 'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), + 'other' => + ($langs->transnoentities("Login").'='.$obj->login).';'. + ($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')).';'. + ($langs->transnoentities("DateEnd").'='.dol_print_date($this->db->jdate($obj->datefin),'day')).';'. + ($langs->transnoentities("Company").'='.$obj->societe).';'. + ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'member' diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index e038cfd3ceb..3c0238da902 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -143,12 +143,13 @@ class mailing_pomme extends MailingTargets function add_to_target($mailing_id,$filtersarray=array()) { global $conf, $langs; - + $langs->load("companies"); + $cibles = array(); - // La requete doit retourner: id, email, fk_contact, name, firstname + // La requete doit retourner: id, email, fk_contact, lastname, firstname $sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,"; - $sql.= " u.lastname as name, u.firstname as firstname, u.civilite as civility_id, u.login, u.office_phone"; + $sql.= " u.lastname as lastname, u.firstname as firstname, u.civilite as civility_id, u.login, u.office_phone"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test $sql.= " AND u.entity IN (0,".$conf->entity.")"; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index ecb14ce6ed5..9d7fb16aaab 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -108,8 +108,8 @@ class mailing_thirdparties extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'lastname' => $obj->lastname, - 'firstname' => $obj->firstname, + 'lastname' => $obj->name, // For a thirdparty, we must use name + 'firstname' => '', // For a thirdparty, lastname is '' 'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index fc135b77df5..a907ad0ec3f 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -39,6 +39,8 @@ class mailing_thirdparties_services_expired extends MailingTargets */ function __construct($db) { + global $conf; + $this->db=$db; $this->arrayofproducts=array(); @@ -46,7 +48,7 @@ class mailing_thirdparties_services_expired extends MailingTargets // List of services $sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE entity IN (".getEntity('product', 1).")"; - $sql.= " AND fk_product_type = 1"; + if (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $sql.= " AND fk_product_type = 1"; // By default, only services $sql.= " ORDER BY ref"; $result=$this->db->query($sql); if ($result) @@ -123,7 +125,8 @@ class mailing_thirdparties_services_expired extends MailingTargets { $cibles[$j] = array( 'email' => $obj->email, - 'lastname' => $obj->lastname, + 'lastname' => $obj->name, // For thirdparties, lastname must be name + 'firstname' => '', // For thirdparties, firstname is '' 'other' => ('StartDate='.dol_print_date($this->db->jdate($obj->date_ouverture),'day')).';'. ('EndDate='.dol_print_date($this->db->jdate($obj->date_fin_validite),'day')).';'. @@ -142,8 +145,8 @@ class mailing_thirdparties_services_expired extends MailingTargets } else { - dol_syslog($this->db->error()); - $this->error=$this->db->error(); + dol_syslog($this->db->lasterror()); + $this->error=$this->db->lasterror(); return -1; } @@ -193,7 +196,7 @@ class mailing_thirdparties_services_expired extends MailingTargets $sql.= " AND cd.statut= 4 AND cd.fk_product=p.rowid"; $sql.= " AND p.ref IN ('".join("','",$this->arrayofproducts)."')"; $sql.= " AND cd.date_fin_validite < '".$this->db->idate($now)."'"; - //print $sql; + $a=parent::getNbOfRecipients($sql); return $a;