[#1946] Allow admins to edit data retention time

This commit is contained in:
Frederic Merizen 2018-05-24 14:48:52 +02:00
parent 5325830d62
commit 648483ac76
5 changed files with 24 additions and 1 deletions

View file

@ -237,7 +237,7 @@ class Admin::ProceduresController < AdminController
if @procedure&.locked?
params.require(:procedure).permit(*editable_params)
else
params.require(:procedure).permit(*editable_params, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
end
end

View file

@ -10,6 +10,15 @@
%h4 Description*
= f.text_area :description, rows: '6', placeholder: 'Description du projet', class: 'form-control'
- if !@procedure.locked?
.form-group
%h4 Conservation des données
= f.label :duree_conservation_dossiers_dans_ds, "Sur demarches-simplifiees.fr* (durée en mois après le début de linstruction)"
= f.number_field :duree_conservation_dossiers_dans_ds, class: 'form-control', placeholder: '6', required: true
= f.label :duree_conservation_dossiers_hors_ds, "Hors demarches-simplifiees.fr* (durée en mois)"
= f.number_field :duree_conservation_dossiers_hors_ds, class: 'form-control', placeholder: '6', required: true
.form-group
%h4 Lien site internet
= f.text_field :lien_site_web, class: 'form-control', placeholder: 'https://www.exemple.fr/'

View file

@ -16,6 +16,8 @@ describe Admin::ProceduresController, type: :controller do
let(:cadastre) { '0' }
let(:cerfa_flag) { true }
let(:cadre_juridique) { 'cadre juridique' }
let(:duree_conservation_dossiers_dans_ds) { 3 }
let(:duree_conservation_dossiers_hors_ds) { 6 }
let(:procedure_params) {
{
@ -26,6 +28,8 @@ describe Admin::ProceduresController, type: :controller do
lien_demarche: lien_demarche,
cerfa_flag: cerfa_flag,
cadre_juridique: cadre_juridique,
duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds,
duree_conservation_dossiers_hors_ds: duree_conservation_dossiers_hors_ds,
module_api_carto_attributes: {
use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires,
@ -196,6 +200,8 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.direction).to eq(direction) }
it { expect(subject.lien_demarche).to eq(lien_demarche) }
it { expect(subject.administrateur_id).to eq(admin.id) }
it { expect(subject.duree_conservation_dossiers_dans_ds).to eq(duree_conservation_dossiers_dans_ds) }
it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) }
end
describe 'procedure module api carto attributs in database' do
@ -267,6 +273,8 @@ describe Admin::ProceduresController, type: :controller do
let(:lien_demarche) { 'http://plip.com' }
let(:use_api_carto) { '1' }
let(:cadastre) { '1' }
let(:duree_conservation_dossiers_dans_ds) { 7 }
let(:duree_conservation_dossiers_hors_ds) { 5 }
describe 'procedure attributs in database' do
subject { procedure }
@ -276,6 +284,8 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.organisation).to eq(organisation) }
it { expect(subject.direction).to eq(direction) }
it { expect(subject.lien_demarche).to eq(lien_demarche) }
it { expect(subject.duree_conservation_dossiers_dans_ds).to eq(duree_conservation_dossiers_dans_ds) }
it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) }
end
describe 'procedure module api carto attributs in database' do

View file

@ -38,6 +38,8 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
scenario 'Finding save button for new procedure, libelle, description and cadre_juridique required' do
page.find_by_id('new-procedure').click
page.find_by_id('from-scratch').click
fill_in 'procedure_duree_conservation_dossiers_dans_ds', with: '3'
fill_in 'procedure_duree_conservation_dossiers_hors_ds', with: '6'
page.find_by_id('save-procedure').click
page.find_by_id('flash_message').visible?
fill_in_dummy_procedure_details

View file

@ -3,5 +3,7 @@ module ProcedureSpecHelper
fill_in 'procedure_libelle', with: 'libelle de la procedure'
page.execute_script("$('#procedure_description').val('description de la procedure')")
fill_in 'procedure_cadre_juridique', with: 'cadre juridique'
fill_in 'procedure_duree_conservation_dossiers_dans_ds', with: '3'
fill_in 'procedure_duree_conservation_dossiers_hors_ds', with: '6'
end
end