Close #17145 : add link to autofill with expected qty

This commit is contained in:
lmarcouiller 2021-04-07 12:46:28 +02:00
parent fcc6431896
commit 41db9abff8
2 changed files with 18 additions and 3 deletions

View File

@ -253,4 +253,5 @@ LabelOfInventoryMovemement=Inventory %s
ReOpen=Reopen
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock.
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
MakeMovementsAndClose=Generate movements and close
AutofillWithExpected=Auto-fill with real quantity expected quantity

View File

@ -466,6 +466,20 @@ if ($object->id > 0) {
} else {
print '<a class="classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Save").'</a>'."\n";
}
if ($permissiontoadd && $conf->use_javascript_ajax) {
print '&nbsp;';
print '<script>';
print 'function fillWithExpected(){
$(".expectedqty").each(function(){
var object = $(this)[0]
var objecttofill = $("#"+object.id+"_input")[0]
objecttofill.value = object.innerText
})
console.log("Values filled")
}';
print '</script>';
print '<a class="butAction" onclick="fillWithExpected()">'.$langs->trans('AutofillWithExpected').'</a>';
}
print '<br>';
print '<br>';
print '</center>';
@ -603,13 +617,13 @@ if ($object->id > 0) {
print '</td>';
}
print '<td class="right">';
print '<td class="right expectedqty" id="id_'.$obj->rowid.'">';
print $obj->qty_stock;
print '</td>';
print '<td class="center">';
if ($object->status == $object::STATUS_VALIDATED) {
$qty_view = GETPOST("id_".$obj->rowid) ? GETPOST("id_".$obj->rowid) : $obj->qty_view;
print '<input type="text" class="maxwidth75 right" name="id_'.$obj->rowid.'" value="'.$qty_view.'">';
print '<input type="text" class="maxwidth75 right" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
print '</td>';
print '<td class="right">';
print '<a class="reposition" href="'.DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id.'&lineid='.$obj->rowid.'&action=deleteline&token='.newToken().'">'.img_delete().'</a>';