Introduced invoices and deliveries. Integration (especially of deliveries) isn't finished yet.

This commit is contained in:
Benjamin Meichsner 2009-01-08 16:33:27 +01:00
parent 1894f27fe0
commit 30f3d199d3
65 changed files with 1193 additions and 209 deletions

View File

@ -127,5 +127,5 @@ class ApplicationController < ActionController::Base
def send_email_messages
Message.send_emails if Message.pending?
end
end

View File

@ -0,0 +1,94 @@
class DeliveriesController < ApplicationController
before_filter :find_supplier
# GET /deliveries
# GET /deliveries.xml
def index
@deliveries = @supplier.deliveries.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @deliveries }
end
end
# GET /deliveries/1
# GET /deliveries/1.xml
def show
@delivery = Delivery.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @delivery }
end
end
# GET /deliveries/new
# GET /deliveries/new.xml
def new
@delivery = @supplier.deliveries.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @delivery }
end
end
# GET /deliveries/1/edit
def edit
@delivery = Delivery.find(params[:id])
end
# POST /deliveries
# POST /deliveries.xml
def create
@delivery = Delivery.new(params[:delivery])
respond_to do |format|
if @delivery.save
flash[:notice] = 'Delivery was successfully created.'
format.html { redirect_to([@supplier,@delivery]) }
format.xml { render :xml => @delivery, :status => :created, :location => @delivery }
else
format.html { render :action => "new" }
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
end
end
end
# PUT /deliveries/1
# PUT /deliveries/1.xml
def update
@delivery = Delivery.find(params[:id])
respond_to do |format|
if @delivery.update_attributes(params[:delivery])
flash[:notice] = 'Delivery was successfully updated.'
format.html { redirect_to([@supplier,@delivery]) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /deliveries/1
# DELETE /deliveries/1.xml
def destroy
@delivery = Delivery.find(params[:id])
@delivery.destroy
respond_to do |format|
format.html { redirect_to(supplier_deliveries_url(@supplier)) }
format.xml { head :ok }
end
end
protected
def find_supplier
@supplier = Supplier.find(params[:supplier_id]) if params[:supplier_id]
end
end

View File

@ -0,0 +1,79 @@
class InvoicesController < ApplicationController
def index
@invoices = Invoice.find(:all, :order => "date DESC")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @invoices }
end
end
def show
@invoice = Invoice.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @invoice }
end
end
def new
@invoice = Invoice.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @invoice }
end
end
def edit
@invoice = Invoice.find(params[:id])
end
# POST /invoices
# POST /invoices.xml
def create
@invoice = Invoice.new(params[:invoice])
respond_to do |format|
if @invoice.save
flash[:notice] = 'Invoice was successfully created.'
format.html { redirect_to(@invoice) }
format.xml { render :xml => @invoice, :status => :created, :location => @invoice }
else
format.html { render :action => "new" }
format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }
end
end
end
# PUT /invoices/1
# PUT /invoices/1.xml
def update
@invoice = Invoice.find(params[:id])
respond_to do |format|
if @invoice.update_attributes(params[:invoice])
flash[:notice] = 'Invoice was successfully updated.'
format.html { redirect_to(@invoice) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /invoices/1
# DELETE /invoices/1.xml
def destroy
@invoice = Invoice.find(params[:id])
@invoice.destroy
respond_to do |format|
format.html { redirect_to(invoices_path) }
format.xml { head :ok }
end
end
end

View File

@ -1,19 +1,12 @@
class SuppliersController < ApplicationController
before_filter :authenticate_suppliers, :except => [:index, :list]
verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list }
# messages
MSG_SUPPLIER_DESTOYED = "Lieferant wurde gelöscht"
MSG_SUPPLIER_UPDATED = 'Lieferant wurde aktualisiert'
MSG_SUPPLIER_CREATED = "Lieferant wurde erstellt"
def index
list
render :action => 'list'
end
def list
@supplier_column_names = ["Name", "Telefon", "Email", "Kundennummer"]
@supplier_columns = ["name", "phone", "email", "customer_number"]
@suppliers = Supplier.find :all
@ -40,7 +33,7 @@ class SuppliersController < ApplicationController
@supplier = Supplier.new(params[:supplier])
if @supplier.save
flash[:notice] = MSG_SUPPLIER_CREATED
redirect_to :action => 'list'
redirect_to suppliers_path
else
render :action => 'new'
end
@ -54,19 +47,20 @@ class SuppliersController < ApplicationController
@supplier = Supplier.find(params[:id])
if @supplier.update_attributes(params[:supplier])
flash[:notice] = MSG_SUPPLIER_UPDATED
redirect_to :action => 'show', :id => @supplier
redirect_to @supplier
else
render :action => 'edit'
end
end
def destroy
Supplier.find(params[:id]).destroy
@supplier = Supplier.find(params[:id])
@supplier.destroy
flash[:notice] = MSG_SUPPLIER_DESTOYED
redirect_to :action => 'list'
redirect_to suppliers_path
rescue => e
flash[:error] = _("An error has occurred: ") + e.message
redirect_to :action => 'show', :id => params[:id]
redirect_to @supplier
end
# gives a list with all available shared_suppliers

