From 5cf8180a7435a769febbc373c010222fcad7ba22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jul 2008 17:09:48 +0000 Subject: [PATCH] User creation not correctly managed if not defined --- htdocs/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index ea7426c828f..c219ac1047f 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -134,7 +134,7 @@ class Facture extends CommonObject function create($user,$notrigger=0) { global $langs,$conf,$mysoc; - +unset($user); // Nettoyage paramètres if (! $this->type) $this->type = 0; $this->ref_client=trim($this->ref_client); @@ -207,7 +207,7 @@ class Facture extends CommonObject $sql.= ",".($this->note_public?"'".addslashes($this->note_public)."'":"null"); $sql.= ",".($this->ref_client?"'".addslashes($this->ref_client)."'":"null"); $sql.= ",".($this->fk_facture_source?"'".addslashes($this->fk_facture_source)."'":"null"); - $sql.= ",".$user->id; + $sql.= ",".($user->id > 0 ? "'".$user->id."'":"null"); $sql.= ",".($this->projetid?$this->projetid:"null"); $sql.= ','.$this->cond_reglement_id; $sql.= ",".$this->mode_reglement_id;