diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 567c3f1a702..fff3f64de8d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -978,6 +978,7 @@ class Commande extends CommonOrder } $this->id=0; + $this->ref = ''; $this->statut=self::STATUS_DRAFT; // Clear fields @@ -986,18 +987,9 @@ class Commande extends CommonOrder $this->date_creation = ''; $this->date_validation = ''; $this->ref_client = ''; - - // Set ref - $this->ref = '(PROV)'; - + // Create clone $result=$this->create($user); - if ($result < 0) $error++; - - // Set new ref - $newref='(PROV'.$this->id.')'; - $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($newref)."' WHERE rowid=".$this->id; - $result=$this->db->query($sql); if ($result < 0) $error++; if (! $error)