2020-08-06 16:35:45 +02:00
|
|
|
|
# == Schema Information
|
|
|
|
|
#
|
|
|
|
|
# Table name: closed_mails
|
|
|
|
|
#
|
|
|
|
|
# id :integer not null, primary key
|
|
|
|
|
# body :text
|
|
|
|
|
# subject :string
|
|
|
|
|
# created_at :datetime not null
|
|
|
|
|
# updated_at :datetime not null
|
|
|
|
|
# procedure_id :integer
|
|
|
|
|
#
|
2017-03-06 22:37:37 +01:00
|
|
|
|
module Mails
|
2017-05-27 00:44:01 +02:00
|
|
|
|
class ClosedMail < ApplicationRecord
|
2017-03-06 22:37:37 +01:00
|
|
|
|
include MailTemplateConcern
|
|
|
|
|
|
2020-07-20 17:25:17 +02:00
|
|
|
|
belongs_to :procedure, optional: false
|
2017-12-22 21:37:08 +01:00
|
|
|
|
|
2017-05-27 00:52:32 +02:00
|
|
|
|
SLUG = "closed_mail"
|
2021-05-26 15:16:30 +02:00
|
|
|
|
DISPLAYED_NAME = "Accusé d’acceptation"
|
2019-07-17 13:42:51 +02:00
|
|
|
|
DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- a été accepté (--libellé démarche--)'
|
2018-08-28 14:10:55 +02:00
|
|
|
|
DOSSIER_STATE = Dossier.states.fetch(:accepte)
|
2018-03-16 19:39:48 +01:00
|
|
|
|
|
|
|
|
|
def self.default_template_name_for_procedure(procedure)
|
|
|
|
|
attestation_template = procedure.attestation_template
|
2018-05-30 18:45:46 +02:00
|
|
|
|
if attestation_template&.activated?
|
2019-07-18 18:25:11 +02:00
|
|
|
|
"notification_mailer/default_templates/closed_mail_with_attestation"
|
2018-03-16 19:39:48 +01:00
|
|
|
|
else
|
2019-07-18 18:25:11 +02:00
|
|
|
|
"notification_mailer/default_templates/closed_mail"
|
2018-03-16 19:39:48 +01:00
|
|
|
|
end
|
|
|
|
|
end
|
2017-03-06 22:37:37 +01:00
|
|
|
|
end
|
|
|
|
|
end
|