fix(procedure): allow to modify duree_conservation_dossiers_dans_ds after publication

This commit is contained in:
Paul Chavard 2021-11-11 10:55:09 +01:00
parent a859726686
commit 65e59b8dcd

View file

@ -251,11 +251,11 @@ module NewAdministrateur
end end
def procedure_params def procedure_params
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :euro_flag, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token] editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token, :duree_conservation_dossiers_dans_ds]
permited_params = if @procedure&.locked? permited_params = if @procedure&.locked?
params.require(:procedure).permit(*editable_params) params.require(:procedure).permit(*editable_params)
else else
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :path) params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_hors_ds, :for_individual, :path)
end end
if permited_params[:auto_archive_on].present? if permited_params[:auto_archive_on].present?
permited_params[:auto_archive_on] = Date.parse(permited_params[:auto_archive_on]) + 1.day permited_params[:auto_archive_on] = Date.parse(permited_params[:auto_archive_on]) + 1.day