diff --git a/app/models/dossier.rb b/app/models/dossier.rb index c554b6be023..9bf8dbbe651 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -619,6 +619,12 @@ def close_to_expiration? expiration_notification_date < Time.zone.now && Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago < expiration_notification_date end + def duree_totale_conservation_in_months + duree_conservation_dossier = brouillon? ? [procedure.duree_conservation_dossiers_dans_ds, Expired::MONTHS_BEFORE_BROUILLON_EXPIRATION].min : procedure.duree_conservation_dossiers_dans_ds + + duree_conservation_dossier + (conservation_extension / 1.month.to_i) + end + def has_expired? return false if en_instruction? expiration_notification_date < Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago @@ -714,10 +720,6 @@ def text_summary parts.join end - def duree_totale_conservation_in_months - procedure.duree_conservation_dossiers_dans_ds + (conservation_extension / 1.month.to_i) - end - def avis_for_expert(expert) Avis .where(dossier_id: id, confidentiel: false) diff --git a/config/locales/shared.fr.yml b/config/locales/shared.fr.yml index 9683097306f..c576622e9c2 100644 --- a/config/locales/shared.fr.yml +++ b/config/locales/shared.fr.yml @@ -10,7 +10,7 @@ fr: refused_by_svr: "Le service traitant n’a pas été en mesure de traiter votre demande dans le délai imparti par la règle du Silence Vaut Rejet." header: expires_at: - brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la création du dossier)" + brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la dernière modification du dossier)" en_construction: "Expirera le %{date} (%{duree_conservation_totale} mois après le dépôt du dossier)" en_instruction: "Ce dossier est en instruction, il n’expirera pas" accepte: "Expirera le %{date} (%{duree_conservation_totale} mois après le traitement du dossier)" diff --git a/spec/system/users/brouillon_spec.rb b/spec/system/users/brouillon_spec.rb index dc140e6be3d..e12a80b7df7 100644 --- a/spec/system/users/brouillon_spec.rb +++ b/spec/system/users/brouillon_spec.rb @@ -181,7 +181,7 @@ { mandatory: false, libelle: "nombre décimal", type: :decimal_number }, { mandatory: false, libelle: 'address', type: :address }, { mandatory: false, libelle: 'IBAN', type: :iban } - ]) + ], duree_conservation_dossiers_dans_ds: 6) } scenario 'save an incomplete dossier as draft but cannot not submit it' do