View File

@ -84,5 +84,8 @@ module ApplicationHelper
def title(page_title)
content_for(:title) { page_title }
end
def tab_is_active?(tab)
tab[:active].detect {|c| c == controller.controller_name }
end
end

View File

@ -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

View File

@ -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

View File

@ -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
View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
View 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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,17 @@
<h1>Editing delivery</h1>
<% form_for([@supplier,@delivery]) do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :supplier_id %>
<p>
<%= f.label :delivered_on %><br />
<%= f.date_select :delivered_on %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
<%= link_to 'Show', [@supplier,@delivery] %> |
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View File

@ -0,0 +1,22 @@
<% title "#{@supplier.name}/deliveries" %>
<table>
<tr>
<th>Delivered on</th>
<th>Invoice</th>
</tr>
<% for delivery in @deliveries %>
<tr>
<td><%=h delivery.delivered_on %></td>
<td><%=h "invoice ..." %></td>
<td><%= link_to 'Show', [@supplier, delivery] %></td>
<td><%= link_to 'Edit', edit_supplier_delivery_path(@supplier,delivery) %></td>
<td><%= link_to 'Destroy', [@supplier,delivery], :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New delivery', new_supplier_delivery_path(@supplier) %>

View File

@ -0,0 +1,16 @@
<h1>New delivery</h1>
<% form_for([@supplier,@delivery]) do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :supplier_id %>
<p>
<%= f.label :delivered_on %><br />
<%= f.date_select :delivered_on %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View File

@ -0,0 +1,13 @@
<p>
<b>Supplier:</b>
<%=h @delivery.supplier_id %>
</p>
<p>
<b>Delivered on:</b>
<%=h @delivery.delivered_on %>
</p>
<%= link_to 'Edit', edit_supplier_delivery_path(@supplier,@delivery) %> |
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View File

@ -0,0 +1,36 @@
<h1>Editing invoice</h1>
<% form_for(@invoice) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :supplier_id %><br />
<%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %>
</p>
<p>
<%= f.label :number %><br />
<%= f.text_field :number %>
</p>
<p>
<%= f.label :date %><br />
<%= f.date_select :date %>
</p>
<p>
<%= f.label :paid_on %><br />
<%= f.date_select :paid_on, :include_blank => true %>
</p>
<p>
<%= f.label :amount %><br />
<%= f.text_field :amount %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_area :note %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
<%= link_to 'Show', @invoice %> |
<%= link_to 'Back', invoices_path %>

View File

@ -0,0 +1,32 @@
<% title "Invoices" %>
<table class="list" style="width:70em">
<tr>
<th>Supplier</th>
<th>Number</th>
<th>Date</th>
<th>Paid on</th>
<th>Amount</th>
<th>Delivery</th>
<th>Note</th>
</tr>
<% for invoice in @invoices %>
<tr>
<td><%=h invoice.supplier.name %></td>
<td><%=h invoice.number %></td>
<td><%= invoice.date %></td>
<td><%= invoice.paid_on %></td>
<td><%= invoice.amount %></td>
<td><%=h invoice.delivery_id %></td>
<td><%=h truncate(invoice.note) %></td>
<td><%= link_to 'Show', invoice %></td>
<td><%= link_to 'Edit', edit_invoice_path(invoice) %></td>
<td><%= link_to 'Destroy', invoice, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New invoice', new_invoice_path %>

View File

@ -0,0 +1,35 @@
<h1>New invoice</h1>
<% form_for(@invoice) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :supplier_id %><br />
<%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %>
</p>
<p>
<%= f.label :number %><br />
<%= f.text_field :number %>
</p>
<p>
<%= f.label :date %><br />
<%= f.date_select :date %>
</p>
<p>
<%= f.label :paid_on %><br />
<%= f.date_select :paid_on, :include_blank => true %>
</p>
<p>
<%= f.label :amount %><br />
<%= f.text_field :amount %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_area :note %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
<%= link_to 'Back', invoices_path %>

View File

@ -0,0 +1,40 @@
<% title "Show invoice #{@invoice.number}" %>
<p>
<b>Supplier:</b>
<%=h @invoice.supplier.name %>
</p>
<p>
<b>Delivery:</b>
<%=h @invoice.delivery_id %>
</p>
<p>
<b>Number:</b>
<%=h @invoice.number %>
</p>
<p>
<b>Date:</b>
<%=h @invoice.date %>
</p>
<p>
<b>Paid on:</b>
<%=h @invoice.paid_on %>
</p>
<p>
<b>Amount:</b>
<%=h @invoice.amount %>
</p>
<p>
<b>Note:</b>
<%=h @invoice.note %>
</p>
<%= link_to 'Edit', edit_invoice_path(@invoice) %> |
<%= link_to 'Back', invoices_path %>

View File

@ -0,0 +1,61 @@
<%
u = @current_user
tabs = [
{ :name => "Start", :url => root_path, :active => ["index", "messages", "tasks"],
:subnav => [
{ :name => "Members", :url => "/index/foodcoop_members"},
{ :name => "Workgroups", :url => "/index/workgroups"},
{ :name => "Tasks", :url => "/tasks"},
{ :name => "Messages", :url => "/messages/inbox"},
{ :name => "My Ordergroup", :url => my_order_group_path},
{ :name => "My Ordergroup", :url => my_profile_path}
]
},
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
:subnav => [
{ :name => "Order", :url => "/ordering" },
{ :name => "My orders", :url => "/ordering/myOrders" },
{ :name => "Manage orders", :url => "/orders", :access? => (u.role_orders?) }
]
},
{ :name => "Articles", :url => "/articles", :active => ["articles", "suppliers"],
:access? => (u.role_article_meta? || u.role_suppliers?),
:subnav => [
{ :name => "Show articles", :url => "/articles/list" },
{ :name => "Categories", :url => "/articles" },
{ :name => "Suppliers", :url => suppliers_path, :access? => (u.role_suppliers?) }
]
},
{ :name => "Finance", :url => "/finance", :active => ["finance", "invoices"],
:access? => (u.role_finance?),
:subnav => [
{ :name => "Ordergroups", :url => "/finance/listOrdergroups" },
{ :name => "Balance orders", :url => "/finance/listOrders" },
{ :name => "Invoices", :url => invoices_path }
]
},
{ :name => "Administration", :url => "/admin", :active => ["admin"],
:access? => (u.role_admin?),
:subnav => [
{ :name => "Users", :url => "/admin/listUsers" },
{ :name => "Groups", :url => "/admin/listGroups" }
]
}
]
-%>
<ul>
<% for tab in tabs -%>
<% unless tab[:access?] and tab[:access?] == false %>
<li class="<%= 'current' if tab_is_active?(tab) %>">
<%= link_to tab[:name], tab[:url] %>
<ul>
<% for subtab in tab[:subnav] -%>
<% unless subtab[:access?] and subtab[:access?] == false %>
<li><%= link_to subtab[:name], subtab[:url] %></li>
<% end -%>
<% end -%>
</ul>
</li>
<% end -%>
<% end -%>
</ul>

View File

@ -18,7 +18,7 @@
%a{:href => "/"}
<span>food</span>soft
%span{:style => "color:white; font-size:45%; letter-spacing: -1px;"}= APP_CONFIG[:name]
#nav= render :partial => 'shared/nav'
#nav= render :partial => 'layouts/main_tabnav'
#main
#content

View File

@ -1,52 +0,0 @@
%ul
// Startarea
%li{:class => ("current" if controller.controller_name == 'index' || controller.controller_name == 'messages' || controller.controller_name == 'tasks')}
= link_to _('Startpage'), {:controller => 'index', :action => 'index'}, {:title => _('The Startpage. A good Startpoint.')}
%ul
%li= link_to _("Members"), {:controller => "index", :action => "foodcoop_members"}, {:title => _('Here you find a List with all Foodcoop members.')}
%li= link_to _("Workgroups"), {:controller => "index", :action => "workgroups"}, {:title => _('Here you find all Workgroups. For Example the sortinggroup with all their members.')}
%li= link_to _("Tasks"), {:controller => "tasks"}, {:title => _('Here you see the tasks. Please do something for the foodcoop!')}
- unread = Message.find_all_by_recipient_id_and_read(@current_user.id, false)
%li= link_to _("Messages") + "#{unread.nil? || unread.empty? ? '' : "(#{unread.size})"}", {:controller => 'messages', :action => 'inbox'}, {:title => _('Here you can read/write Messages from/to other foodcoop members')}
- if @current_user.find_ordergroup
%li= link_to _("My ordergroup"), {:controller => 'index', :action => 'myOrdergroup'}, {:title => _('Here are informations about your ordergroup. You can also see your accounts current')}
%li= link_to _("My Profile"), my_profile_path, {:title => _('Here are your personal Settings')}
// Orders
- hasOrderGroup = !@current_user.find_ordergroup.nil?
- hasOrdersRole = @current_user.role_orders?
- if hasOrderGroup || hasOrdersRole
%li{:class => ("current" if controller.controller_name == 'orders' || controller.controller_name == 'ordering')}
= hasOrderGroup ? link_to( _("Orders"), :controller => 'ordering') : link_to('Bestellungen', :controller => 'orders')
%ul
- if hasOrderGroup
%li= link_to _("Order"), :controller => "ordering"
%li= link_to _("My orders"), :controller => 'ordering', :action => "myOrders"
- if hasOrdersRole
%li= link_to _("Manage orders"), :controller => 'orders'
// Articles, Suppliers
- if @current_user.role_article_meta? || @current_user.role_suppliers?
%li{:class => ("current" if controller.controller_name == 'articles' || controller.controller_name == 'suppliers')}
= link_to _("Articles"), :controller => 'articles', :action => 'index'
%ul
%li= link_to _("Show articles"), :controller => 'articles', :action => 'list'
%li= link_to _("Categories"), :controller => 'articles', :action => 'index'
%li= link_to _("Suppliers"), :controller => 'suppliers', :action => 'list'
// Finance
- if @current_user.role_finance?
%li{:class => ("current" if controller.controller_name == 'finance')}
= link_to _("Finance"), :controller => 'finance'
%ul
%li= link_to _("Ordergroups"), :controller => 'finance', :action => 'listOrdergroups'
%li= link_to _("Balance orders"), :controller => 'finance', :action => 'listOrders'
// Administration
- if @current_user.role_admin?
%li{:class => ("current" if controller.controller_name == 'admin')}
= link_to _("Administration"), :controller => 'admin'
%ul
%li= link_to _("User"), :controller => 'admin', :action => 'listUsers'
%li= link_to _("Groups"), :controller => 'admin', :action => 'listGroups'

View File

@ -1,6 +1,5 @@
= error_messages_for 'supplier'
<!--[form:supplier]-->
- if @supplier.shared_supplier
%p Lieferantin wird mit externer Datenbank verknüpft.
.edit_form{:style=>"width:30em"}
@ -58,5 +57,4 @@
%label{:for => "supplier_min_order_quantity"} Mindestbestellmenge
%td= @f.text_field :min_order_quantity
= @f.hidden_field :shared_supplier_id
<!--[eoform:supplier]-->

View File

@ -1,6 +1,6 @@
%h1 Lieferantin bearbeiten
- form_for :supplier, @supplier, :url => {:action => 'update', :id => @supplier} do |@f|
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag 'Speichern'
|
= link_to 'Abbrechen', :action => 'list'
= link_to 'Abbrechen', suppliers_path

View File

@ -1,11 +1,12 @@
%h1 Lieferantinnen
- title "LieferantInnen"
- if @current_user.role_suppliers?
%p
%i
Erstelle eine
= link_to 'neue Lieferantin', :action => 'new'
= link_to 'neue Lieferantin', new_supplier_path
oder
= link_to 'importiere', :action => 'shared_suppliers'
= link_to 'importiere', shared_suppliers_suppliers_path
aus der externen ArtikelDatenbank.
.left_column{:style => "width:100%"}
@ -22,7 +23,7 @@
- for column in @supplier_columns
%td
- if column == 'name'
= link_to supplier[column], :action => 'show', :id => supplier
= link_to supplier[column], supplier
- else
=h supplier[column]
%td= link_to 'Artikel anzeigen', :controller => 'articles', :action => 'list', :id => supplier

View File

@ -1,7 +1,7 @@
%h1 Neue Lieferantinn
- form_for :supplier, @supplier, :url => {:action => 'create'} do |@f|
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag "Speichern"
|
= link_to 'Abbrechen', :action => 'list'
= link_to 'Abbrechen', suppliers_path

View File

@ -24,4 +24,4 @@
%td=h shared_supplier.note
%td=h shared_supplier.delivery_days
%td= image_tag("icon_message.gif", :size => "16x16", :border => "0",:alt => "abonniert!") if shared_supplier.supplier
%td= link_to "abonnieren", :action => "new", :shared_supplier_id => shared_supplier unless shared_supplier.supplier
%td= link_to "abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier) unless shared_supplier.supplier

View File

@ -47,8 +47,8 @@
%td{:style => "font-weight:bold"}=h @supplier.min_order_quantity
%br/
- if @current_user.role_suppliers?
= link_to 'Bearbeiten', :action => 'edit', :id => @supplier
= link_to 'Bearbeiten', edit_supplier_path(@supplier)
|
= link_to 'Löschen', { :action => 'destroy', :id => @supplier }, :confirm => 'Bist Du sicher?', :method => "post"
= link_to 'Löschen', @supplier, :confirm => 'Bist Du sicher?', :method => :delete
|
= link_to 'zurück', :action => 'list'
= link_to 'zurück', suppliers_path

View File

@ -1,6 +1,12 @@
ActionController::Routing::Routes.draw do |map|
map.resources :invoices
map.resources :suppliers,
:has_many => [:deliveries],
:collection => { :shared_suppliers => :get }
map.my_profile 'my_profile', :controller => 'index', :action => 'myProfile'
map.my_order_group 'my_order_group', :controller => 'index', :action => 'myOrdergroup'
map.root :controller => 'index'

View File

@ -0,0 +1,19 @@
class CreateInvoices < ActiveRecord::Migration
def self.up
create_table :invoices do |t|
t.integer :supplier_id
t.integer :delivery_id
t.string :number
t.date :date
t.date :paid_on
t.text :note
t.decimal :amount, :null => false, :precision => 8, :scale => 2, :default => 0.0
t.timestamps
end
end
def self.down
drop_table :invoices
end
end

View File

@ -0,0 +1,13 @@
class CreateDeliveries < ActiveRecord::Migration
def self.up
create_table :deliveries do |t|
t.integer :supplier_id
t.date :delivered_on
t.datetime :created_at
end
end
def self.down
drop_table :deliveries
end
end

View File

@ -1,5 +1,5 @@
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 25) do
ActiveRecord::Schema.define(:version => 20090102155714) do
create_table "article_categories", :force => true do |t|
t.string "name", :default => "", :null => false
@ -93,8 +93,8 @@ ActiveRecord::Schema.define(:version => 25) do
t.integer "tolerance"
end
add_index "group_order_article_results", ["order_article_result_id"], :name => "index_group_order_article_results_on_order_article_result_id"
add_index "group_order_article_results", ["group_order_result_id"], :name => "index_group_order_article_results_on_group_order_result_id"
add_index "group_order_article_results", ["order_article_result_id"], :name => "index_group_order_article_results_on_order_article_result_id"
create_table "group_order_articles", :force => true do |t|
t.integer "group_order_id", :default => 0, :null => false
@ -157,6 +157,18 @@ ActiveRecord::Schema.define(:version => 25) do
add_index "invites", ["token"], :name => "index_invites_on_token"
create_table "invoices", :force => true do |t|
t.integer "supplier_id"
t.integer "delivery_id"
t.string "number"
t.date "date"
t.date "paid_on"
t.text "note"
t.decimal "amount", :precision => 8, :scale => 2, :default => 0.0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "memberships", :force => true do |t|
t.integer "group_id", :default => 0, :null => false
t.integer "user_id", :default => 0, :null => false
@ -175,8 +187,8 @@ ActiveRecord::Schema.define(:version => 25) do
t.datetime "created_on", :null => false
end
add_index "messages", ["sender_id"], :name => "index_messages_on_sender_id"
add_index "messages", ["recipient_id"], :name => "index_messages_on_recipient_id"
add_index "messages", ["sender_id"], :name => "index_messages_on_sender_id"
create_table "order_article_results", :force => true do |t|
t.integer "order_id", :default => 0, :null => false
@ -223,9 +235,9 @@ ActiveRecord::Schema.define(:version => 25) do
t.string "invoice_date"
end
add_index "orders", ["starts"], :name => "index_orders_on_starts"
add_index "orders", ["ends"], :name => "index_orders_on_ends"
add_index "orders", ["finished"], :name => "index_orders_on_finished"
add_index "orders", ["starts"], :name => "index_orders_on_starts"
create_table "suppliers", :force => true do |t|
t.string "name", :default => "", :null => false
@ -258,8 +270,8 @@ ActiveRecord::Schema.define(:version => 25) do
t.integer "required_users", :default => 1
end
add_index "tasks", ["name"], :name => "index_tasks_on_name"
add_index "tasks", ["due_date"], :name => "index_tasks_on_due_date"
add_index "tasks", ["name"], :name => "index_tasks_on_name"
create_table "users", :force => true do |t|
t.string "nick", :default => "", :null => false
@ -276,7 +288,7 @@ ActiveRecord::Schema.define(:version => 25) do
t.datetime "last_login"
end
add_index "users", ["nick"], :name => "index_users_on_nick", :unique => true
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["nick"], :name => "index_users_on_nick", :unique => true
end

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
fruits:
id: 1

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
banana:
id: 1

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1

View File

@ -1,3 +1,16 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1

View File

@ -1,3 +1,15 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1

View File

@ -1,3 +1,15 @@
# == 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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1

View File

@ -1,3 +1,14 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
@ -9,4 +20,4 @@ two:
order_id: 1
group_name: Order Group 2
price: 99.95

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1
@ -10,4 +35,4 @@ another:
admins:
id: 3
name: Administrators
role_admin: true
role_admin: true

View File

@ -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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1
@ -7,4 +17,4 @@ another:
id: 2
group_id: 1
user_id: 2

View File

@ -1,3 +1,19 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1

View File

@ -1,3 +1,23 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1

View File

@ -1,3 +1,25 @@
# == 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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
first:
id: 1
@ -12,4 +34,4 @@ first:
phone2: 01234-7878787
address: berlin bio
customer_number: 123478
email: terra@terra.com
email: terra@terra.com

View File

@ -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)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1

View File

@ -1,3 +1,23 @@
# == 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
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
admin:
id: 1
@ -13,4 +33,4 @@ test:
nick: test
first_name: Tim
last_name: Tester
email: test@foo.test
email: test@foo.test