Add option to send mails when an order has been received

This commit is contained in:
lentschi 2021-02-27 17:24:25 +01:00 committed by GitHub
parent d45256145d
commit 9a7d4bf07d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 89 additions and 2 deletions

View file

@ -61,6 +61,19 @@ class Mailer < ActionMailer::Base
subject: I18n.t('mailer.order_result.subject', name: group_order.order.name)
end
# Sends order received info for specific Ordergroup
def order_received(user, group_order)
@order = group_order.order
@group_order = group_order
order_articles = @order.order_articles.reject { |oa| oa.units_received.nil? }
@abundant_articles = order_articles.select { |oa| oa.difference_received_ordered.positive? }
@scarce_articles = order_articles.select { |oa| oa.difference_received_ordered.negative? }
mail to: user,
subject: I18n.t('mailer.order_received.subject', name: group_order.order.name)
end
# Sends order result to the supplier
def order_result_supplier(user, order, options = {})
@user = user