Add IBAN field to supplier and user model

This commit is contained in:
Patrick Gansterer 2017-01-18 11:12:56 +01:00 committed by wvengen
parent 925727d3ae
commit c6731b4e4f
12 changed files with 34 additions and 2 deletions

View File

@ -10,12 +10,14 @@ class Supplier < ActiveRecord::Base
belongs_to :shared_supplier # for the sharedLists-App
include ActiveModel::MassAssignmentSecurity
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number,
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number, :iban,
:delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity, :shared_sync_method
validates :name, :presence => true, :length => { :in => 4..30 }
validates :phone, :presence => true, :length => { :in => 8..25 }
validates :address, :presence => true, :length => { :in => 8..50 }
validates_format_of :iban, :with => /\A[A-Z]{2}[0-9]{2}[0-9A-Z]{,30}\z/, :allow_blank => true
validates_uniqueness_of :iban, :case_sensitive => false, :allow_blank => true
validates_length_of :order_howto, :note, maximum: 250
validate :valid_shared_sync_method
validate :uniqueness_of_name

View File

@ -41,6 +41,8 @@ class User < ActiveRecord::Base
validates_length_of :nick, :in => 2..25, :allow_nil => true, :unless => Proc.new { FoodsoftConfig[:use_nick] }
validates_length_of :nick, :in => 2..25, :allow_nil => false, :if => Proc.new { FoodsoftConfig[:use_nick] }
validates_uniqueness_of :nick, :case_sensitive => false, :allow_nil => true # allow_nil in length validation
validates_format_of :iban, :with => /\A[A-Z]{2}[0-9]{2}[0-9A-Z]{,30}\z/, :allow_blank => true
validates_uniqueness_of :iban, :case_sensitive => false, :allow_blank => true
before_validation :set_password
after_initialize do

View File

@ -10,6 +10,7 @@
.input-prepend
%span.add-on= t 'number.currency.format.unit'
= config_input_field form, :minimum_balance, as: :decimal, class: 'input-small'
= config_input form, :use_iban, as: :boolean
%h4= t '.schedule_title'
= form.simple_fields_for :order_schedule do |fields|

View File

@ -10,6 +10,8 @@
= f.input :password, :required => f.object.new_record?, input_html: password_html
= f.input :password_confirmation, :required => f.object.new_record?, input_html: password_html
= f.input :phone
- if FoodsoftConfig[:use_iban]
= f.input :iban
- if local_assigns[:with_address] && (f.object.ordergroup || f.object.new_record?)
= f.fields_for [:ordergroup, f.object.ordergroup || Ordergroup.new] do |ogf|

View File

@ -12,6 +12,8 @@
= f.input :url
= f.input :contact_person
= f.input :customer_number
- if FoodsoftConfig[:use_iban]
= f.input :iban
= f.input :delivery_days
= f.input :order_howto, as: :text, input_html: {rows: 5}
= f.input :note, as: :text, input_html: {rows: 5}

View File

@ -29,6 +29,9 @@
%dd= @supplier.contact_person
%dt= heading_helper(Supplier, :customer_number) + ':'
%dd= @supplier.customer_number
- if FoodsoftConfig[:use_iban]
%dt= heading_helper(Supplier, :iban) + ':'
%dd= @supplier.iban
%dt= heading_helper(Supplier, :delivery_days) + ':'
%dd= @supplier.delivery_days
%dt= heading_helper(Supplier, :order_howto) + ':'

View File

@ -143,6 +143,7 @@ de:
delivery_days: Liefertage
email: E-Mail
fax: Fax
iban: IBAN
is_subscribed: abonniert?
min_order_quantity: Mindestbestellmenge
min_order_quantity_short: Menge (mind.)
@ -165,6 +166,7 @@ de:
user:
email: E-Mail
first_name: Vorname
iban: IBAN
last_activity: Letzte Aktivität
last_login: Letzter login
last_name: Nachname
@ -518,6 +520,7 @@ de:
use_boxfill: Wenn aktiviert, können Benutzer nahe am Ende der Bestellung diese nur mehr so verändern, dass sich die Gesamtsumme erhöht. Dies hilft beim auffüllen der verbleibenden Kisten. Es muss trotzdem noch das Kistenauffülldatum bei der Bestellung gesetzt werden.
use_current_orders:
use_documents: Einfache Dokumentenverwaltung aktivieren
use_iban: Zusätzlich Feld für die internationale Kontonummer bei Benutzern und Lieferanten anzeigen
use_messages: Den Mitgliedern erlauben, miteinander innerhalb Foodsoft zu kommunizieren
use_nick: Benutzernamen anstatt reale Namen zeigen und verwenden, jeder Benutzer muss dazu einen Benutzernamen (Spitznamen) haben.
use_wiki: "Änderbare Wiki Seiten aktivieren"
@ -569,6 +572,7 @@ de:
use_boxfill: Kistenauffüllphase
use_current_orders:
use_documents: Dokumente verwenden
use_iban: IBAN verwenden
use_messages: Nachrichten
use_nick: Benutzernamen verwenden
use_wiki: Wiki verwenden

View File

@ -143,6 +143,7 @@ en:
delivery_days: Delivery days
email: Email
fax: Fax
iban: IBAN
is_subscribed: subscribed?
min_order_quantity: Minimum order quantity
min_order_quantity_short: Min. quantity
@ -165,6 +166,7 @@ en:
user:
email: Email
first_name: First name
iban: IBAN
last_activity: Last activity
last_login: Last login
last_name: Last name
@ -520,6 +522,7 @@ en:
use_boxfill: When enabled, near end of an order, members are only able to change their order when increases the total amount ordered. This helps to fill any remaining boxes. You still need to set a box-fill date for the orders.
use_current_orders: Enable the current_orders plugin. Allows members with the order permission to change member amounts in multiple orders, using three new screens in the Orders menu. Especially useful for pick-up days.
use_documents: Add a basic document sharing page to the foodcoop menu.
use_iban: When enabled, supplier and user provide an additonal field for storing the international bank account number.
use_messages: Allow members to communicate with each other within Foodsoft.
use_nick: Show and use nicknames instead of real names. When enabling this, please check that each user has a nickname.
use_wiki: Enable editable wiki pages.
@ -571,6 +574,7 @@ en:
use_boxfill: Box-fill phase
use_current_orders: Extra distribute screens
use_documents: Enable documents
use_iban: Use IBAN
use_messages: Messages
use_nick: Use nicknames
use_wiki: Enable wiki

View File

@ -143,6 +143,7 @@ fr:
delivery_days: Jours de livraison
email: Email
fax: Fax
iban: IBAN
is_subscribed: abonné?
min_order_quantity: Prix minimum d'une commande
min_order_quantity_short: Qté min.
@ -165,6 +166,7 @@ fr:
user:
email: Email
first_name: Prénom
iban: IBAN
last_activity:
last_login: Dernière connection
last_name: Nom de famille

View File

@ -143,6 +143,7 @@ nl:
delivery_days: Bezorgdagen
email: Email
fax: Fax
iban: IBAN
is_subscribed: geabonneerd?
min_order_quantity: Minimale bestelhoeveelheid
min_order_quantity_short: Min. bestelling
@ -165,6 +166,7 @@ nl:
user:
email: Email
first_name: Voornaam
iban: IBAN
last_activity: Laatst actief
last_login: Laatste login
last_name: Achternaam

View File

@ -0,0 +1,6 @@
class AddIbanToSupplierAndUser < ActiveRecord::Migration
def change
add_column :suppliers, :iban, :string
add_column :users, :iban, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160226000000) do
ActiveRecord::Schema.define(version: 20161001000000) do
create_table "article_categories", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
@ -317,6 +317,7 @@ ActiveRecord::Schema.define(version: 20160226000000) do
t.string "min_order_quantity", limit: 255
t.datetime "deleted_at"
t.string "shared_sync_method", limit: 255
t.string "iban"
end
add_index "suppliers", ["name"], name: "index_suppliers_on_name", unique: true, using: :btree
@ -352,6 +353,7 @@ ActiveRecord::Schema.define(version: 20160226000000) do
t.datetime "last_login"
t.datetime "last_activity"
t.datetime "deleted_at"
t.string "iban"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree