Merge pull request #17159 from Hystepik/develop#1

Close #17145 : add link to autofill with expected qty
This commit is contained in:
Laurent Destailleur 2021-04-09 12:50:33 +02:00 committed by GitHub
commit 06a7b8f5cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 expected quantity with real quantity

View File

@ -453,6 +453,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 '<button type="button" class="butAction" id="fillwithexpected">'.$langs->trans('AutofillWithExpected').'</button>';
print '<script>';
print '$("#fillwithexpected").on("click",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 '<br>';
print '<br>';
print '</center>';
@ -601,13 +615,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" name="id_'.$obj->rowid.'" 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>';