FIX picto on shipment to reset qty to 0. Some quantities were not reset.

This commit is contained in:
Laurent Destailleur 2021-03-04 08:52:55 +01:00
parent 31845e1dae
commit a371647bca

View File

@ -1044,15 +1044,7 @@ if ($action == 'create')
$i++;
}
print '});
jQuery("#autoreset").click(function() { console.log("Reset values to 0"); ';
$i = 0;
while ($i < $numAsked)
{
print 'jQuery("#qtyl'.$i.'").val(0);'."\n";
if (!empty($conf->productbatch->enabled)) print 'jQuery("#qtyl'.$i.'_'.$i.'").val(0);'."\n";
$i++;
}
print '});
jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0); });
});
</script>';
@ -1294,7 +1286,7 @@ if ($action == 'create')
$deliverableQty = min($quantityToBeDelivered, $batchStock);
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>';
print '<td colspan="3" ></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
print '<!-- Show details of lot -->';
@ -1327,7 +1319,7 @@ if ($action == 'create')
} else {
print '<!-- Case there is no details of lot at all -->';
print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '</td>';
print '<td class="left">';
@ -1451,7 +1443,7 @@ if ($action == 'create')
$deliverableQty = min($quantityToBeDelivered, $batchStock);
if ($deliverableQty < 0) $deliverableQty = 0;
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'><td colspan="3"></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
print '<td class="left">';
@ -1496,7 +1488,7 @@ if ($action == 'create')
if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty.
$disabled = 'disabled="disabled"';
}
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
} else {
print $langs->trans("NA");
}
@ -2212,7 +2204,7 @@ if ($action == 'create')
{
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'"></td>';
// Batch number managment
if ($lines[$i]->entrepot_id == 0)
{
@ -2225,7 +2217,7 @@ if ($action == 'create')
// add a 0 qty lot row to be able to add a lot
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0"></td>';
// Batch number managment
print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>';
print '</tr>';
@ -2238,7 +2230,7 @@ if ($action == 'create')
print '<!-- case edit 2 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2251,7 +2243,7 @@ if ($action == 'create')
{
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2266,7 +2258,7 @@ if ($action == 'create')
print '<!-- case edit 5 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
// Warehouse source
print '<td></td>';
// Batch number managment