diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fe40a4f9306..697995ef9c1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1282,15 +1282,6 @@ if (empty($reshook)) exit(); } - //Used to not reclass as a billed or closed command which is already billed by refreshing the page - if (strpos($_SERVER["REQUEST_URI"], 'action=classifybilled') && $object->billed - || strpos($_SERVER["REQUEST_URI"], 'action=confirm_shipped') && Commande::STATUS_CLOSED - ) - { - header("Location: $_SERVER[PHP_SELF]?id=$object->id"); - exit(); - } - // add lines from objectlinked if ($action == 'import_lines_from_object' && $usercancreate diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f2aab587169..13609caad25 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -745,6 +745,10 @@ class Commande extends CommonOrder if ($usercanclose) { $this->db->begin(); + if ($this->statut == self::STATUS_CLOSED) + { + return 0; + } $now = dol_now(); @@ -2882,6 +2886,10 @@ class Commande extends CommonOrder $error = 0; $this->db->begin(); + if ($this->billed) + { + return 0; + } $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;