From 380d036d5cfe71331e9f7c7dd61f6d32f2715e25 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 2 Jan 2013 15:12:46 +0100
Subject: [PATCH] Fix: Bad test onto project list id

---
 htdocs/core/lib/project.lib.php       | 2 +-
 htdocs/projet/class/project.class.php | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 5e112045e97..5894a687fa9 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -183,7 +183,7 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen
 	$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public';
 	$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
 	$sql.= " WHERE p.entity = ".$conf->entity;
-	if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
+	if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
 	if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
 	$sql.= " ORDER BY p.title ASC";
 
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 3ab689d56f3..260296ee39e 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -847,7 +847,7 @@ class Project extends CommonObject
      * @param 	int		$mode			0=All project I have permission on, 1=Projects affected to me only, 2=Will return list of all projects with no test on contacts
      * @param 	int		$list			0=Return array,1=Return string list
      * @param	int		$socid			0=No filter on third party, id of third party
-     * @return 	array 					Array of projects
+     * @return 	array or string			Array of projects id, or string with projects id separated with ","
      */
     function getProjectsAuthorizedForUser($user, $mode=0, $list=0, $socid=0)
     {
@@ -910,7 +910,7 @@ class Project extends CommonObject
 
             if ($list)
             {
-                if (empty($temp)) return 0;
+                if (empty($temp)) return '0';
                 $result = implode(',', $temp);
                 return $result;
             }
-- 
GitLab