add authentication to group_order_invoices controller
This commit is contained in:
parent
0539edce82
commit
b6854bc416
1 changed files with 12 additions and 9 deletions
|
@ -1,19 +1,22 @@
|
||||||
class GroupOrderInvoicesController < ApplicationController
|
class GroupOrderInvoicesController < ApplicationController
|
||||||
include Concerns::SendGroupOrderInvoicePdf
|
include Concerns::SendGroupOrderInvoicePdf
|
||||||
|
before_action :authenticate_finance
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@group_order_invoice = GroupOrderInvoice.find(params[:id])
|
begin
|
||||||
if FoodsoftConfig[:contact][:tax_number]
|
@group_order_invoice = GroupOrderInvoice.find(params[:id])
|
||||||
respond_to do |format|
|
if FoodsoftConfig[:contact][:tax_number]
|
||||||
format.pdf do
|
respond_to do |format|
|
||||||
send_group_order_invoice_pdf @group_order_invoice if FoodsoftConfig[:contact][:tax_number]
|
format.pdf do
|
||||||
|
send_group_order_invoice_pdf @group_order_invoice if FoodsoftConfig[:contact][:tax_number]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
raise RecordInvalid
|
||||||
end
|
end
|
||||||
else
|
rescue ActiveRecord::RecordInvalid => error
|
||||||
raise RecordInvalid
|
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
|
||||||
rescue => 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'))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
Loading…
Reference in a new issue