if FoodsoftAutomaticInvoices.enabled? Mailer.class_eval do # 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 end end