fix receive exception when input is set to nil

This commit is contained in:
wvengen 2013-12-21 17:39:20 +01:00
parent 41ea9ed66e
commit a28c6031a4

View file

@ -171,8 +171,8 @@ class OrdersController < ApplicationController
# which makes received_changed? not work anymore
oa.attributes = oa_params
counts[0] += 1 if oa.units_received_changed?
cunits[0] += oa.units_received * oa.article.unit_quantity
unless oa.units_received.blank?
cunits[0] += oa.units_received * oa.article.unit_quantity
oacounts = oa.redistribute oa.units_received * oa.price.unit_quantity, rest_to
oacounts.each_with_index {|c,i| cunits[i+1]+=c; counts[i+1]+=1 if c>0 }
end