FIX Autofill / clear qty in inventory page

This commit is contained in:
Laurent Destailleur 2023-04-01 15:00:54 +02:00
parent d388ac58be
commit 6c589955a6

View File

@ -428,7 +428,12 @@ $help_url = '';
llxHeader('', $langs->trans('Inventory'), $help_url); llxHeader('', $langs->trans('Inventory'), $help_url);
// Part to show record // Part to show record
if ($object->id > 0) { if ($object->id <= 0) {
dol_print_error('', 'Bad value for object id');
exit;
}
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
$head = inventoryPrepareHead($object); $head = inventoryPrepareHead($object);
@ -618,7 +623,7 @@ if ($object->id > 0) {
jQuery(".realqty").trigger("change"); jQuery(".realqty").trigger("change");
}) })
console.log("Values filled (after click on fillwithexpected)"); console.log("Values filled (after click on fillwithexpected)");
disablebuttonmakemovementandclose(); /* disablebuttonmakemovementandclose(); */
return false; return false;
});'; });';
print '});'; print '});';
@ -871,7 +876,7 @@ if ($object->id > 0) {
print 'jQuery(document).ready(function() { print 'jQuery(document).ready(function() {
$("#clearqty").on("click", function() { $("#clearqty").on("click", function() {
console.log("Clear all values"); console.log("Clear all values");
disablebuttonmakemovementandclose(); /* disablebuttonmakemovementandclose(); */
jQuery(".realqty").val(""); jQuery(".realqty").val("");
jQuery(".realqty").trigger("change"); jQuery(".realqty").trigger("change");
return false; /* disable submit */ return false; /* disable submit */
@ -882,7 +887,7 @@ if ($object->id > 0) {
id = id.split("_")[1]; id = id.split("_")[1];
tmpvalue = $("#id_"+id+"_input_tmp").val() tmpvalue = $("#id_"+id+"_input_tmp").val()
$("#id_"+id+"_input")[0].value = tmpvalue; $("#id_"+id+"_input")[0].value = tmpvalue;
disablebuttonmakemovementandclose(); /* disablebuttonmakemovementandclose(); */
return false; /* disable submit */ return false; /* disable submit */
}); });
});'; });';
@ -1182,7 +1187,7 @@ if ($object->id > 0) {
// Call method to disable the button if no qty entered yet for inventory // Call method to disable the button if no qty entered yet for inventory
/*
if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { if ($object->status != $object::STATUS_VALIDATED || !$hasinput) {
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -1191,6 +1196,8 @@ if ($object->id > 0) {
}); });
</script>'; </script>';
} }
*/
print '</form>'; print '</form>';
print '<script type="text/javascript"> print '<script type="text/javascript">
@ -1302,7 +1309,6 @@ if ($object->id > 0) {
</script> </script>
<?php <?php
} }
}
// End of page // End of page
llxFooter(); llxFooter();