Fix minor delivery bug

This commit is contained in:
Julius 2013-09-25 23:06:53 +02:00 committed by wvengen
parent 6632f5ed75
commit d36f2dd4ac

View file

@ -5,21 +5,19 @@
$('#stock_changes tr').removeClass('success'); $('#stock_changes tr').removeClass('success');
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>');
if(null === quantity) {
return false;
}
var stock_change = $( var stock_change = $(
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>' '<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
).addClass('success'); ).addClass('success');
enablePriceTooltips(stock_change); enablePriceTooltips(stock_change);
$('input.stock-change-quantity', stock_change).val(quantity);
$('#stock_changes').append(stock_change); $('#stock_changes').append(stock_change);
mark_article_for_delivery(<%= @stock_change.stock_article.id %>); mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
updateSort('#stock_changes'); updateSort('#stock_changes');
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>'); <%# how to properly escape here? %>
if(null === quantity) {
stock_change.remove();
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
return false;
}
$('input.stock-change-quantity', stock_change).val(quantity);
})(window); })(window);