From 733b633ef71c5a0b1241240447b13e78d2877176 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Sep 2009 14:50:40 +0000 Subject: [PATCH] Fix: Create ok if some fields are missing. --- htdocs/commande/commande.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index b148694955b..13fd0727a72 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -520,7 +520,7 @@ class Commande extends CommonObject $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref")); dol_syslog("Commande::create ".$this->error, LOG_ERR); return -1; - } + } if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) { $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source")); @@ -552,7 +552,9 @@ class Commande extends CommonObject $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", '".addslashes($this->note)."'"; $sql.= ", '".addslashes($this->note_public)."'"; - $sql.= ", '".addslashes($this->ref_client)."', '".$this->modelpdf."', '".$this->cond_reglement_id."', '".$this->mode_reglement_id."'"; + $sql.= ", '".addslashes($this->ref_client)."', '".$this->modelpdf."'"; + $sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null"); + $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"null"); $sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null"); $sql.= ", ".($this->adresse_livraison_id>0?$this->adresse_livraison_id:'NULL'); $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');