diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 5c634efe1d357e9052a7cd4a22d922d6ee024d8a..dd4332c18452635e87fb6b4b93e5a201fe76d864 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -303,14 +303,26 @@ class Commande // On positionne en mode brouillon la commande $this->brouillon = 1; + if (! $remise) { $remise = 0 ; } + if (! $this->projetid) { $this->projetid = 0; } + + // On ne formate pas une date de livraison qui vient d'une propale + if ($this->propale_id) + { + $date_livraison = $this->date_livraison; + } + else + { + $date_livraison = $this->date_livraison?$this->db->idate($this->date_livraison):'null'; + } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande ('; $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client,'; @@ -321,7 +333,7 @@ class Commande $sql.= ' '.$this->source.', '; $sql.= " '".addslashes($this->note)."', "; $sql.= " '".$this->ref_client."', '".$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\','; - $sql.= " '".($this->date_livraison?$this->db->idate($this->date_livraison):'null').'\','; + $sql.= " '".$date_livraison.'\','; $sql.= " '".$this->adresse_livraison_id."',"; $sql.= " '".$this->remise_absolue."',"; $sql.= " '".$this->remise_percent."')";