From c2c9b19b3b615985972f4109eed8eb9bd32bfb4c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 10 Jul 2019 18:27:26 +0200 Subject: [PATCH] procedure: remove individual_with_siret It isn't used anymore (see #3077) --- app/controllers/admin/procedures_controller.rb | 2 +- app/dashboards/procedure_dashboard.rb | 2 -- app/models/procedure.rb | 2 ++ app/models/procedure_presentation.rb | 2 +- spec/controllers/admin/procedures_controller_spec.rb | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 749916a48..98cb9b81d 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -269,7 +269,7 @@ class Admin::ProceduresController < AdminController if @procedure&.locked? params.require(:procedure).permit(*editable_params) else - params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday, :path) + params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :ask_birthday, :path) end end end diff --git a/app/dashboards/procedure_dashboard.rb b/app/dashboards/procedure_dashboard.rb index 53291aafb..9a3d41e9e 100644 --- a/app/dashboards/procedure_dashboard.rb +++ b/app/dashboards/procedure_dashboard.rb @@ -24,7 +24,6 @@ class ProcedureDashboard < Administrate::BaseDashboard created_at: Field::DateTime, updated_at: Field::DateTime, for_individual: Field::Boolean, - individual_with_siret: Field::Boolean, auto_archive_on: Field::DateTime, published_at: Field::DateTime, hidden_at: Field::DateTime, @@ -75,7 +74,6 @@ class ProcedureDashboard < Administrate::BaseDashboard :types_de_champ_private, :types_de_piece_justificative, :for_individual, - :individual_with_siret, :auto_archive_on, :gestionnaires, :initiated_mail_template, diff --git a/app/models/procedure.rb b/app/models/procedure.rb index dcddab930..16f1486bd 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -3,6 +3,8 @@ require Rails.root.join('lib', 'percentile') class Procedure < ApplicationRecord MAX_DUREE_CONSERVATION = 36 + self.ignored_columns = [:individual_with_siret] + has_many :types_de_piece_justificative, -> { ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ, -> { root.public_only.ordered }, inverse_of: :procedure, dependent: :destroy has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', inverse_of: :procedure, dependent: :destroy diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 91be561f2..025aa064a 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -30,7 +30,7 @@ class ProcedurePresentation < ApplicationRecord ) end - if !procedure.for_individual || (procedure.for_individual && procedure.individual_with_siret) + if !procedure.for_individual fields.push( field_hash('SIREN', 'etablissement', 'entreprise_siren'), field_hash('Forme juridique', 'etablissement', 'entreprise_forme_juridique'), diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index 1fe9df0fd..1ed713d56 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -323,7 +323,6 @@ describe Admin::ProceduresController, type: :controller do it { expect(subject.direction).to eq procedure_params[:direction] } it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] } - it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] } end end end