Fix: Miscellaneous fixes into emailing target selectors (missing field
name, missing translation, sql syntax error, missing fiels other)
This commit is contained in:
parent
eec5d6d313
commit
00dd7db75e
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
||||
* Copyright (C) 2013 florian HENRY <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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";
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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.")";
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user