Commit f0509bc2 authored by gwendal's avatar gwendal
Browse files

Send mail to treasurer as well when create subscription (closed #179, related #180)

parent 91d15434
......@@ -23,6 +23,10 @@ class SubscriptionsController < WebController
@subscription,
current_member.name,
).deliver_now
TreasurerMailer.subscription_payment(
@subscription,
current_member.name,
).deliver_now
BoardMailer.subscription_payment(
@subscription,
current_member.name,
......
......@@ -2,6 +2,20 @@ class TreasurerMailer < ActionMailer::Base
default from: Settings.email_from
layout "email"
def subscription_payment(subscription, crew)
@member = subscription.member
@subscription = subscription
@payment_method = subscription.payment_method
@crew = crew
mail(
to: to,
subject: subject(t(:subject, scope: [:treasureur_mailer, :subscription_payment]) % {number: @member.number})
) do |format|
format.text
format.html
end
end
def service_payment(service, new_record)
@member = service.member
@service = service
......
<% t_scope = [:board_mailer, :subscription_payment]-%>
<%= word_wrap(t(:hi, scope: t_scope)) %>
<%= word_wrap(t(:member_suscribe, scope: t_scope) % {
number: @subscription.member.number,
amount: @subscription.amount,
payment_method: t(@payment_method, scope: :payment_method).downcase,
}) %>
<%= word_wrap(t(:details, scope: t_scope) % {
crew: @crew,
expired_at: l(@subscription.expired_at, format: :long),
}) %>
<%= url_for(
controller: 'members',
action: :show,
only_path: false,
id: @subscription.member.id,
) %>
<%= t(:signature, scope: t_scope) %>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment