Module: Spree::ReimbursementMailerDecorator

Defined in:
app/mailer/spree/reimbursement_mailer_decorator.rb

Instance Method Summary collapse

Instance Method Details

#reimbursement_email(reimbursement, resend = false) ⇒ Object

@gem-override spree_emails-5.3.6/app/mailers/spree/reimbursement_mailer.rb#reimbursement_email 管理画面で設定したカスタム件名を使えるよう再実装する。



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/mailer/spree/reimbursement_mailer_decorator.rb', line 6

def reimbursement_email(reimbursement, resend = false)
  @reimbursement = reimbursement.respond_to?(:id) ? reimbursement : Spree::Reimbursement.find(reimbursement)
  @order = @reimbursement.order
  current_store = @reimbursement.store || Spree::Store.default
  @spree_custom_email = current_store.custom_emails.find_by(mail_type: 'reimbursement_email')
  subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')

  if @spree_custom_email&.subject.present?
    subject += @spree_custom_email.subject
  else
    subject += "#{current_store.name} #{Spree.t('reimbursement_mailer.reimbursement_email.subject')} ##{@order.number}"
  end

  mail(to: @order.email, from: from_address, subject: subject, store_url: current_store.url_or_custom_domain, reply_to: reply_to_address)
end