Fixed suppliers module.

This commit is contained in:
benni 2011-05-18 15:52:06 +02:00
parent 772cf87c92
commit 0b1682af7c
9 changed files with 56 additions and 87 deletions

View file

@ -48,11 +48,11 @@ class ApplicationController < ActionController::Base
# We have an authenticated user, now check role...
# Roles gets the user through his memberships.
hasRole = case role
when "admin" then user.role_admin?
when "finance" then user.role_finance?
when "article_meta" then user.role_article_meta?
when "suppliers" then user.role_suppliers?
when "orders" then user.role_orders?
when "admin" then current_user.role_admin?
when "finance" then current_user.role_finance?
when "article_meta" then current_user.role_article_meta?
when "suppliers" then current_user.role_suppliers?
when "orders" then current_user.role_orders?
when "any" then true # no role required
else false # any unknown role will always fail
end

View file

@ -5,8 +5,6 @@ class OrderingController < ApplicationController
before_filter :ensure_ordergroup_member
before_filter :ensure_open_order, :only => [:order, :stock_order, :saveOrder]
verify :method => :post, :only => [:saveOrder], :redirect_to => {:action => :index}
# Index page.
def index
end

View file

@ -3,7 +3,7 @@ class SuppliersController < ApplicationController
helper :deliveries
def index
@suppliers = Supplier.without_deleted :order => 'name'
@suppliers = Supplier.order(:name)
@deliveries = Delivery.recent
end

View file

@ -9,10 +9,14 @@ class Supplier < ActiveRecord::Base
has_many :invoices
belongs_to :shared_supplier # for the sharedLists-App
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number, :delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity
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
validates_uniqueness_of :name
validates :name, :presence => true, :length => { :in => 4..30 }, :uniqueness => true
validates :phone, :presence => true, :length => { :in => 8..20 }
validates :address, :presence => true, :length => { :in => 8..50 }
# validates_length_of :name, :in => 4..30
# validates_uniqueness_of :name
validates_length_of :phone, :in => 8..20
validates_length_of :address, :in => 8..50

View file

@ -1,60 +1,19 @@
= error_messages_for 'supplier'
- simple_form_for @supplier do |f|
- if @supplier.shared_supplier
%p Lieferantin wird mit externer Datenbank verknüpft.
.edit_form{:style=>"width:30em"}
%table
%tr
%td
%label{:for => "supplier_name"} Name
%td= @f.text_field :name
%tr
%td
%label{:for => "supplier_address"} Adresse
%td= @f.text_field :address
%tr
%td
%label{:for => "supplier_phone"} Telefon
%td= @f.text_field :phone
%tr
%td
%label{:for => "supplier_phone2"} Telefon2
%td= @f.text_field :phone2
%tr
%td
%label{:for => "supplier_fax"} Fax
%td= @f.text_field :fax
%tr
%td
%label{:for => "supplier_email"} E-Mail
%td= @f.text_field :email
%tr
%td
%label{:for => "supplier_url"} Hompage
%td= @f.text_field :url
%tr
%td
%label{:for => "supplier_contact_person"} Kotakt Person
%td= @f.text_field :contact_person
%tr
%td
%label{:for => "supplier_customer_number"} Kundennummer
%td= @f.text_field :customer_number
%tr
%td
%label{:for => "supplier_delivery_days"} Liefertage
%td= @f.text_field :delivery_days
%tr
%td
%label{:for => "supplier_order_howto"} BestellHowto
%td= @f.text_field :order_howto
%tr
%td
%label{:for => "supplier_note"} Notiz
%td= @f.text_field :note
%tr
%td
%label{:for => "supplier_min_order_quantity"} Mindestbestellmenge
%td= @f.text_field :min_order_quantity
= @f.hidden_field :shared_supplier_id
= f.hidden_field :shared_supplier_id
= f.input :name
= f.input :address
= f.input :phone
= f.input :phone2
= f.input :fax
= f.input :email
= f.input :url
= f.input :contact_person
= f.input :customer_number
= f.input :delivery_days
= f.input :order_howto
= f.input :note
= f.input :min_order_quantity
= f.submit
= link_to 'oder abbrechen', suppliers_path

View file

@ -1,6 +1,3 @@
%h1 Lieferantin bearbeiten
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag 'Speichern'
|
= link_to 'Abbrechen', suppliers_path
- title "Lieferantin bearbeiten"
= render "form"

View file

@ -26,8 +26,8 @@
%td= link_to h(supplier.name) , supplier
%td=h supplier.phone
%td=h supplier.customer_number
%td= link_to "Artikel (#{supplier.articles.without_deleted.count})", supplier_articles_path(supplier)
%td= link_to "im Lager (#{supplier.stock_articles.without_deleted.count})", stock_articles_path
%td= link_to "Artikel (#{supplier.articles.count})", supplier_articles_path(supplier)
%td= link_to "im Lager (#{supplier.stock_articles.count})", stock_articles_path
%td= link_to "Lieferungen (#{supplier.deliveries.count})", supplier_deliveries_path(supplier)
.right_column{:style => "width:37%"}

View file

@ -1,7 +1,3 @@
%h1 Neue Lieferantinn
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag "Speichern"
|
= link_to 'Abbrechen', suppliers_path
- title "Neue Lieferantin"
= render "form"

View file

@ -207,6 +207,7 @@ de:
password: 'Passwort'
description: 'Beschreibung'
title: 'Titel'
email: 'E-Mail'
workgroup:
weekly_task: 'Monatlichen Job definieren?'
weekday: 'Wochentag'
@ -230,7 +231,21 @@ de:
private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang'
page:
body: 'Inhalt'
supplier:
address: 'Adresse'
phone: 'Telefon'
phone2: 'Telefon 2'
fax: 'FAX'
url: 'Homepage'
contact_person: 'Ansprechparter_in'
customer_number: 'Kundennummer'
delivery_days: 'Liefertage'
order_howto: 'Howto Bestellen'
note: 'Notiz'
min_order_quantity: 'Mindestbestellmenge'
hints:
task:
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden'
required_users: 'Wieviel Benutzerinnen werden insgesamt benötigt?'
supplier:
min_order_quantity: 'Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren'