add email for tiers when repasser en instruction
This commit is contained in:
parent
3d2b238c17
commit
3e872c5246
6 changed files with 21 additions and 2 deletions
|
@ -24,8 +24,9 @@ class NotificationMailer < ApplicationMailer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notification_for_tiers(dossier)
|
def send_notification_for_tiers(dossier, repasser_en_instruction: false)
|
||||||
@dossier = dossier
|
@dossier = dossier
|
||||||
|
@repasser_en_instruction = repasser_en_instruction
|
||||||
|
|
||||||
if @dossier.individual.no_notification?
|
if @dossier.individual.no_notification?
|
||||||
mail.perform_deliveries = false
|
mail.perform_deliveries = false
|
||||||
|
|
|
@ -1003,6 +1003,7 @@ class Dossier < ApplicationRecord
|
||||||
MailTemplatePresenterService.create_commentaire_for_state(self, DossierOperationLog.operations.fetch(:repasser_en_instruction))
|
MailTemplatePresenterService.create_commentaire_for_state(self, DossierOperationLog.operations.fetch(:repasser_en_instruction))
|
||||||
if !disable_notification
|
if !disable_notification
|
||||||
NotificationMailer.send_repasser_en_instruction_notification(self).deliver_later
|
NotificationMailer.send_repasser_en_instruction_notification(self).deliver_later
|
||||||
|
NotificationMailer.send_notification_for_tiers(self, repasser_en_instruction: true).deliver_later if self.for_tiers?
|
||||||
end
|
end
|
||||||
log_dossier_operation(instructeur, :repasser_en_instruction)
|
log_dossier_operation(instructeur, :repasser_en_instruction)
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
%span{ :style => "font-weight: bold;" }
|
%span{ :style => "font-weight: bold;" }
|
||||||
= @dossier.procedure.libelle
|
= @dossier.procedure.libelle
|
||||||
|
|
||||||
|
- if @repasser_en_instruction
|
||||||
|
= t("layouts.mailers.for_tiers.repasser_en_instruction")
|
||||||
|
- else
|
||||||
= t("layouts.mailers.for_tiers.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date) )
|
= t("layouts.mailers.for_tiers.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date) )
|
||||||
|
|
||||||
%p
|
%p
|
||||||
|
|
|
@ -20,6 +20,7 @@ en:
|
||||||
second_part: To find out more, please contact
|
second_part: To find out more, please contact
|
||||||
en_construction: has been submited %{processed_at}.
|
en_construction: has been submited %{processed_at}.
|
||||||
en_instruction: has been received and taken care of on %{processed_at}. The administration is reviewing your file.
|
en_instruction: has been received and taken care of on %{processed_at}. The administration is reviewing your file.
|
||||||
|
repasser_en_instruction: will be re-examined, the previous decision on this file is obsolete.
|
||||||
accepte: has been accepted on %{processed_at}.
|
accepte: has been accepted on %{processed_at}.
|
||||||
refuse: has been refused on %{processed_at}.
|
refuse: has been refused on %{processed_at}.
|
||||||
sans_suite: has been closed without continuation on %{processed_at}.
|
sans_suite: has been closed without continuation on %{processed_at}.
|
||||||
|
|
|
@ -21,6 +21,7 @@ fr:
|
||||||
second_part: Pour en savoir plus, veuillez vous rapprocher de
|
second_part: Pour en savoir plus, veuillez vous rapprocher de
|
||||||
en_construction: a été déposé le %{processed_at}.
|
en_construction: a été déposé le %{processed_at}.
|
||||||
en_instruction: a bien été reçu et pris en charge le %{processed_at}. Il va maintenant être examiné par le service.
|
en_instruction: a bien été reçu et pris en charge le %{processed_at}. Il va maintenant être examiné par le service.
|
||||||
|
repasser_en_instruction: va être réexaminé, la précédente décision sur ce dossier est caduque.
|
||||||
accepte: a été accepté le %{processed_at}.
|
accepte: a été accepté le %{processed_at}.
|
||||||
refuse: a été refusé le %{processed_at}.
|
refuse: a été refusé le %{processed_at}.
|
||||||
sans_suite: a été classé sans suite le %{processed_at}.
|
sans_suite: a été classé sans suite le %{processed_at}.
|
||||||
|
|
|
@ -10,6 +10,18 @@ RSpec.describe NotificationMailer, type: :mailer do
|
||||||
|
|
||||||
it { expect(subject.subject).to include("Votre dossier rempli par le mandataire #{dossier_for_tiers.mandataire_first_name} #{dossier_for_tiers.mandataire_last_name} a été mis à jour") }
|
it { expect(subject.subject).to include("Votre dossier rempli par le mandataire #{dossier_for_tiers.mandataire_first_name} #{dossier_for_tiers.mandataire_last_name} a été mis à jour") }
|
||||||
it { expect(subject.to).to eq([dossier_for_tiers.individual.email]) }
|
it { expect(subject.to).to eq([dossier_for_tiers.individual.email]) }
|
||||||
|
it { expect(subject.body).to include("a été déposé le") }
|
||||||
|
it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de\r\n<a href=\"mailto:#{dossier_for_tiers.user.email}\">#{dossier_for_tiers.user.email}</a>.") }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'send_notification_for_tiers for repasser_en_instruction' do
|
||||||
|
let(:dossier_for_tiers) { create(:dossier, :accepte, :for_tiers_with_notification, procedure: create(:simple_procedure)) }
|
||||||
|
|
||||||
|
subject { described_class.send_notification_for_tiers(dossier_for_tiers, repasser_en_instruction: true) }
|
||||||
|
|
||||||
|
it { expect(subject.subject).to include("Votre dossier rempli par le mandataire #{dossier_for_tiers.mandataire_first_name} #{dossier_for_tiers.mandataire_last_name} a été mis à jour") }
|
||||||
|
it { expect(subject.to).to eq([dossier_for_tiers.individual.email]) }
|
||||||
|
it { expect(subject.body).to include("va être réexaminé, la précédente décision sur ce dossier est caduque.") }
|
||||||
it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de\r\n<a href=\"mailto:#{dossier_for_tiers.user.email}\">#{dossier_for_tiers.user.email}</a>.") }
|
it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de\r\n<a href=\"mailto:#{dossier_for_tiers.user.email}\">#{dossier_for_tiers.user.email}</a>.") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue