fix(dossier): always use user_email_for instead of user.email

This commit is contained in:
Paul Chavard 2024-04-18 10:21:32 +02:00
parent 1a0a603234
commit 6644f8157f
6 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,7 @@ class ResendAttestationMailer < ApplicationMailer
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
def resend_attestation(dossier) def resend_attestation(dossier)
to = dossier.user.email to = dossier.user_email_for(:notification)
subject = "Nouvelle attestation pour votre dossier nº #{dossier.id}" subject = "Nouvelle attestation pour votre dossier nº #{dossier.id}"
mail(to: to, subject: subject, body: body(dossier)) mail(to: to, subject: subject, body: body(dossier))

View file

@ -28,7 +28,7 @@ class DossierTransfer < ApplicationRecord
DossierTransferLog.create(transfer.dossiers.map do |dossier| DossierTransferLog.create(transfer.dossiers.map do |dossier|
{ {
dossier: dossier, dossier: dossier,
from: dossier.user.email, from: dossier.user_email_for(:notification),
from_support: transfer.from_support, from_support: transfer.from_support,
to: transfer.email to: transfer.email
} }

View file

@ -12,7 +12,7 @@
<dt class="attribute-label" id="user">User</dt> <dt class="attribute-label" id="user">User</dt>
<dd class="attribute-data attribute-data--belongs-to"> <dd class="attribute-data attribute-data--belongs-to">
<%= link_to @dossier.user.email, manager_user_path(@dossier.user) %> <%= link_to @dossier.user_email_for(:notification), manager_user_path(@dossier.user) %>
</dd> </dd>
<dt class="attribute-label" id="text_summary">Text summary</dt> <dt class="attribute-label" id="text_summary">Text summary</dt>

View file

@ -22,7 +22,7 @@
%p %p
= t("layouts.mailers.for_tiers.second_part") = t("layouts.mailers.for_tiers.second_part")
= "#{mail_to(@dossier.user.email)}." = "#{mail_to(@dossier.user_email_for(:notification))}."
%p %p
= t(:best_regards, scope: [:views, :shared, :greetings]) = t(:best_regards, scope: [:views, :shared, :greetings])

View file

@ -79,9 +79,9 @@
- c.with_body do - c.with_body do
%p %p
- if dossier.transfer.from_support? - if dossier.transfer.from_support?
= t('views.users.dossiers.transfers.receiver_demande_en_cours_from_support', id: dossier.id, email: dossier.user.email) = t('views.users.dossiers.transfers.receiver_demande_en_cours_from_support', id: dossier.id, email: dossier.user_email_for(:notification))
- else - else
= t('views.users.dossiers.transfers.receiver_demande_en_cours', id: dossier.id, email: dossier.user.email) = t('views.users.dossiers.transfers.receiver_demande_en_cours', id: dossier.id, email: dossier.user_email_for(:notification))
%p %p
= link_to t('views.users.dossiers.transfers.accept'), transfer_path(dossier.transfer), class: "fr-link fr-mr-1w", method: :put = link_to t('views.users.dossiers.transfers.accept'), transfer_path(dossier.transfer), class: "fr-link fr-mr-1w", method: :put
= link_to t('views.users.dossiers.transfers.reject'), transfer_path(dossier.transfer), class: "fr-link", method: :delete = link_to t('views.users.dossiers.transfers.reject'), transfer_path(dossier.transfer), class: "fr-link", method: :delete

View file

@ -52,7 +52,7 @@ prawn_document(margin: [top_margin, right_margin, bottom_margin, left_margin], p
pdf.fill_color grey pdf.fill_color grey
pdf.text "#{Individual.human_attribute_name(:prenom)} : #{@dossier.individual.prenom}", size: 10, character_spacing: -0.2, align: :justify pdf.text "#{Individual.human_attribute_name(:prenom)} : #{@dossier.individual.prenom}", size: 10, character_spacing: -0.2, align: :justify
pdf.text "#{Individual.human_attribute_name(:nom)} : #{@dossier.individual.nom.upcase}", size: 10, character_spacing: -0.2, align: :justify pdf.text "#{Individual.human_attribute_name(:nom)} : #{@dossier.individual.nom.upcase}", size: 10, character_spacing: -0.2, align: :justify
pdf.text "#{User.human_attribute_name(:email)} : #{@dossier.user.email}", size: 10, character_spacing: -0.2, align: :justify pdf.text "#{User.human_attribute_name(:email)} : #{@dossier.user_email_for(:display)}", size: 10, character_spacing: -0.2, align: :justify
end end
end end
@ -61,7 +61,7 @@ prawn_document(margin: [top_margin, right_margin, bottom_margin, left_margin], p
pdf.fill_color grey pdf.fill_color grey
pdf.text "Dénomination : " + raison_sociale_or_name(@dossier.etablissement), size: 10, character_spacing: -0.2, align: :justify pdf.text "Dénomination : " + raison_sociale_or_name(@dossier.etablissement), size: 10, character_spacing: -0.2, align: :justify
pdf.text "SIRET : " + @dossier.etablissement.siret, size: 10, character_spacing: -0.2, align: :justify pdf.text "SIRET : " + @dossier.etablissement.siret, size: 10, character_spacing: -0.2, align: :justify
pdf.text "#{User.human_attribute_name(:email)} : #{@dossier.user.email}", size: 10, character_spacing: -0.2, align: :justify pdf.text "#{User.human_attribute_name(:email)} : #{@dossier.user_email_for(:display)}", size: 10, character_spacing: -0.2, align: :justify
end end
end end