2018-11-20 11:57:51 +01:00
|
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
|
2018-05-24 15:55:47 +02:00
|
|
|
|
class DossierMailer < ApplicationMailer
|
2019-07-17 14:12:57 +02:00
|
|
|
|
helper ServiceHelper
|
2019-07-17 16:42:34 +02:00
|
|
|
|
helper MailerHelper
|
2019-07-17 14:12:57 +02:00
|
|
|
|
|
2018-05-24 15:55:47 +02:00
|
|
|
|
layout 'mailers/layout'
|
|
|
|
|
|
2018-11-20 11:50:25 +01:00
|
|
|
|
def notify_new_draft(dossier)
|
|
|
|
|
@dossier = dossier
|
2019-07-17 14:41:37 +02:00
|
|
|
|
@service = dossier.procedure.service
|
|
|
|
|
@logo_url = attach_logo(dossier.procedure)
|
|
|
|
|
|
2019-07-17 13:42:14 +02:00
|
|
|
|
subject = "Retrouvez votre brouillon pour la démarche « #{dossier.procedure.libelle} »"
|
2018-11-20 11:50:25 +01:00
|
|
|
|
|
2019-09-10 13:29:06 +02:00
|
|
|
|
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
2019-07-22 15:49:11 +02:00
|
|
|
|
format.html { render layout: 'mailers/notifications_layout' }
|
2019-07-17 14:41:37 +02:00
|
|
|
|
end
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_new_answer(dossier)
|
|
|
|
|
@dossier = dossier
|
2019-07-17 14:41:37 +02:00
|
|
|
|
@service = dossier.procedure.service
|
|
|
|
|
@logo_url = attach_logo(dossier.procedure)
|
|
|
|
|
|
2019-07-17 13:42:51 +02:00
|
|
|
|
subject = "Nouveau message pour votre dossier nº #{dossier.id} (#{dossier.procedure.libelle})"
|
2018-11-20 11:50:25 +01:00
|
|
|
|
|
2019-09-10 13:29:06 +02:00
|
|
|
|
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
2019-07-22 15:49:11 +02:00
|
|
|
|
format.html { render layout: 'mailers/notifications_layout' }
|
2018-11-20 12:07:39 +01:00
|
|
|
|
end
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
2018-05-30 11:36:48 +02:00
|
|
|
|
def notify_deletion_to_user(deleted_dossier, to_email)
|
|
|
|
|
@deleted_dossier = deleted_dossier
|
2019-07-17 13:42:14 +02:00
|
|
|
|
subject = "Votre dossier nº #{@deleted_dossier.dossier_id} a bien été supprimé"
|
2018-05-31 23:58:10 +02:00
|
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
|
mail(to: to_email, subject: subject)
|
2018-05-30 11:36:48 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_deletion_to_administration(deleted_dossier, to_email)
|
|
|
|
|
@deleted_dossier = deleted_dossier
|
2019-07-17 13:42:14 +02:00
|
|
|
|
subject = "Le dossier nº #{@deleted_dossier.dossier_id} a été supprimé à la demande de l'usager"
|
2018-05-31 23:58:10 +02:00
|
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
|
mail(to: to_email, subject: subject)
|
2018-05-24 15:55:47 +02:00
|
|
|
|
end
|
2018-06-13 17:32:50 +02:00
|
|
|
|
|
2019-03-25 16:04:33 +01:00
|
|
|
|
def notify_revert_to_instruction(dossier)
|
|
|
|
|
@dossier = dossier
|
2019-09-10 11:05:04 +02:00
|
|
|
|
@service = dossier.procedure.service
|
|
|
|
|
@logo_url = attach_logo(dossier.procedure)
|
2019-03-25 16:04:33 +01:00
|
|
|
|
|
2019-09-10 11:05:04 +02:00
|
|
|
|
subject = "Votre dossier nº #{@dossier.id} est en train d'être réexaminé"
|
|
|
|
|
|
|
|
|
|
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
|
|
|
|
format.html { render layout: 'mailers/notifications_layout' }
|
|
|
|
|
end
|
2019-03-25 16:04:33 +01:00
|
|
|
|
end
|
2019-12-03 10:31:10 +01:00
|
|
|
|
|
|
|
|
|
def notify_brouillon_near_deletion(user, dossiers)
|
2019-12-03 15:51:16 +01:00
|
|
|
|
@subject = default_i18n_subject(count: dossiers.count)
|
|
|
|
|
@dossiers = dossiers
|
|
|
|
|
|
|
|
|
|
mail(to: user.email, subject: @subject)
|
2019-12-03 10:31:10 +01:00
|
|
|
|
end
|
2019-12-03 10:46:44 +01:00
|
|
|
|
|
2019-11-28 18:03:23 +01:00
|
|
|
|
def notify_brouillon_deletion(user, dossier_hashes)
|
|
|
|
|
@subject = default_i18n_subject(count: dossier_hashes.count)
|
|
|
|
|
@dossier_hashes = dossier_hashes
|
|
|
|
|
|
|
|
|
|
mail(to: user.email, subject: @subject)
|
2019-12-03 10:46:44 +01:00
|
|
|
|
end
|
2020-02-18 17:15:32 +01:00
|
|
|
|
|
|
|
|
|
def notify_automatic_deletion_to_user(user, dossier_hashes)
|
|
|
|
|
@subject = default_i18n_subject(count: dossier_hashes.count)
|
|
|
|
|
@dossier_hashes = dossier_hashes
|
|
|
|
|
|
|
|
|
|
mail(to: user.email, subject: @subject)
|
|
|
|
|
end
|
2020-02-18 17:18:06 +01:00
|
|
|
|
|
|
|
|
|
def notify_automatic_deletion_to_administration(user, dossier_hashes)
|
|
|
|
|
@subject = default_i18n_subject(count: dossier_hashes.count)
|
|
|
|
|
@dossier_hashes = dossier_hashes
|
|
|
|
|
|
|
|
|
|
mail(to: user.email, subject: @subject)
|
|
|
|
|
end
|
2020-02-18 17:18:14 +01:00
|
|
|
|
|
|
|
|
|
def notify_en_construction_near_deletion(user, dossiers, for_user)
|
|
|
|
|
@subject = default_i18n_subject(count: dossiers.count)
|
|
|
|
|
@dossiers = dossiers
|
|
|
|
|
@for_user = for_user
|
|
|
|
|
|
|
|
|
|
mail(to: user.email, subject: @subject)
|
|
|
|
|
end
|
2020-02-25 18:16:21 +01:00
|
|
|
|
|
|
|
|
|
def notify_groupe_instructeur_changed(instructeur, dossier)
|
|
|
|
|
@subject = "Un dossier a changé de groupe instructeur"
|
|
|
|
|
@dossier_id = dossier.id
|
|
|
|
|
@demarche = dossier.procedure.libelle
|
|
|
|
|
|
|
|
|
|
mail(from: NO_REPLY_EMAIL, to: instructeur.email, subject: @subject)
|
|
|
|
|
end
|
2018-05-24 15:55:47 +02:00
|
|
|
|
end
|