From 7a00c793c6dd964a61c2f3bd2f6b784d08f6c79f Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 5 Jan 2012 12:59:24 +0100
Subject: [PATCH] Fix: SQL syntax error

---
 .../modules/mailings/framboise.modules.php    | 38 ++++++++++---------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php
index 6fb61212cc2..fbb0aeea420 100644
--- a/htdocs/core/modules/mailings/framboise.modules.php
+++ b/htdocs/core/modules/mailings/framboise.modules.php
@@ -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)
 	{
-- 
GitLab