Introduced invoices and deliveries. Integration (especially of deliveries) isn't finished yet.
This commit is contained in:
parent
1894f27fe0
commit
30f3d199d3
65 changed files with 1193 additions and 209 deletions
|
|
@ -1,20 +1,26 @@
|
|||
# articles are the internal products which can ordered by ordergroups
|
||||
#
|
||||
# articles have the following attributes:
|
||||
# * name
|
||||
# * supplier_id
|
||||
# * article_category_id
|
||||
# * unit (string, e.g. 500gr, 1liter)
|
||||
# * note
|
||||
# * availability (boolean)
|
||||
# * net_price, decimal (net price, which will be edited by the user)
|
||||
# * gross_price, decimal (gross price (or long price), incl. tax, deposit, price markup ... see environment.rb)
|
||||
# * tax, float (the VAT, value added tax. default is 7.00 which means 7.00%)
|
||||
# * deposit, decimal (deposit, e.g. for bottles)
|
||||
# * unit_quantity, int (the internal(FC) size of trading unit)
|
||||
# * order_number, varchar (for the supplier)
|
||||
# * created_at, timestamp
|
||||
# * updated_at, timestamp
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# supplier_id :integer(4) default(0), not null
|
||||
# article_category_id :integer(4) default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean(1) default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# net_price :decimal(8, 2)
|
||||
# gross_price :decimal(8, 2) default(0.0), not null
|
||||
# tax :float
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# unit_quantity :integer(4) default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
class Article < ActiveRecord::Base
|
||||
belongs_to :supplier
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: article_categories
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
#
|
||||
|
||||
class ArticleCategory < ActiveRecord::Base
|
||||
has_many :articles
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: assignments
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# user_id :integer(4) default(0), not null
|
||||
# task_id :integer(4) default(0), not null
|
||||
# accepted :boolean(1)
|
||||
#
|
||||
|
||||
class Assignment < ActiveRecord::Base
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
|||
17
app/models/delivery.rb
Normal file
17
app/models/delivery.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: deliveries
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# delivered_on :date
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
class Delivery < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
end
|
||||
|
|
@ -1,11 +1,18 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: financial_transactions
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_group_id :integer(4) default(0), not null
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# note :text default(""), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
# financial transactions are the foodcoop internal financial transactions
|
||||
# only order_groups have an account balance and are happy to transfer money
|
||||
#
|
||||
# financial transaction have the following attributes:
|
||||
# * order_group_id (int)
|
||||
# * amount (decimal)
|
||||
# * note (text)
|
||||
# * created_on (datetime)
|
||||
class FinancialTransaction < ActiveRecord::Base
|
||||
belongs_to :order_group
|
||||
belongs_to :user
|
||||
|
|
|
|||
|
|
@ -1,13 +1,29 @@
|
|||
# Groups organize the User.
|
||||
#
|
||||
# Group have the following attributes
|
||||
# * name
|
||||
# * description
|
||||
# * type (to specify, if it is a OrderGroup)
|
||||
# * role_admin, role_suppliers, role_article_eta, role_finance, role_orders
|
||||
# * weekly_task (if the group should do a job ervery week)
|
||||
# * weekday (on which weekday should the job be done? 1 means monday and so on)
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# actual_size :integer(4)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean(1) not null
|
||||
# role_suppliers :boolean(1) not null
|
||||
# role_article_meta :boolean(1) not null
|
||||
# role_finance :boolean(1) not null
|
||||
# role_orders :boolean(1) not null
|
||||
# weekly_task :boolean(1)
|
||||
# weekday :integer(4)
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
#
|
||||
|
||||
# Groups organize the User.
|
||||
# A Member gets the roles from the Group
|
||||
class Group < ActiveRecord::Base
|
||||
has_many :memberships, :dependent => :destroy
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
# A GroupOrder represents an Order placed by an OrderGroup.
|
||||
#
|
||||
# Properties:
|
||||
# * order_id (int): association to the Order
|
||||
# * order_group_id (int): association to the OrderGroup
|
||||
# * group_order_articles: collection of associated GroupOrderArticles
|
||||
# * order_articles: collection of associated OrderArticles (through GroupOrderArticles)
|
||||
# * price (decimal): the price of this GroupOrder (either maximum price if current order or the actual price if finished order)
|
||||
# * lock_version (int): ActiveRecord optimistic locking column
|
||||
# * updated_by (User): the user who last updated this order
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: group_orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_group_id :integer(4) default(0), not null
|
||||
# order_id :integer(4) default(0), not null
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# updated_by_user_id :integer(4) default(0), not null
|
||||
#
|
||||
|
||||
# A GroupOrder represents an Order placed by an OrderGroup.
|
||||
class GroupOrder < ActiveRecord::Base
|
||||
|
||||
belongs_to :order
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: group_order_articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_order_id :integer(4) default(0), not null
|
||||
# order_article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0), not null
|
||||
# tolerance :integer(4) default(0), not null
|
||||
# updated_on :datetime not null
|
||||
#
|
||||
|
||||
# A GroupOrderArticle stores the sum of how many items of an OrderArticle are ordered as part of a GroupOrder.
|
||||
# The chronologically order of the OrderGroup - activity are stored in GroupOrderArticleQuantity
|
||||
#
|
||||
# Properties:
|
||||
# * group_order_id (int): association to the GroupOrder
|
||||
# * order_article_id (int): association to the OrderArticle
|
||||
# * quantity (int): number of items ordered
|
||||
# * tolerance (int): number of items ordered as tolerance
|
||||
# * updated_on (timestamp): updated automatically by ActiveRecord
|
||||
#
|
||||
class GroupOrderArticle < ActiveRecord::Base
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: group_order_article_quantities
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_order_article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0)
|
||||
# tolerance :integer(4) default(0)
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
# stores the quantity, tolerance and timestamp of an GroupOrderArticle
|
||||
# Considers every update of an article-order, so may rows for one group_order_article ar possible.
|
||||
#
|
||||
# properties:
|
||||
# * group_order_article_id (int)
|
||||
# * quantity (int)
|
||||
# * tolerance (in)
|
||||
# * created_on (timestamp)
|
||||
|
||||
class GroupOrderArticleQuantity < ActiveRecord::Base
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: group_order_article_results
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_article_result_id :integer(4) default(0), not null
|
||||
# group_order_result_id :integer(4) default(0), not null
|
||||
# quantity :decimal(6, 3) default(0.0)
|
||||
# tolerance :integer(4)
|
||||
#
|
||||
|
||||
# An GroupOrderArticleResult represents a group-order for a single Article and its quantities,
|
||||
# according to the order quantity/tolerance.
|
||||
# The GroupOrderArticleResult is part of a finished Order, see OrderArticleResult.
|
||||
#
|
||||
# Properties:
|
||||
# * order_article_result_id (int)
|
||||
# * group_order_result_id (int): associated with OrderGroup through GroupOrderResult.group_name
|
||||
# * quantity (int)
|
||||
#
|
||||
class GroupOrderArticleResult < ActiveRecord::Base
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: group_order_results
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4) default(0), not null
|
||||
# group_name :string(255) default(""), not null
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
#
|
||||
|
||||
# OrderGroups, which participate on a specific order will have a line
|
||||
# Properties:
|
||||
# * order_id, int
|
||||
# * group_name, the name of the group
|
||||
# * price, decimal
|
||||
# * group_order_article_results: collection of associated GroupOrderArticleResults
|
||||
#
|
||||
class GroupOrderResult < ActiveRecord::Base
|
||||
|
||||
belongs_to :order
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: invites
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# token :string(255) default(""), not null
|
||||
# expires_at :datetime not null
|
||||
# group_id :integer(4) default(0), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
# email :string(255) default(""), not null
|
||||
#
|
||||
|
||||
require 'digest/sha1'
|
||||
|
||||
# Invites are created by foodcoop users to invite a new user into the foodcoop and their order group.
|
||||
#
|
||||
# Attributes:
|
||||
# * token - the authentication token for this invite
|
||||
# * group - the group the new user is to be made a member of
|
||||
# * user - the inviting user
|
||||
# * expires_at - the time this invite expires
|
||||
# * email - the recipient's email address
|
||||
class Invite < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :group
|
||||
|
|
|
|||
28
app/models/invoice.rb
Normal file
28
app/models/invoice.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# delivery_id :integer(4)
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
class Invoice < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
validates_uniqueness_of :date, :scope => [:supplier_id]
|
||||
|
||||
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
|
||||
def amount=(amount)
|
||||
self[:amount] = String.delocalized_decimal(amount)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,3 +1,13 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: memberships
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_id :integer(4) default(0), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
#
|
||||
|
||||
class Membership < ActiveRecord::Base
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
# A message within the foodsoft.
|
||||
#
|
||||
# * sender (User) - the sending User (might be nil if it is a system message)
|
||||
# * recipient (User) - the receiving User
|
||||
# * recipients (String) - list of all recipients of this message as User.nick/Group.name
|
||||
# * subject (string) - message subject
|
||||
# * body (string) - message body
|
||||
# * read? (boolean) - message read status
|
||||
# * email_state (integer) - email state, one of EMAIL_STATE.values
|
||||
# * created_on (timestamp) - creation timestamp
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# sender_id :integer(4)
|
||||
# recipient_id :integer(4) default(0), not null
|
||||
# recipients :string(255) default(""), not null
|
||||
# subject :string(255) default(""), not null
|
||||
# body :text default(""), not null
|
||||
# read :boolean(1) not null
|
||||
# email_state :integer(4) default(0), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
class Message < ActiveRecord::Base
|
||||
belongs_to :sender, :class_name => "User", :foreign_key => "sender_id"
|
||||
belongs_to :recipient, :class_name => "User", :foreign_key => "recipient_id"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,25 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# supplier_id :integer(4) default(0), not null
|
||||
# starts :datetime not null
|
||||
# ends :datetime
|
||||
# note :string(255)
|
||||
# finished :boolean(1) not null
|
||||
# booked :boolean(1) not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# updated_by_user_id :integer(4)
|
||||
# invoice_amount :decimal(8, 2) default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# deposit_credit :decimal(8, 2) default(0.0)
|
||||
# invoice_number :string(255)
|
||||
# invoice_date :string(255)
|
||||
#
|
||||
|
||||
class Order < ActiveRecord::Base
|
||||
has_many :order_articles, :dependent => :destroy
|
||||
has_many :articles, :through => :order_articles
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
# An OrderArticle represents a single Article that is part of an Order.
|
||||
#
|
||||
# Properties:
|
||||
# * order_id (int): association to the Order
|
||||
# * article_id (int): association to the Article
|
||||
# * quantity (int): number of items ordered by all OrderGroups for this order
|
||||
# * tolerance (int): number of items ordered as tolerance by all OrderGroups for this order
|
||||
# * units_to_order (int): number of packaging units to be ordered according to the order quantity/tolerance
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: order_articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4) default(0), not null
|
||||
# article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0), not null
|
||||
# tolerance :integer(4) default(0), not null
|
||||
# units_to_order :integer(4) default(0), not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
#
|
||||
|
||||
# An OrderArticle represents a single Article that is part of an Order.
|
||||
class OrderArticle < ActiveRecord::Base
|
||||
|
||||
belongs_to :order
|
||||
|
|
|
|||
|
|
@ -1,19 +1,24 @@
|
|||
# An OrderArticleResult represents a single Article that is part of a *finished* Order.
|
||||
#
|
||||
# Properties:
|
||||
# * order_id (int): association to the Order
|
||||
# * name (string): article name
|
||||
# * unit (string)
|
||||
# * note (string): for post-editing the ordered article. informations like "new tax is ..."
|
||||
# * net_price (decimal): the net price
|
||||
# * gross_price (decimal): incl tax, deposit, fc-markup
|
||||
# * tax (int)
|
||||
# * deposit (decimal)
|
||||
# * fc_markup (float)
|
||||
# * order_number (string)
|
||||
# * unit_quantity (int): the internal(FC) size of trading unit
|
||||
# * units_to_order (int): number of packaging units to be ordered according to the order quantity/tolerance
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: order_article_results
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4) default(0), not null
|
||||
# name :string(255) default(""), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# net_price :decimal(8, 2) default(0.0)
|
||||
# gross_price :decimal(8, 2) default(0.0), not null
|
||||
# tax :float default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# fc_markup :float default(0.0), not null
|
||||
# order_number :string(255)
|
||||
# unit_quantity :integer(4) default(0), not null
|
||||
# units_to_order :decimal(6, 3) default(0.0), not null
|
||||
#
|
||||
|
||||
# An OrderArticleResult represents a single Article that is part of a *finished* Order.
|
||||
class OrderArticleResult < ActiveRecord::Base
|
||||
belongs_to :order
|
||||
has_many :group_order_article_results, :dependent => :destroy
|
||||
|
|
|
|||
|
|
@ -1,3 +1,28 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# actual_size :integer(4)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean(1) not null
|
||||
# role_suppliers :boolean(1) not null
|
||||
# role_article_meta :boolean(1) not null
|
||||
# role_finance :boolean(1) not null
|
||||
# role_orders :boolean(1) not null
|
||||
# weekly_task :boolean(1)
|
||||
# weekday :integer(4)
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
#
|
||||
|
||||
# OrderGroups can order, they are "children" of the class Group
|
||||
#
|
||||
# OrderGroup have the following attributes, in addition to Group
|
||||
|
|
|
|||
|
|
@ -1,3 +1,27 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) not null
|
||||
# supplier_id :integer(4) not null
|
||||
# number :string(255)
|
||||
# note :string(255)
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# unit :string(255)
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# tax :decimal(3, 1) default(7.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# unit_quantity :decimal(4, 1) default(1.0), not null
|
||||
# scale_quantity :decimal(4, 2)
|
||||
# scale_price :decimal(8, 2)
|
||||
# created_on :datetime
|
||||
# updated_on :datetime
|
||||
# list :string(255)
|
||||
#
|
||||
|
||||
class SharedArticle < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: suppliers
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) not null
|
||||
# address :string(255) not null
|
||||
# phone :string(255) not null
|
||||
# phone2 :string(255)
|
||||
# fax :string(255)
|
||||
# email :string(255)
|
||||
# url :string(255)
|
||||
# delivery_days :string(255)
|
||||
# note :string(255)
|
||||
# created_on :datetime
|
||||
# updated_on :datetime
|
||||
# lists :string(255)
|
||||
#
|
||||
|
||||
class SharedSupplier < ActiveRecord::Base
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
|
|
|
|||
|
|
@ -1,6 +1,31 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: suppliers
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# address :string(255) default(""), not null
|
||||
# phone :string(255) default(""), not null
|
||||
# phone2 :string(255)
|
||||
# fax :string(255)
|
||||
# email :string(255)
|
||||
# url :string(255)
|
||||
# contact_person :string(255)
|
||||
# customer_number :string(255)
|
||||
# delivery_days :string(255)
|
||||
# order_howto :string(255)
|
||||
# note :string(255)
|
||||
# shared_supplier_id :integer(4)
|
||||
# min_order_quantity :string(255)
|
||||
#
|
||||
|
||||
class Supplier < ActiveRecord::Base
|
||||
has_many :articles, :dependent => :destroy
|
||||
has_many :orders
|
||||
has_many :deliveries
|
||||
has_many :invoices
|
||||
|
||||
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number, :delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity
|
||||
|
||||
validates_length_of :name, :in => 4..30
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean(1)
|
||||
# group_id :integer(4)
|
||||
# assigned :boolean(1)
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
# required_users :integer(4) default(1)
|
||||
#
|
||||
|
||||
class Task < ActiveRecord::Base
|
||||
has_many :assignments, :dependent => :destroy
|
||||
has_many :users, :through => :assignments
|
||||
|
|
|
|||
|
|
@ -1,13 +1,24 @@
|
|||
require 'digest/sha1'
|
||||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# nick :string(255) default(""), not null
|
||||
# password_hash :string(255) default(""), not null
|
||||
# password_salt :string(255) default(""), not null
|
||||
# first_name :string(255) default(""), not null
|
||||
# last_name :string(255) default(""), not null
|
||||
# email :string(255) default(""), not null
|
||||
# phone :string(255)
|
||||
# address :string(255)
|
||||
# created_on :datetime not null
|
||||
# reset_password_token :string(255)
|
||||
# reset_password_expires :datetime
|
||||
# last_login :datetime
|
||||
#
|
||||
|
||||
# A foodsoft user.
|
||||
#
|
||||
# * memberships
|
||||
# * groups
|
||||
# * first_name, last_name, email, phone, address
|
||||
# * nick
|
||||
# * password (stored as a hash)
|
||||
# * settings (user properties via acts_as_configurable plugin)
|
||||
require 'digest/sha1'
|
||||
# specific user rights through memberships (see Group)
|
||||
class User < ActiveRecord::Base
|
||||
has_many :memberships, :dependent => :destroy
|
||||
|
|
@ -173,4 +184,4 @@ class User < ActiveRecord::Base
|
|||
self.groups.find(:all, :conditions => {:type => ""})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue