Merge branch 'master' into allow-no-nickname
Conflicts: app/views/foodcoop/users/_users.html.haml
This commit is contained in:
commit
c37ed74942
84 changed files with 1712 additions and 2579 deletions
|
|
@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def deny_access
|
||||
session[:return_to] = request.original_url
|
||||
redirect_to login_url, :alert => 'Access denied!'
|
||||
redirect_to login_url, :alert => I18n.t('application.controller.error_denied')
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -37,7 +37,7 @@ class ApplicationController < ActionController::Base
|
|||
# No user at all: redirect to login page.
|
||||
session[:user_id] = nil
|
||||
session[:return_to] = request.original_url
|
||||
redirect_to login_url, :alert => 'Authentication required!'
|
||||
redirect_to login_url, :alert => I18n.t('application.controller.error_authn')
|
||||
else
|
||||
# We have an authenticated user, now check role...
|
||||
# Roles gets the user through his memberships.
|
||||
|
|
@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base
|
|||
def authenticate_membership_or_admin
|
||||
@group = Group.find(params[:id])
|
||||
unless @group.member?(@current_user) or @current_user.role_admin?
|
||||
redirect_to root_path, alert: "Diese Aktion ist nur für Mitglieder der Gruppe erlaubt!"
|
||||
redirect_to root_path, alert: I18n.t('application.controller.error_members_only')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ class ArticlesController < ApplicationController
|
|||
sort = case params['sort']
|
||||
when "name" then "articles.name"
|
||||
when "unit" then "articles.unit"
|
||||
when "category" then "article_categories.name"
|
||||
when "article_category" then "article_categories.name"
|
||||
when "note" then "articles.note"
|
||||
when "availability" then "articles.availability"
|
||||
when "name_reverse" then "articles.name DESC"
|
||||
when "unit_reverse" then "articles.unit DESC"
|
||||
when "category_reverse" then "article_categories.name DESC"
|
||||
when "article_category_reverse" then "article_categories.name DESC"
|
||||
when "note_reverse" then "articles.note DESC"
|
||||
when "availability_reverse" then "articles.availability DESC"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Finance::BalancingController < Finance::BaseController
|
|||
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
|
||||
@comments = @order.comments
|
||||
|
||||
@articles = @order.order_articles.ordered.includes(:article, :article_price,
|
||||
@articles = @order.order_articles.ordered_or_member.includes(:article, :article_price,
|
||||
group_order_articles: {group_order: :ordergroup})
|
||||
|
||||
sort_param = params['sort'] || 'name'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class LoginController < ApplicationController
|
|||
# Sends an email to a user with the token that allows setting a new password through action "password".
|
||||
def reset_password
|
||||
if request.get? || params[:user].nil? # Catch for get request and give better error message.
|
||||
redirect_to forgot_password_url, alert: 'Ein Problem ist aufgetreten. Bitte erneut versuchen' and return
|
||||
redirect_to forgot_password_url, alert: I18n.t('errors.general_again') and return
|
||||
end
|
||||
|
||||
if (user = User.find_by_email(params[:user][:email]))
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ class OrdersController < ApplicationController
|
|||
order = Order.find(params[:id])
|
||||
order.finish!(@current_user)
|
||||
redirect_to order, notice: I18n.t('orders.finish.notice')
|
||||
rescue => error
|
||||
redirect_to orders_url, alert: I18n.t('errors.general_msg', :msg => error.message)
|
||||
end
|
||||
|
||||
# Renders the fax-text-file
|
||||
|
|
@ -107,9 +109,9 @@ class OrdersController < ApplicationController
|
|||
supplier = order.supplier
|
||||
contact = FoodsoftConfig[:contact].symbolize_keys
|
||||
text = I18n.t('orders.fax.heading', :name => FoodsoftConfig[:name])
|
||||
text += "\n" + I18n.t('orders.fax.customer_number') + ': #{supplier.customer_number}' unless supplier.customer_number.blank?
|
||||
text += "\n#{Supplier.human_attribute_name(:customer_number)}: #{supplier.customer_number}" unless supplier.customer_number.blank?
|
||||
text += "\n" + I18n.t('orders.fax.delivery_day')
|
||||
text += "\n\n#{supplier.name}\n#{supplier.address}\n" + I18n.t('simple_form.labels.supplier.fax') + ": #{supplier.fax}\n\n"
|
||||
text += "\n\n#{supplier.name}\n#{supplier.address}\n#{Supplier.human_attribute_name(:fax)}: #{supplier.fax}\n\n"
|
||||
text += "****** " + I18n.t('orders.fax.to_address') + "\n\n"
|
||||
text += "#{FoodsoftConfig[:name]}\n#{contact[:street]}\n#{contact[:zip_code]} #{contact[:city]}\n\n"
|
||||
text += "****** " + I18n.t('orders.fax.articles') + "\n\n"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ class StockitController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@stock_article = StockArticle.find(params[:id])
|
||||
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC')
|
||||
end
|
||||
|
||||
def destroy
|
||||
@article = StockArticle.find(params[:id])
|
||||
@article.mark_as_deleted
|
||||
|
|
@ -55,9 +60,4 @@ class StockitController < ApplicationController
|
|||
|
||||
render :partial => 'form', :locals => {:stock_article => stock_article}
|
||||
end
|
||||
|
||||
def history
|
||||
@stock_article = StockArticle.undeleted.find(params[:stock_article_id])
|
||||
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue