add authentication to group_order_invoices controller

This commit is contained in:
viehlieb 2022-09-06 23:41:19 +02:00
parent 0539edce82
commit b6854bc416

View file

@ -1,7 +1,9 @@
class GroupOrderInvoicesController < ApplicationController class GroupOrderInvoicesController < ApplicationController
include Concerns::SendGroupOrderInvoicePdf include Concerns::SendGroupOrderInvoicePdf
before_action :authenticate_finance
def show def show
begin
@group_order_invoice = GroupOrderInvoice.find(params[:id]) @group_order_invoice = GroupOrderInvoice.find(params[:id])
if FoodsoftConfig[:contact][:tax_number] if FoodsoftConfig[:contact][:tax_number]
respond_to do |format| respond_to do |format|
@ -12,9 +14,10 @@ class GroupOrderInvoicesController < ApplicationController
else else
raise RecordInvalid raise RecordInvalid
end end
rescue => error rescue ActiveRecord::RecordInvalid => error
redirect_back fallback_location: root_path, notice: 'Something went wrong', alert: I18n.t('errors.general_msg', msg: "#{error} " + I18n.t('errors.check_tax_number')) redirect_back fallback_location: root_path, notice: 'Something went wrong', alert: I18n.t('errors.general_msg', msg: "#{error} " + I18n.t('errors.check_tax_number'))
end end
end
def destroy def destroy
goi = GroupOrderInvoice.find(params[:id]) goi = GroupOrderInvoice.find(params[:id])