wip move automatic invoices to plugin
This commit is contained in:
parent
42a1773a87
commit
78bf494182
33 changed files with 7197 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
module FoodsoftAutomaticInvoices
|
||||
class Engine < ::Rails::Engine
|
||||
def default_foodsoft_config(cfg)
|
||||
cfg[:use_automatic_invoices] = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
module FoodsoftAutomaticInvoices
|
||||
module SendGroupOrderInvoicePdf
|
||||
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
protected
|
||||
|
||||
def create_invoice_pdf(group_order_invoice)
|
||||
invoice_data = group_order_invoice.load_data_for_invoice
|
||||
invoice_data[:title] = t('documents.group_order_invoice_pdf.title', supplier: invoice_data[:supplier])
|
||||
invoice_data[:no_footer] = true
|
||||
GroupOrderInvoicePdf.new invoice_data
|
||||
end
|
||||
|
||||
def send_group_order_invoice_pdf(group_order_invoice)
|
||||
pdf = create_invoice_pdf(group_order_invoice)
|
||||
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:after_initialize) do
|
||||
Concerns::SendOrderPdf.include FoodsoftAutomaticInvoices::SendGroupOrderInvoicePdf
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module FoodsoftAutomaticInvoices
|
||||
VERSION = '0.0.1'
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue