diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index e1edde93922..7ed5e3097bf 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -424,14 +424,6 @@ class Orders extends DolibarrApi if ($this->commande->availability($this->commande->availability_id) < 0) throw new RestException(400, 'Error while updating availability'); } - // update bank account - if(!empty($this->commande->fk_account)) - { - if($this->commande->setBankAccount($this->commande->fk_account) == 0) - { - throw new RestException(400,$this->commande->error); - } - } if ($this->commande->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7998a25bd13..65b704693fb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3036,6 +3036,8 @@ class Commande extends CommonOrder */ function update(User $user, $notrigger=0) { + global $conf; + $error=0; // Clean parameters @@ -3069,6 +3071,7 @@ class Commande extends CommonOrder $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; $sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").","; $sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").","; + $sql.= " fk_account=".($this->fk_account>0?$this->fk_account:"null").","; $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";