Fixed suppliers module.
This commit is contained in:
parent
772cf87c92
commit
0b1682af7c
9 changed files with 56 additions and 87 deletions
|
@ -48,11 +48,11 @@ class ApplicationController < ActionController::Base
|
||||||
# We have an authenticated user, now check role...
|
# We have an authenticated user, now check role...
|
||||||
# Roles gets the user through his memberships.
|
# Roles gets the user through his memberships.
|
||||||
hasRole = case role
|
hasRole = case role
|
||||||
when "admin" then user.role_admin?
|
when "admin" then current_user.role_admin?
|
||||||
when "finance" then user.role_finance?
|
when "finance" then current_user.role_finance?
|
||||||
when "article_meta" then user.role_article_meta?
|
when "article_meta" then current_user.role_article_meta?
|
||||||
when "suppliers" then user.role_suppliers?
|
when "suppliers" then current_user.role_suppliers?
|
||||||
when "orders" then user.role_orders?
|
when "orders" then current_user.role_orders?
|
||||||
when "any" then true # no role required
|
when "any" then true # no role required
|
||||||
else false # any unknown role will always fail
|
else false # any unknown role will always fail
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,6 @@ class OrderingController < ApplicationController
|
||||||
before_filter :ensure_ordergroup_member
|
before_filter :ensure_ordergroup_member
|
||||||
before_filter :ensure_open_order, :only => [:order, :stock_order, :saveOrder]
|
before_filter :ensure_open_order, :only => [:order, :stock_order, :saveOrder]
|
||||||
|
|
||||||
verify :method => :post, :only => [:saveOrder], :redirect_to => {:action => :index}
|
|
||||||
|
|
||||||
# Index page.
|
# Index page.
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SuppliersController < ApplicationController
|
||||||
helper :deliveries
|
helper :deliveries
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@suppliers = Supplier.without_deleted :order => 'name'
|
@suppliers = Supplier.order(:name)
|
||||||
@deliveries = Delivery.recent
|
@deliveries = Delivery.recent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,14 @@ class Supplier < ActiveRecord::Base
|
||||||
has_many :invoices
|
has_many :invoices
|
||||||
belongs_to :shared_supplier # for the sharedLists-App
|
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 :name, :presence => true, :length => { :in => 4..30 }, :uniqueness => true
|
||||||
validates_uniqueness_of :name
|
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 :phone, :in => 8..20
|
||||||
validates_length_of :address, :in => 8..50
|
validates_length_of :address, :in => 8..50
|
||||||
|
|
|
@ -1,60 +1,19 @@
|
||||||
= error_messages_for 'supplier'
|
- simple_form_for @supplier do |f|
|
||||||
|
- if @supplier.shared_supplier
|
||||||
- if @supplier.shared_supplier
|
%p Lieferantin wird mit externer Datenbank verknüpft.
|
||||||
%p Lieferantin wird mit externer Datenbank verknüpft.
|
= f.hidden_field :shared_supplier_id
|
||||||
.edit_form{:style=>"width:30em"}
|
= f.input :name
|
||||||
%table
|
= f.input :address
|
||||||
%tr
|
= f.input :phone
|
||||||
%td
|
= f.input :phone2
|
||||||
%label{:for => "supplier_name"} Name
|
= f.input :fax
|
||||||
%td= @f.text_field :name
|
= f.input :email
|
||||||
%tr
|
= f.input :url
|
||||||
%td
|
= f.input :contact_person
|
||||||
%label{:for => "supplier_address"} Adresse
|
= f.input :customer_number
|
||||||
%td= @f.text_field :address
|
= f.input :delivery_days
|
||||||
%tr
|
= f.input :order_howto
|
||||||
%td
|
= f.input :note
|
||||||
%label{:for => "supplier_phone"} Telefon
|
= f.input :min_order_quantity
|
||||||
%td= @f.text_field :phone
|
= f.submit
|
||||||
%tr
|
= link_to 'oder abbrechen', suppliers_path
|
||||||
%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
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
%h1 Lieferantin bearbeiten
|
- title "Lieferantin bearbeiten"
|
||||||
- form_for @supplier do |@f|
|
|
||||||
= render :partial => 'form'
|
= render "form"
|
||||||
= submit_tag 'Speichern'
|
|
||||||
|
|
|
||||||
= link_to 'Abbrechen', suppliers_path
|
|
|
@ -26,8 +26,8 @@
|
||||||
%td= link_to h(supplier.name) , supplier
|
%td= link_to h(supplier.name) , supplier
|
||||||
%td=h supplier.phone
|
%td=h supplier.phone
|
||||||
%td=h supplier.customer_number
|
%td=h supplier.customer_number
|
||||||
%td= link_to "Artikel (#{supplier.articles.without_deleted.count})", supplier_articles_path(supplier)
|
%td= link_to "Artikel (#{supplier.articles.count})", supplier_articles_path(supplier)
|
||||||
%td= link_to "im Lager (#{supplier.stock_articles.without_deleted.count})", stock_articles_path
|
%td= link_to "im Lager (#{supplier.stock_articles.count})", stock_articles_path
|
||||||
%td= link_to "Lieferungen (#{supplier.deliveries.count})", supplier_deliveries_path(supplier)
|
%td= link_to "Lieferungen (#{supplier.deliveries.count})", supplier_deliveries_path(supplier)
|
||||||
|
|
||||||
.right_column{:style => "width:37%"}
|
.right_column{:style => "width:37%"}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
%h1 Neue Lieferantinn
|
- title "Neue Lieferantin"
|
||||||
- form_for @supplier do |@f|
|
|
||||||
= render :partial => 'form'
|
|
||||||
= submit_tag "Speichern"
|
|
||||||
|
|
|
||||||
= link_to 'Abbrechen', suppliers_path
|
|
||||||
|
|
||||||
|
= render "form"
|
|
@ -207,6 +207,7 @@ de:
|
||||||
password: 'Passwort'
|
password: 'Passwort'
|
||||||
description: 'Beschreibung'
|
description: 'Beschreibung'
|
||||||
title: 'Titel'
|
title: 'Titel'
|
||||||
|
email: 'E-Mail'
|
||||||
workgroup:
|
workgroup:
|
||||||
weekly_task: 'Monatlichen Job definieren?'
|
weekly_task: 'Monatlichen Job definieren?'
|
||||||
weekday: 'Wochentag'
|
weekday: 'Wochentag'
|
||||||
|
@ -230,7 +231,21 @@ de:
|
||||||
private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang'
|
private: 'privat verschicken, Nachricht erscheint nicht im Foodsoft Posteingang'
|
||||||
page:
|
page:
|
||||||
body: 'Inhalt'
|
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:
|
hints:
|
||||||
task:
|
task:
|
||||||
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden'
|
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden'
|
||||||
required_users: 'Wieviel Benutzerinnen werden insgesamt benötigt?'
|
required_users: 'Wieviel Benutzerinnen werden insgesamt benötigt?'
|
||||||
|
supplier:
|
||||||
|
min_order_quantity: 'Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren'
|
||||||
|
|
Loading…
Reference in a new issue