diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d57ca4119d2..f4bdc1cb0aa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2573,7 +2573,6 @@ if ($action == 'create' && $usercancreate) if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { print '
'.$langs->trans('ClassifyShipped').'
'; } - // Create bill and Classify billed // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 70df565cd2b..4a88c324c88 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;