Add option to send mails when an order has been received
This commit is contained in:
parent
d45256145d
commit
9a7d4bf07d
9 changed files with 89 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue