Merge branch 'master' into warn-uncheck-ordered-article
This commit is contained in:
commit
e728e76729
55 changed files with 2900 additions and 138 deletions
|
|
@ -7,8 +7,8 @@ class SharedArticle < ActiveRecord::Base
|
|||
|
||||
belongs_to :shared_supplier, :foreign_key => :supplier_id
|
||||
|
||||
def build_new_article
|
||||
shared_supplier.supplier.articles.build(
|
||||
def build_new_article(supplier)
|
||||
supplier.articles.build(
|
||||
:name => name,
|
||||
:unit => unit,
|
||||
:note => note,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class SharedSupplier < ActiveRecord::Base
|
|||
# set correct table_name in external DB
|
||||
self.table_name = 'suppliers'
|
||||
|
||||
has_one :supplier
|
||||
has_many :suppliers
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
# These set of attributes are used to autofill attributes of new supplier,
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ class Supplier < ActiveRecord::Base
|
|||
:delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity
|
||||
|
||||
validates :name, :presence => true, :length => { :in => 4..30 }
|
||||
validates :phone, :presence => true, :length => { :in => 8..20 }
|
||||
validates :phone, :presence => true, :length => { :in => 8..25 }
|
||||
validates :address, :presence => true, :length => { :in => 8..50 }
|
||||
validates_length_of :order_howto, :note, maximum: 250
|
||||
validates_length_of :phone, :in => 8..20
|
||||
validates_length_of :address, :in => 8..50
|
||||
validate :uniqueness_of_name
|
||||
|
||||
scope :undeleted, -> { where(deleted_at: nil) }
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def receive_email?
|
||||
settings.messages['send_as_email'] == "1" && email.present?
|
||||
settings.messages['send_as_email'] && email.present?
|
||||
end
|
||||
|
||||
# Sets the user's password. It will be stored encrypted along with a random salt.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class Workgroup < Group
|
|||
|
||||
has_many :tasks
|
||||
# returns all non-finished tasks
|
||||
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], :order => 'due_date ASC'
|
||||
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], order: 'due_date ASC, name ASC'
|
||||
|
||||
validates_uniqueness_of :name
|
||||
validate :last_admin_on_earth, :on => :update
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue