fix(sva): add sva/svr decision date tag for relevant template emails

Closes #10033
This commit is contained in:
Colin Darie 2024-09-17 18:04:41 +02:00
parent 861f7359b1
commit 2b07826202
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 38 additions and 2 deletions

View file

@ -50,6 +50,6 @@ module MailTemplateConcern
end
def dossier_tags
TagsSubstitutionConcern::DOSSIER_TAGS + TagsSubstitutionConcern::DOSSIER_TAGS_FOR_MAIL
super + TagsSubstitutionConcern::DOSSIER_TAGS_FOR_MAIL
end
end

View file

@ -158,6 +158,14 @@ module TagsSubstitutionConcern
}
]
DOSSIER_SVA_SVR_DECISION_DATE_TAG = {
id: 'dossier_sva_svr_decision_on',
libelle: 'date prévisionnelle SVA/SVR',
description: 'Date prévisionnelle de décision automatique par le SVA/SVR',
lambda: -> (d) { format_date(d.sva_svr_decision_on) },
available_for_states: Dossier.states.fetch(:en_instruction)
}
INDIVIDUAL_TAGS = [
{
id: 'individual_gender',
@ -335,7 +343,13 @@ module TagsSubstitutionConcern
def dossier_tags
# Overridden by MailTemplateConcern
DOSSIER_TAGS
DOSSIER_TAGS + contextual_dossier_tags
end
def contextual_dossier_tags
tags = []
tags << DOSSIER_SVA_SVR_DECISION_DATE_TAG if respond_to?(:procedure) && procedure.sva_svr_enabled?
tags
end
def tags_for_dossier_state(tags)