Permalink
Browse files

Fix validation

  • Loading branch information...
1 parent 1e57af2 commit a634c36ab781cc7b1fb81338a70d6cc5ff6a3501 @gerald committed Mar 27, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/finished_good_transaction.rb
View
2 app/models/finished_good_transaction.rb
@@ -72,7 +72,7 @@ def taken_bag_range
def released_bag_range
self.finished_good_transaction_items.each do |item|
- if item.transaction_type == "sub" && Bag.count(:include => [:finished_good_transaction_item], :conditions => ["removing_transaction_id IS NOT NULL AND bag_number >= ? AND bag_number <= ? AND finished_good_transaction_items.lot_number = ?", item.start_bag_number, item.end_bag_number, item.lot_number]) > 0
+ if item.transaction_type == "sub" && Bag.count(:include => [:finished_good_transaction_item, :finished_good], :conditions => ["removing_transaction_id IS NOT NULL AND bag_number >= ? AND bag_number <= ? AND finished_good_transaction_items.lot_number = ? AND finished_goods.id = ?", item.start_bag_number, item.end_bag_number, item.lot_number, self.finished_good_id]) > 0
self.errors.add(:base, "Current range will use bag numbers that have already been released")
return
end

0 comments on commit a634c36

Please sign in to comment.