Don't update input when unchecking

This commit is contained in:
Ludovic Stephan 2017-04-03 16:03:22 -03:00
parent f46ba0dd6c
commit 32474a6865

View file

@ -101,7 +101,7 @@ $(document).ready(function() {
* Remove warning and update stock
*/
function update_stock($line) {
function update_stock($line, update_count) {
$line.removeClass('inventory_modified');
$line.find('.inventory_update').hide();
@ -110,7 +110,7 @@ $(document).ready(function() {
$line.find('.current_stock').text(old_stock + stock_diff);
$line.find('.stock_diff').text('');
if ($line.find('.stock_new input').val() && stock_diff) {
if ($line.find('.stock_new input').val() && update_count) {
var old_misc = +$line.find('.misc input').val();
$line.find('.misc input').val(old_misc + stock_diff)
.trigger('input');
@ -122,12 +122,12 @@ $(document).ready(function() {
$('.finished input').change(function() {
var $line = $(this).closest('tr');
update_stock($line);
update_stock($line, false);
});
$('.inventory_update button').click(function() {
var $line = $(this).closest('tr');
update_stock($line);
update_stock($line, true);
});