Merge branch 'wiki'
This commit is contained in:
commit
e75a42d509
146 changed files with 6300 additions and 261 deletions
|
|
@ -2,26 +2,26 @@
|
|||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer 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
|
||||
# supplier_id :integer default(0), not null
|
||||
# article_category_id :integer default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean(1) default(TRUE), not null
|
||||
# availability :boolean default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# price :decimal(8, 2)
|
||||
# price :decimal(, )
|
||||
# tax :float
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# unit_quantity :integer(4) default(1), not null
|
||||
# deposit :decimal(, ) default(0.0)
|
||||
# unit_quantity :integer default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# quantity :integer default(0)
|
||||
# deleted_at :datetime
|
||||
# type :string(255)
|
||||
# quantity :integer(4) default(0)
|
||||
#
|
||||
|
||||
class Article < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Table name: article_categories
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
#
|
||||
# Table name: article_prices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# article_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# article_id :integer
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# tax :decimal(8, 2) default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# unit_quantity :integer(4)
|
||||
# unit_quantity :integer
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
#
|
||||
# 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)
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default(0), not null
|
||||
# task_id :integer default(0), not null
|
||||
# accepted :boolean
|
||||
#
|
||||
|
||||
class Assignment < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
#
|
||||
# Table name: deliveries
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivered_on :date
|
||||
# created_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
#
|
||||
# Table name: financial_transactions
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# ordergroup_id :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# ordergroup_id :integer 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
|
||||
# note :text not null
|
||||
# user_id :integer default(0), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,28 +2,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) 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)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
# Groups organize the User.
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#
|
||||
# Table name: group_orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# ordergroup_id :integer(4) default(0), not null
|
||||
# order_id :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# ordergroup_id :integer default(0), not null
|
||||
# order_id :integer default(0), not null
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# lock_version :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# updated_by_user_id :integer(4)
|
||||
# updated_by_user_id :integer
|
||||
#
|
||||
|
||||
# A GroupOrder represents an Order placed by an Ordergroup.
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#
|
||||
# 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
|
||||
# id :integer not null, primary key
|
||||
# group_order_id :integer default(0), not null
|
||||
# order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# result :decimal(8, 3)
|
||||
# result :decimal(, )
|
||||
#
|
||||
|
||||
# A GroupOrderArticle stores the sum of how many items of an OrderArticle are ordered as part of a GroupOrder.
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
#
|
||||
# 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)
|
||||
# id :integer not null, primary key
|
||||
# group_order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0)
|
||||
# tolerance :integer default(0)
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
#
|
||||
# Table name: invites
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer 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
|
||||
# group_id :integer default(0), not null
|
||||
# user_id :integer default(0), not null
|
||||
# email :string(255) default(""), not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# delivery_id :integer(4)
|
||||
# order_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivery_id :integer
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
# note :text
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# deposit_credit :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# order_id :integer
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# deposit_credit :decimal(8, 2) default(0.0), not null
|
||||
#
|
||||
|
||||
class Invoice < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#
|
||||
# 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
|
||||
# id :integer not null, primary key
|
||||
# group_id :integer default(0), not null
|
||||
# user_id :integer default(0), not null
|
||||
#
|
||||
|
||||
class Membership < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# sender_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# sender_id :integer
|
||||
# recipients_ids :text
|
||||
# subject :string(255) not null
|
||||
# body :text
|
||||
# email_state :integer(4) default(0), not null
|
||||
# private :boolean(1)
|
||||
# email_state :integer default(0), not null
|
||||
# private :boolean
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
#
|
||||
# Table name: orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# note :text
|
||||
# starts :datetime
|
||||
# ends :datetime
|
||||
# state :string(255) default("open")
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# updated_by_user_id :integer(4)
|
||||
# lock_version :integer default(0), not null
|
||||
# updated_by_user_id :integer
|
||||
# foodcoop_result :decimal(8, 2)
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
#
|
||||
# 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
|
||||
# article_price_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# order_id :integer default(0), not null
|
||||
# article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# units_to_order :integer default(0), not null
|
||||
# lock_version :integer default(0), not null
|
||||
# article_price_id :integer
|
||||
#
|
||||
|
||||
# An OrderArticle represents a single Article that is part of an Order.
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#
|
||||
# Table name: order_comments
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4)
|
||||
# user_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# order_id :integer
|
||||
# user_id :integer
|
||||
# text :text
|
||||
# created_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -2,28 +2,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) 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)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
# Ordergroups can order, they are "children" of the class Group
|
||||
|
|
|
|||
61
app/models/page.rb
Normal file
61
app/models/page.rb
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: pages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# body :text
|
||||
# permalink :string(255)
|
||||
# lock_version :integer default(0)
|
||||
# updated_by :integer
|
||||
# redirect :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
|
||||
class Page < ActiveRecord::Base
|
||||
|
||||
belongs_to :user, :foreign_key => 'updated_by'
|
||||
|
||||
acts_as_versioned :version_column => :lock_version
|
||||
self.non_versioned_columns += ['permalink', 'created_at', 'title']
|
||||
acts_as_tree :order => "title"
|
||||
|
||||
attr_accessor :old_title # Save title to create redirect page when editing title
|
||||
|
||||
validates_presence_of :title, :body
|
||||
validates_uniqueness_of :permalink, :title
|
||||
|
||||
before_validation_on_create :set_permalink
|
||||
before_validation_on_update :update_permalink
|
||||
after_update :create_redirect
|
||||
|
||||
def self.permalink(title)
|
||||
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
||||
end
|
||||
|
||||
def set_permalink
|
||||
unless title.blank?
|
||||
self.permalink = Page.count == 0 ? "Home" : Page.permalink(title)
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def update_permalink
|
||||
if changed.include?("title")
|
||||
set_permalink
|
||||
self.old_title = changes["title"].first # Save title for creating redirect
|
||||
end
|
||||
end
|
||||
|
||||
def create_redirect
|
||||
unless old_title.blank?
|
||||
Page.create :redirect => id,
|
||||
:title => old_title,
|
||||
:body => "Weiterleitung auf [[#{title}]]..",
|
||||
:permalink => Page.permalink(old_title),
|
||||
:updated_by => updated_by
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2,26 +2,26 @@
|
|||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer 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
|
||||
# supplier_id :integer default(0), not null
|
||||
# article_category_id :integer default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean(1) default(TRUE), not null
|
||||
# availability :boolean default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# price :decimal(8, 2)
|
||||
# price :decimal(, )
|
||||
# tax :float
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# unit_quantity :integer(4) default(1), not null
|
||||
# deposit :decimal(, ) default(0.0)
|
||||
# unit_quantity :integer default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# quantity :integer default(0)
|
||||
# deleted_at :datetime
|
||||
# type :string(255)
|
||||
# quantity :integer(4) default(0)
|
||||
#
|
||||
|
||||
class StockArticle < Article
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#
|
||||
# Table name: stock_changes
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# delivery_id :integer(4)
|
||||
# order_id :integer(4)
|
||||
# stock_article_id :integer(4)
|
||||
# quantity :integer(4) default(0)
|
||||
# id :integer not null, primary key
|
||||
# delivery_id :integer
|
||||
# order_id :integer
|
||||
# stock_article_id :integer
|
||||
# quantity :integer default(0)
|
||||
# created_at :datetime
|
||||
# stock_taking_id :integer(4)
|
||||
# stock_taking_id :integer
|
||||
#
|
||||
|
||||
class StockChange < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Table name: stock_takings
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# date :date
|
||||
# note :text
|
||||
# created_at :datetime
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Table name: suppliers
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# address :string(255) default(""), not null
|
||||
# phone :string(255) default(""), not null
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
# delivery_days :string(255)
|
||||
# order_howto :string(255)
|
||||
# note :string(255)
|
||||
# shared_supplier_id :integer(4)
|
||||
# shared_supplier_id :integer
|
||||
# min_order_quantity :string(255)
|
||||
# deleted_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean(1)
|
||||
# workgroup_id :integer(4)
|
||||
# assigned :boolean(1)
|
||||
# done :boolean
|
||||
# workgroup_id :integer
|
||||
# assigned :boolean
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
# required_users :integer(4) default(1)
|
||||
# required_users :integer default(1)
|
||||
#
|
||||
|
||||
class Task < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# nick :string(255) default(""), not null
|
||||
# password_hash :string(255) default(""), not null
|
||||
# password_salt :string(255) default(""), not null
|
||||
|
|
@ -28,6 +28,7 @@ class User < ActiveRecord::Base
|
|||
has_many :assignments, :dependent => :destroy
|
||||
has_many :tasks, :through => :assignments
|
||||
has_many :send_messages, :class_name => "Message", :foreign_key => "sender_id"
|
||||
has_many :pages, :foreign_key => 'updated_by'
|
||||
|
||||
attr_accessor :password, :setting_attributes
|
||||
|
||||
|
|
|
|||
|
|
@ -2,28 +2,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) 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)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
# stats :text
|
||||
#
|
||||
|
||||
class Workgroup < Group
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue