From 87cc1cc578d9d623d5ff57b2e34dfe4327dcf70a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 19 Jun 2011 21:00:40 +0000
Subject: [PATCH] Fix: Regression of return code

---
 htdocs/projet/class/project.class.php | 12 ++++++------
 test/phpunit/CommonObjectTest.php     |  1 -
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 1d92055ae38..2a8218a9295 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -221,10 +221,10 @@ class Project extends CommonObject
 
 
 	/**
-	 *	\brief      Get object and lines from database
-	 *	\param      rowid       id of object to load
-	 * 	\param		ref			Ref of project
-	 *	\return     int         >0 if OK, <0 if KO
+	 *	Get object and lines from database
+	 *	@param      rowid       id of object to load
+	 * 	@param		ref			Ref of project
+	 *	@return     int         >0 if OK, 0 if not found, <0 if KO
 	 */
 	function fetch($id,$ref='')
 	{
@@ -269,14 +269,14 @@ class Project extends CommonObject
 			}
 			else
 			{
-				return -1;
+				return 0;
 			}
 		}
 		else
 		{
 			$this->error=$this->db->lasterror();
 			dol_syslog("Project::fetch ".$this->error, LOG_ERR);
-			return -2;
+			return -1;
 		}
 	}
 
diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php
index 8f65a72c6bb..f1811b55db4 100644
--- a/test/phpunit/CommonObjectTest.php
+++ b/test/phpunit/CommonObjectTest.php
@@ -168,7 +168,6 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
 
 		$localobject=new Commande($this->savdb);
 		$localobject->fetch(1);
-
     	$result=$localobject->fetch_projet();
 
 		print __METHOD__." result=".$result."\n";
-- 
GitLab