Merge pull request #15058 from Hystepik/develop
FIX pb of duplicate event on command
This commit is contained in:
commit
58597bc8fe
@ -2573,7 +2573,6 @@ if ($action == 'create' && $usercancreate)
|
|||||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create bill and Classify billed
|
// Create bill and Classify billed
|
||||||
// Note: Even if module invoice is not enabled, we should be able to use button "Classified 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) {
|
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
|
||||||
|
|||||||
@ -745,6 +745,10 @@ class Commande extends CommonOrder
|
|||||||
if ($usercanclose)
|
if ($usercanclose)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
if ($this->statut == self::STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -2882,6 +2886,10 @@ class Commande extends CommonOrder
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
if ($this->billed)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
|
||||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user