FIX pb of duplicate event on command when refreshing the page after command classification as billed or closed

This commit is contained in:
lmarcouiller 2020-10-19 13:52:12 +02:00
parent ced91d049d
commit 71db2603e1

View File

@ -1282,6 +1282,17 @@ if (empty($reshook))
exit(); exit();
} }
//Used to not reclass as billed a command which is already billed by refreshing the page
if(strpos( $_SERVER["REQUEST_URI"],'action=classifybilled') && $object->billed){
header("Location: $_SERVER[PHP_SELF]?id=$object->id");
exit();
}
//Used to not reclass as closed command which is already closed by refreshing the page
if(strpos( $_SERVER["REQUEST_URI"],'action=confirm_shipped') && Commande::STATUS_CLOSED){
header("Location: $_SERVER[PHP_SELF]?id=$object->id");
exit();
}
// add lines from objectlinked // add lines from objectlinked
if ($action == 'import_lines_from_object' if ($action == 'import_lines_from_object'
&& $usercancreate && $usercancreate
@ -2573,7 +2584,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.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;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) {