merge automatic group order invoice generation
see https://github.com/foodcoops/foodsoft/pull/907 for reference and original work by viehlieb Co-authored-by: viehlieb <pf@pragma-shift.net> fix PDF Pdf make explicit deposit in invoices work add ordergroupname to invoice file name mark bold sum for vat exempt foodcoops download multiple group order invoice as zip
This commit is contained in:
parent
6abf998b56
commit
93143c28f2
37 changed files with 988 additions and 69 deletions
|
|
@ -51,6 +51,18 @@ class Mailer < ActionMailer::Base
|
|||
subject: I18n.t('mailer.welcome.subject')
|
||||
end
|
||||
|
||||
# Sends automatically generated invoicesfor group orders to ordergroup members
|
||||
def group_order_invoice(group_order_invoice, user)
|
||||
@user = user
|
||||
@group_order_invoice = group_order_invoice
|
||||
@group_order = group_order_invoice.group_order
|
||||
@supplier = @group_order.order.supplier.name
|
||||
@group = @group_order.ordergroup
|
||||
add_group_order_invoice_attachments(group_order_invoice)
|
||||
mail to: user,
|
||||
subject: I18n.t('mailer.group_order_invoice.subject', group: @group.name, supplier: @supplier)
|
||||
end
|
||||
|
||||
# Sends order result for specific Ordergroup
|
||||
def order_result(user, group_order)
|
||||
@order = group_order.order
|
||||
|
|
@ -169,6 +181,11 @@ class Mailer < ActionMailer::Base
|
|||
attachments['order.csv'] = OrderCsv.new(order, options).to_csv
|
||||
end
|
||||
|
||||
def add_group_order_invoice_attachments(group_order_invoice)
|
||||
attachment_name = group_order_invoice.name + '.pdf'
|
||||
attachments[attachment_name] = GroupOrderInvoicePdf.new(group_order_invoice.load_data_for_invoice).to_pdf
|
||||
end
|
||||
|
||||
# separate method to allow plugins to mess with the text
|
||||
def additonal_welcome_text(user); end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue