From d6c18c1789d4f0913c461ab15bca76f015a8f0f9 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis.houssin@capnetworks.com>
Date: Thu, 14 Mar 2013 07:08:44 +0100
Subject: [PATCH] Fix: for avoid sql errors with predefined export models

---
 htdocs/exports/class/export.class.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 463cd85fc3f..622f26506f9 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -227,18 +227,19 @@ class Export
 		$sql.=$this->array_export_sql_end[$indice];
 
 		//construction du filtrage si le parametrage existe
-		if (is_array($array_filterValue))
+		if (is_array($array_filterValue) && !empty($array_filterValue))
 		{
 			$sqlWhere='';
 			// pour ne pas a gerer le nombre de condition
 			foreach ($array_filterValue as $key => $value)
 			{
-				$sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[0][$key], $key, $array_filterValue[$key]);
+				if (!empty($value))
+					$sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[0][$key], $key, $array_filterValue[$key]);
 			}
 			$sql.=$sqlWhere;
 		}
 		$sql.=$this->array_export_sql_order[$indice];
-		
+
 		return $sql;
 	}
 
-- 
GitLab