Fix: SQL syntax error

This commit is contained in:
Laurent Destailleur 2012-01-05 12:59:24 +01:00
parent aadfca4bbd
commit 7a00c793c6

View File

@ -49,10 +49,11 @@ class mailing_framboise extends MailingTargets
/**
* \brief This is the main function that returns the array of emails
* \param mailing_id Id of mailing. No need to use it.
* \param filterarray If you used the formFilter function. Empty otherwise.
* \return int <0 if error, number of emails added if ok
* This is the main function that returns the array of emails.
*
* @param int $mailing_id Id of mailing. No need to use it.
* @param array $filtersarray If you used the formFilter function. Empty otherwise.
* @return int <0 if error, number of emails added if ok
*/
function add_to_target($mailing_id,$filtersarray=array())
{
@ -70,10 +71,10 @@ class mailing_framboise extends MailingTargets
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie";
}
}
$sql.= " WHERE s.email != ''";
$sql.= " AND s.entity = ".$conf->entity;
if ($_POST['filter']) $sql.= " AND ".MAIN_DB_PREFIX."categorie.rowid='".$_POST['filter']."'";
if ($_POST['filter']) $sql.= " AND c.rowid='".$_POST['filter']."'";
$sql.= " ORDER BY s.email";
// Stocke destinataires dans cibles
@ -138,11 +139,12 @@ class mailing_framboise extends MailingTargets
}
/*
* \brief Return here number of distinct emails returned by your selector.
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
* \return int
/**
* Return here number of distinct emails returned by your selector.
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @return int Nb of recipients
*/
function getNbOfRecipients()
{
@ -159,9 +161,10 @@ class mailing_framboise extends MailingTargets
}
/**
* \brief This is to add a form filter to provide variant of selector
* If used, the HTML select must be called "filter"
* \return string A html select zone
* This is to add a form filter to provide variant of selector
* If used, the HTML select must be called "filter"
*
* @return string A html select zone
*/
function formFilter()
{
@ -212,9 +215,10 @@ class mailing_framboise extends MailingTargets
/**
* \brief Can include an URL link on each record provided by selector
* shown on target page.
* \return string Url link
* Can include an URL link on each record provided by selector shown on target page.
*
* @param int $id Id of member
* @return string Url link
*/
function url($id)
{