From 89619cad7b385059ff02684454ecc47af8f27b54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Sep 2013 23:38:40 +0200 Subject: [PATCH] Fix: Unit test regression --- htdocs/fourn/class/fournisseur.commande.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1376a4384cc..59c50181eb0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -922,10 +922,9 @@ class CommandeFournisseur extends CommonOrder $error=0; $now=dol_now(); - if(!$this->source) - { - $this->source = 0; - } + + // Clean parameters + if (empty($this->source)) $this->source = 0; /* On positionne en mode brouillon la commande */ $this->brouillon = 1; @@ -959,8 +958,8 @@ class CommandeFournisseur extends CommonOrder $sql.= ", 0"; $sql.= ", " . $this->source; $sql.= ", '".$conf->global->COMMANDE_SUPPLIER_ADDON_PDF."'"; - $sql.= ", ".$this->mode_reglement_id; - $sql.= ", ".$this->cond_reglement_id; + $sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'null'); + $sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null'); $sql.= ")"; dol_syslog(get_class($this)."::create sql=".$sql); @@ -1084,7 +1083,7 @@ class CommandeFournisseur extends CommonOrder $this->user_valid = ''; $this->date_creation = ''; $this->date_validation = ''; - $this->ref_supplier = ''; + $this->ref_supplier = ''; // Create clone $result=$this->create($user);