Allow article price equal to zero. Closes #111

This commit is contained in:
Benjamin Meichsner 2013-04-08 14:40:02 +02:00 committed by wvengen
parent f1d6df9ecc
commit 79d1c5a66d
2 changed files with 4 additions and 2 deletions

View file

@ -18,7 +18,8 @@ class Article < ActiveRecord::Base
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
validates_length_of :name, :in => 4..60
validates_length_of :unit, :in => 2..15
validates_numericality_of :price, :unit_quantity, :greater_than => 0
validates_numericality_of :price, :greater_than_or_equal_to => 0
validates_numericality_of :unit_quantity, :greater_than => 0
validates_numericality_of :deposit, :tax
validates_uniqueness_of :name, :scope => [:supplier_id, :deleted_at, :type]

View file

@ -4,7 +4,8 @@ class ArticlePrice < ActiveRecord::Base
has_many :order_articles
validates_presence_of :price, :tax, :deposit, :unit_quantity
validates_numericality_of :price, :unit_quantity, :greater_than => 0
validates_numericality_of :price, :greater_than_or_equal_to => 0
validates_numericality_of :unit_quantity, :greater_than => 0
validates_numericality_of :deposit, :tax
localize_input_of :price, :tax, :deposit