Supplier order dispatch : retrieve line price from order when deleting dispatch line.

This will allows custom cost price to be reverted back in triggers and such later.
This commit is contained in:
lainwir3d 2022-04-08 16:09:37 +04:00
parent 02c87f5899
commit cb2dd77f49

View File

@ -397,12 +397,24 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fourn
$qty = $supplierorderdispatch->qty; $qty = $supplierorderdispatch->qty;
$entrepot = $supplierorderdispatch->fk_entrepot; $entrepot = $supplierorderdispatch->fk_entrepot;
$product = $supplierorderdispatch->fk_product; $product = $supplierorderdispatch->fk_product;
$price = price2num(GETPOST('price', 'alpha'), 'MU');
$comment = $supplierorderdispatch->comment; $comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->eatby; $eatby = $supplierorderdispatch->eatby;
$sellby = $supplierorderdispatch->sellby; $sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch; $batch = $supplierorderdispatch->batch;
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
$price = price2num(GETPOST('price', 'alpha'), 'MU');
}else{
$cfl = new CommandeFournisseurLigne($db);
$ret = $cfl->fetch($supplierorderdispatch->fk_commandefourndet);
if($ret > 0){
$price = $cfl->subprice;
$price = price2num($price * (1 - ($cfl->remise_percent / 100.0)), 'MU');
}else{
$price = "0";
}
}
$result = $supplierorderdispatch->delete($user); $result = $supplierorderdispatch->delete($user);
} }
if ($result < 0) { if ($result < 0) {