Merge pull request #18901 from xgerhard/disabled-button-zero-qty-fix
Fix #18890 Fix disabled button if sum real qty is 0
This commit is contained in:
commit
b93110e4f0
@ -716,7 +716,7 @@ if ($object->id > 0) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
$totalfound = 0;
|
||||
$hasinput = false;
|
||||
$totalarray = array();
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -766,7 +766,10 @@ if ($object->id > 0) {
|
||||
print '<td class="center">';
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
$qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view;
|
||||
$totalfound += price2num($qty_view, 'MS');
|
||||
if (!$hasinput && $qty_view !== null && $obj->qty_stock != $qty_view) {
|
||||
$hasinput = true;
|
||||
}
|
||||
|
||||
print '<input type="text" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
@ -777,7 +780,6 @@ if ($object->id > 0) {
|
||||
print '<input type="hidden" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'_input_tmp" id="id_'.$obj->rowid.'_input_tmp" value="'.$qty_tmp.'">';
|
||||
} else {
|
||||
print $obj->qty_view;
|
||||
$totalfound += $obj->qty_view;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
@ -799,7 +801,7 @@ if ($object->id > 0) {
|
||||
print '</div>';
|
||||
|
||||
// Call method to disable the button if no qty entered yet for inventory
|
||||
if ($object->status != $object::STATUS_VALIDATED || $totalfound == 0) {
|
||||
if ($object->status != $object::STATUS_VALIDATED || !$hasinput) {
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
disablebuttonmakemovementandclose();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user