fix: checkbox for line selection between supplier order and supplier invoice was infective

This commit is contained in:
Florian HENRY 2021-09-30 14:56:02 +02:00
parent 422191def1
commit d0508d557b

View File

@ -668,6 +668,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
$selectedLines = GETPOST('toselect', 'array');
$db->begin();
@ -980,6 +981,8 @@ if (empty($reshook))
$num = count($lines);
for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0
{
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
@ -2239,9 +2242,6 @@ if ($action == 'create')
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
// Show origin lines
if (is_object($objectsrc))
{
@ -2256,6 +2256,8 @@ if ($action == 'create')
print '</table>';
}
print "</form>\n";
}
else
{