Allow article price equal to zero. Closes #111
This commit is contained in:
parent
4966aae0ad
commit
20e439c2a7
2 changed files with 4 additions and 2 deletions
|
@ -18,7 +18,8 @@ class Article < ActiveRecord::Base
|
||||||
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
|
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
|
||||||
validates_length_of :name, :in => 4..60
|
validates_length_of :name, :in => 4..60
|
||||||
validates_length_of :unit, :in => 2..15
|
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_numericality_of :deposit, :tax
|
||||||
validates_uniqueness_of :name, :scope => [:supplier_id, :deleted_at, :type]
|
validates_uniqueness_of :name, :scope => [:supplier_id, :deleted_at, :type]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ class ArticlePrice < ActiveRecord::Base
|
||||||
has_many :order_articles
|
has_many :order_articles
|
||||||
|
|
||||||
validates_presence_of :price, :tax, :deposit, :unit_quantity
|
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
|
validates_numericality_of :deposit, :tax
|
||||||
|
|
||||||
localize_input_of :price, :tax, :deposit
|
localize_input_of :price, :tax, :deposit
|
||||||
|
|
Loading…
Reference in a new issue