Merge pull request #18860 from FHenry/12_fix_selectline_from_supplier_order_to_supplier_invoice

fix: Supplier order => Supplier Invoice : line selector (checkbox) wasn't working
This commit is contained in:
Laurent Destailleur 2021-10-06 15:31:14 +02:00 committed by GitHub
commit eba377cdf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,10 @@ 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 +2244,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))
{
@ -2252,10 +2254,12 @@ if ($action == 'create')
print '<table class="noborder centpercent">';
$objectsrc->printOriginLinesList();
$objectsrc->printOriginLinesList('', $selectedLines);
print '</table>';
}
print "</form>\n";
}
else
{