From 1411772c8145352e4af3b8d1b4b3ed60cd4469b4 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 3 Jun 2015 17:07:46 +0200
Subject: [PATCH] Fix sql error

---
 htdocs/core/class/html.formprojet.class.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 9469b680631..9e4ad9d1f59 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -231,7 +231,7 @@ class FormProjets
 
 		$sql.= " FROM ".MAIN_DB_PREFIX.$table_element;
 		$sql.= " WHERE ".$projectkey." is null";
-		if (!empty($socid)) $sql.= " AND fk_soc=".$socid;
+		if (! empty($socid) && ! in_array($table_element, array('don'))) $sql.= " AND fk_soc=".$socid;
 		if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND entity='.getEntity('project');
 		$sql.= " ORDER BY ref DESC";
 
-- 
GitLab