From 8c37063541e06646009a3f9186cc0f35517d3267 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 7 May 2013 18:59:28 +0200 Subject: [PATCH] Fix bug [ bug #881 ] some errors --- htdocs/projet/class/project.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e6376bbe7eb..dc438d2b929 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1292,9 +1292,11 @@ class Project extends CommonObject switch ($Tablename) { case "facture": - case "facture_fourn": $sql = "SELECT rowid, facnumber as ref"; break; + case "facture_fourn": + $sql = "SELECT rowid, ref"; + break; case "facture_rec": $sql = "SELECT rowid, titre as ref"; break; @@ -1309,7 +1311,9 @@ class Project extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$Tablename; $sql.= " WHERE ".$projectkey." is null"; - $sql.= " AND fk_soc=".$this->societe->id; + if (!empty($this->societe->id)) { + $sql.= " AND fk_soc=".$this->societe->id; + } $sql.= " ORDER BY ref DESC"; dol_syslog("Project.Lib::select_element sql=".$sql);