Fix: B1032-develop: Problem in the filter of Contact by company category

This commit is contained in:
Laurent Destailleur 2013-08-21 22:34:13 +02:00
parent 52d39915d7
commit f0dee93f78

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -26,8 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
/**
* \class mailing_contacts3
* \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_contacts3 extends MailingTargets
{
@ -80,9 +80,9 @@ class mailing_contacts3 extends MailingTargets
$sql.= " sp.lastname, sp.firstname, sp.civilite,";
$sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
@ -91,6 +91,7 @@ class mailing_contacts3 extends MailingTargets
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
$sql.= " ORDER BY sp.lastname, sp.firstname";
dol_syslog("sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{