From 4fd6ce5e0d31146aa393b1bf1adfe795a77c0dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jul 2008 17:14:19 +0000 Subject: [PATCH] User creation not correctly managed if not defined --- htdocs/comm/propal.php | 6 +++--- htdocs/facture.class.php | 2 +- htdocs/propal.class.php | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 61b0f4594bb..1b456803cb6 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -195,7 +195,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer) $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; $propal->modelpdf = $_POST['model']; - $propal->author = $user->id; + $propal->author = $user->id; // deprecated $propal->note = $_POST['note']; $propal->ref = $_POST['ref']; $propal->statut = 0; @@ -219,7 +219,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer) $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; $propal->modelpdf = $_POST['model']; - $propal->author = $user->id; + $propal->author = $user->id; // deprecated $propal->note = $_POST['note']; $propal->ref_client = $_POST['ref_client']; $propal->ref = $_POST['ref']; @@ -235,7 +235,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer) } } - $id = $propal->create(); + $id = $propal->create($user); } if ($id > 0) diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index c219ac1047f..d697f8a0876 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); diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 5b2b6b0befe..304ac860571 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -530,7 +530,8 @@ class Propal extends CommonObject $sql.= ") "; $sql.= " VALUES (".$this->socid.", 0,"; $sql.= " ".$this->remise.", ".($this->remise_percent?$this->remise_percent:'null').", ".($this->remise_absolue?$this->remise_absolue:'null').","; - $sql.= " 0,0,".$this->db->idate($this->datep).", now(), '".$this->ref."', ".$this->author.","; + $sql.= " 0,0,".$this->db->idate($this->datep).", now(), '".$this->ref."', "; + $sql.= ($user->id > 0 ? "'".$user->id."'":"null").","; $sql.= "'".addslashes($this->note)."',"; $sql.= "'".addslashes($this->note_public)."',"; $sql.= "'".$this->modelpdf."',".$this->db->idate($this->fin_validite).",";