Fix #13024 wrong line is used for reception

This commit is contained in:
Dev2a 2021-03-24 09:55:55 +01:00
parent 7f209f7cc7
commit 9a85bdd38a

View File

@ -317,11 +317,16 @@ if (empty($reshook)) {
//var_dump($_POST);exit; //var_dump($_POST);exit;
for ($i = 1; $i <= $num; $i++) { for ($i = 1; $i <= $num; $i++) {
$lineToTest = ''; $lineToTest = '';
$lineId = GETPOST($idl, 'int');
foreach ($objectsrc->lines as $linesrc) { foreach ($objectsrc->lines as $linesrc) {
if ($linesrc->id == GETPOST($idl, 'int')) { if ($linesrc->id == $lineId) {
$lineToTest = $linesrc; $lineToTest = $linesrc;
break;
} }
} }
if (empty($lineToTest)) {
continue;
}
$qty = "qtyl".$i; $qty = "qtyl".$i;
$comment = "comment".$i; $comment = "comment".$i;
$eatby = "dlc".$i; $eatby = "dlc".$i;
@ -340,7 +345,7 @@ if (empty($reshook)) {
if ($entrepot_id < 0) { if ($entrepot_id < 0) {
$entrepot_id = ''; $entrepot_id = '';
} }
if (!($linesrc->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (!($lineToTest->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$entrepot_id = 0; $entrepot_id = 0;
} }
$eatby = GETPOST($eatby, 'alpha'); $eatby = GETPOST($eatby, 'alpha');