From 3e872c524663ef9658557e547882c18503ebc2eb Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 20 Dec 2023 10:49:09 +0100 Subject: [PATCH 1/2] add email for tiers when repasser en instruction --- app/mailers/notification_mailer.rb | 3 ++- app/models/dossier.rb | 1 + .../send_notification_for_tiers.html.haml | 5 ++++- config/locales/views/layouts/mailers/en.yml | 1 + config/locales/views/layouts/mailers/fr.yml | 1 + spec/mailers/notification_mailer_spec.rb | 12 ++++++++++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index c36b9983f7d..dab4dfaab1e 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -24,8 +24,9 @@ def send_notification end end - def send_notification_for_tiers(dossier) + def send_notification_for_tiers(dossier, repasser_en_instruction: false) @dossier = dossier + @repasser_en_instruction = repasser_en_instruction if @dossier.individual.no_notification? mail.perform_deliveries = false diff --git a/app/models/dossier.rb b/app/models/dossier.rb index f0b236d3dda..5a03ececb8b 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1003,6 +1003,7 @@ def after_repasser_en_instruction(h) MailTemplatePresenterService.create_commentaire_for_state(self, DossierOperationLog.operations.fetch(:repasser_en_instruction)) if !disable_notification 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 log_dossier_operation(instructeur, :repasser_en_instruction) end diff --git a/app/views/notification_mailer/send_notification_for_tiers.html.haml b/app/views/notification_mailer/send_notification_for_tiers.html.haml index 86f07ee335d..3365bb949a6 100644 --- a/app/views/notification_mailer/send_notification_for_tiers.html.haml +++ b/app/views/notification_mailer/send_notification_for_tiers.html.haml @@ -13,7 +13,10 @@ %span{ :style => "font-weight: bold;" } = @dossier.procedure.libelle - = t("layouts.mailers.for_tiers.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date) ) + - 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) ) %p = t("layouts.mailers.for_tiers.second_part") diff --git a/config/locales/views/layouts/mailers/en.yml b/config/locales/views/layouts/mailers/en.yml index ac65b76d522..f683354e7be 100644 --- a/config/locales/views/layouts/mailers/en.yml +++ b/config/locales/views/layouts/mailers/en.yml @@ -20,6 +20,7 @@ en: second_part: To find out more, please contact 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. + repasser_en_instruction: will be re-examined, the previous decision on this file is obsolete. accepte: has been accepted on %{processed_at}. refuse: has been refused on %{processed_at}. sans_suite: has been closed without continuation on %{processed_at}. diff --git a/config/locales/views/layouts/mailers/fr.yml b/config/locales/views/layouts/mailers/fr.yml index 03f5554e9f4..0a23ca4e078 100644 --- a/config/locales/views/layouts/mailers/fr.yml +++ b/config/locales/views/layouts/mailers/fr.yml @@ -21,6 +21,7 @@ fr: second_part: Pour en savoir plus, veuillez vous rapprocher de 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. + 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}. refuse: a été refusé le %{processed_at}. sans_suite: a été classé sans suite le %{processed_at}. diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index 44bb32a4266..ce6313dab51 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -10,6 +10,18 @@ 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("a été déposé le") } + it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de\r\n#{dossier_for_tiers.user.email}.") } + 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#{dossier_for_tiers.user.email}.") } end From c311d6dc46c1ab1b5cc2a24b1b5c4618a92b0276 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 20 Dec 2023 10:49:47 +0100 Subject: [PATCH 2/2] add url for civil code reference --- app/views/users/dossiers/identite.html.haml | 8 +++++++- config/locales/en.yml | 4 +++- config/locales/fr.yml | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/users/dossiers/identite.html.haml b/app/views/users/dossiers/identite.html.haml index d342883258f..5ba71e5974a 100644 --- a/app/views/users/dossiers/identite.html.haml +++ b/app/views/users/dossiers/identite.html.haml @@ -26,7 +26,13 @@ .mandataire-infos{ "data-for-tiers-target" => "mandataireBlock" } .fr-alert.fr-alert--info.fr-mb-2w - %p.fr-notice__text= t('views.users.dossiers.identite.callout_text') + %p.fr-notice__text + = t('views.users.dossiers.identite.callout_text') + = link_to(t('views.users.dossiers.identite.callout_link'), + 'https://www.legifrance.gouv.fr/codes/section_lc/LEGITEXT000006070721/LEGISCTA000006136404/#LEGISCTA000006136404', + title: new_tab_suffix(t('views.users.dossiers.identite.callout_link_title')), + **external_link_attributes) + %fieldset.fr-fieldset %legend.fr-fieldset__legend--regular.fr-fieldset__legend diff --git a/config/locales/en.yml b/config/locales/en.yml index f65e991d7e6..c6fcf82030e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -400,7 +400,9 @@ en: archived_dossier: "Your file will be kept %{duree_conservation_dossiers_dans_ds} more months" identite: self_title: Your identity - callout_text: "You are acting as a proxy for a principal, either professionally (such as accountant, lawyer) or personally (family). Make sure to respect the conditions of Articles 1984 and following of the Civil Code." + callout_text: "You are acting as a proxy for a principal, either professionally (such as accountant, lawyer) or personally (family). Make sure to respect the conditions of" + callout_link: Articles 1984 and following of the Civil Code. + callout_link_title: Articles 1984 and following of the Civil Code beneficiaire_title: "Identity of the beneficiary" identity_siret: Identify your establishment civility: Civility diff --git a/config/locales/fr.yml b/config/locales/fr.yml index d2cdcb2ca9e..4fd8dd0a49d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -404,7 +404,9 @@ fr: archived_dossier: "Votre dossier sera conservé %{duree_conservation_dossiers_dans_ds} mois supplémentaire" identite: self_title: Votre identité - callout_text: Vous agissez en tant que mandataire, soit professionnellement (comme expert-comptable, avocat) soit personnellement (famille). Assurez-vous de respecter les conditions des Articles 1984 et suivants du Code civil. + callout_text: Vous agissez en tant que mandataire, soit professionnellement (comme expert-comptable, avocat) soit personnellement (famille). Assurez-vous de respecter les conditions + callout_link: des Articles 1984 et suivants du Code civil. + callout_link_title: Articles 1984 et suivants du Code civil beneficiaire_title: Identité du bénéficiaire identity_siret: Identifier votre établissement civility: Civilité