This commit is contained in:
wvengen 2013-10-02 17:23:49 +02:00
parent a8ace3bc79
commit 17bbb0705b
3 changed files with 18 additions and 14 deletions

View file

@ -34,7 +34,7 @@ class Finance::FinancialTransactionsController < ApplicationController
@financial_transaction = FinancialTransaction.new(params[:financial_transaction])
@financial_transaction.user = current_user
@financial_transaction.add_transaction!
redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: t('finance.financial_transactions.create.notice')
redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: I18n.t('finance.financial_transactions.controller.create.notice')
rescue ActiveRecord::RecordInvalid => error
flash.now[:alert] = error.message
render :action => :new
@ -44,16 +44,16 @@ class Finance::FinancialTransactionsController < ApplicationController
end
def create_collection
raise "Notiz wird benötigt!" if params[:note].blank?
raise I18n.t('finance.financial_transactions.controller.create_collection.error_note_required') if params[:note].blank?
params[:financial_transactions].each do |trans|
# ignore empty amount fields ...
unless trans[:amount].blank?
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user)
end
end
redirect_to finance_ordergroups_url, notice: t('finance.create_collection.create.notice')
redirect_to finance_ordergroups_url, notice: I18n.t('finance.financial_transactions.controller.create_collection.notice')
rescue => error
redirect_to finance_new_transaction_collection_url, alert: t('finance.create_collection.create.alert', error: error.to_s)
redirect_to finance_new_transaction_collection_url, alert: I18n.t('finance.financial_transactions.controller.create_collection.alert', error: error.to_s)
end
protected

View file

@ -649,11 +649,13 @@ de:
create:
notice: Rechnung wurde erstellt.
financial_transactions:
create:
notice: Die Transaktion wurde gespeichert.
create_collection:
alert: ! 'Ein Fehler ist aufgetreten: %{error}'
notice: Alle Transaktionen wurden gespeichert.
controller:
create:
notice: Die Transaktion wurde gespeichert.
create_collection:
alert: ! 'Ein Fehler ist aufgetreten: %{error}'
error_note_required: ! 'Notiz wird benötigt!'
notice: Alle Transaktionen wurden gespeichert.
index:
balance: ! 'Kontostand: %{balance}'
last_updated_at: (zuletzt aktualisiert vor %{when})

View file

@ -653,11 +653,13 @@ en:
create:
notice: Invoice was created
financial_transactions:
create:
notice: The transaction was saved.
create_collection:
alert: ! 'An error occured: %{error}'
notice: All transactions were saved.
controller:
create:
notice: The transaction was saved.
create_collection:
alert: ! 'An error occured: %{error}'
error_note_required: ! 'Note is required!'
notice: All transactions were saved.
index:
balance: ! 'Balance of account: %{balance}'
last_updated_at: (last updated %{when} ago)