diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 2ebde580db7..c0b607cde45 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -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 '
';
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 '';
print ' | ';
print '';
@@ -777,7 +780,6 @@ if ($object->id > 0) {
print '';
} else {
print $obj->qty_view;
- $totalfound += $obj->qty_view;
print ' | ';
}
print '';
@@ -799,7 +801,7 @@ if ($object->id > 0) {
print '';
// 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 '