* Fix missing rollback when stock movement fails in Expedition::valid() When STOCK_CALCULATE_ON_SHIPMENT is enabled and manageStockMvtOnEvt() fails while validating a shipment, the method returned -2 directly without calling $this->db->rollback(), unlike every other error branch in this method. Changed to increment $error instead, so execution falls through to the existing commit/rollback block at the end of valid(). Fixes #39425 * Update expedition.class.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
b9a31b4563
commit
7e72304271
1 changed files with 6 additions and 4 deletions
|
|
@ -1058,7 +1058,7 @@ class Expedition extends CommonObject
|
|||
if (!$error && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT')) {
|
||||
$result = $this->manageStockMvtOnEvt($user, "ShipmentValidatedInDolibarr");
|
||||
if ($result < 0) {
|
||||
return -2;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1071,9 +1071,11 @@ class Expedition extends CommonObject
|
|||
}
|
||||
|
||||
// TODO : load the origin object to trigger the right setStatus according to origin object
|
||||
$ret = $this->setStatut(Commande::STATUS_SHIPMENTONPROCESS, $this->origin_id, $this->origin, $triggerKey);
|
||||
if (!$ret) {
|
||||
$error++;
|
||||
if (!$error) {
|
||||
$ret = $this->setStatut(Commande::STATUS_SHIPMENTONPROCESS, $this->origin_id, $this->origin, $triggerKey);
|
||||
if (!$ret) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue