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:
commit
eba377cdf0
@ -668,6 +668,7 @@ if (empty($reshook))
|
|||||||
elseif ($action == 'add' && $usercancreate)
|
elseif ($action == 'add' && $usercancreate)
|
||||||
{
|
{
|
||||||
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
||||||
|
$selectedLines = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -980,6 +981,10 @@ if (empty($reshook))
|
|||||||
$num = count($lines);
|
$num = count($lines);
|
||||||
for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0
|
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);
|
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
$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 '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
|
|
||||||
// Show origin lines
|
// Show origin lines
|
||||||
if (is_object($objectsrc))
|
if (is_object($objectsrc))
|
||||||
{
|
{
|
||||||
@ -2252,10 +2254,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList();
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user