Skip to content

Commit

Permalink
Fix: B1032-develop: Problem in the filter of Contact by company category
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 21, 2013
1 parent 52d3991 commit f0dee93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions htdocs/core/modules/mailings/contacts3.modules.php
@@ -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
Expand All @@ -26,8 +27,7 @@


/**
* \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
{
Expand Down Expand Up @@ -80,9 +80,9 @@ function add_to_target($mailing_id,$filtersarray=array())
$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).")";
Expand All @@ -91,6 +91,7 @@ function add_to_target($mailing_id,$filtersarray=array())
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)
{
Expand Down

0 comments on commit f0dee93

Please sign in to comment.