From a86e3a31565f54120f4915b31c9d5201d1b73d91 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 23 Aug 2018 10:11:41 +0200 Subject: [PATCH 01/17] =?UTF-8?q?Don=E2=80=99t=20change=20a=20button?= =?UTF-8?q?=E2=80=99s=20text=20when=20disabled=20after=20click?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/procedures/show.html.haml | 2 +- app/views/admin/profile/show.html.haml | 2 +- app/views/admin/types_de_champ/_fields.html.haml | 2 +- app/views/admin/types_de_champ/_form.html.haml | 2 +- app/views/demandes/new.html.haml | 2 +- app/views/dossiers/commentaires/_form.html.haml | 2 +- app/views/dossiers/etapes/etape_2/_entreprise.html.haml | 2 +- app/views/layouts/_etape_suivante.html.haml | 2 +- app/views/layouts/_modifications_terminees.html.haml | 2 +- .../dossiers/annotations_privees.html.haml | 2 +- .../new_gestionnaire/shared/messages/_form.html.haml | 2 +- app/views/shared/dossiers/_edit.html.haml | 8 ++++---- app/views/users/recapitulatif/_modal_upload_pj.html.haml | 2 +- app/views/users/siret/_pro.html.haml | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 306e39de8..471bd5efa 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -155,4 +155,4 @@ hide_admin_procedure_path(procedure), method: :post, class: "btn btn-danger", - data: { confirm: "Voulez-vous supprimer la procédure ?", disable_with: "Suppression..." } + data: { confirm: "Voulez-vous supprimer la procédure ?", disable: true } diff --git a/app/views/admin/profile/show.html.haml b/app/views/admin/profile/show.html.haml index 78efa24f2..6db4323b4 100644 --- a/app/views/admin/profile/show.html.haml +++ b/app/views/admin/profile/show.html.haml @@ -5,4 +5,4 @@ API TOKEN : = @administrateur.api_token %p - = link_to "Regénérer mon token", admin_renew_api_token_path, method: :post, class: "btn btn-default", data: { confirm: "Confirmez-vous la regénération de votre token ? Les applications qui l'utilisent actuellement seront bloquées.", disable_with: "Regénération..." } + = link_to "Regénérer mon token", admin_renew_api_token_path, method: :post, class: "btn btn-default", data: { confirm: "Confirmez-vous la regénération de votre token ? Les applications qui l'utilisent actuellement seront bloquées.", disable: true } diff --git a/app/views/admin/types_de_champ/_fields.html.haml b/app/views/admin/types_de_champ/_fields.html.haml index 4472a2c8d..ce4b38913 100644 --- a/app/views/admin/types_de_champ/_fields.html.haml +++ b/app/views/admin/types_de_champ/_fields.html.haml @@ -65,7 +65,7 @@ = f.button 'Ajouter le champ', id: @types_de_champ_facade.add_button_id, class: 'btn btn-success', - data: { disable_with: 'Envoi...' } + data: { disable: true } - else = link_to("", @types_de_champ_facade.delete_url(ff), method: :delete, remote: true, id: "delete_type_de_champ_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) ) diff --git a/app/views/admin/types_de_champ/_form.html.haml b/app/views/admin/types_de_champ/_form.html.haml index a8e1b22c7..36c2b6c8d 100644 --- a/app/views/admin/types_de_champ/_form.html.haml +++ b/app/views/admin/types_de_champ/_form.html.haml @@ -4,7 +4,7 @@ = f.button 'Enregistrer', id: :save, class: 'btn btn-success', - data: { disable_with: 'Envoi...' } + data: { disable: true } %hr #new_type_de_champ diff --git a/app/views/demandes/new.html.haml b/app/views/demandes/new.html.haml index 1cf5ae528..ca4a68199 100644 --- a/app/views/demandes/new.html.haml +++ b/app/views/demandes/new.html.haml @@ -40,4 +40,4 @@ %span.mandatory * = text_field_tag :address, nil, required: true - = submit_tag 'Envoyer', class: 'button', data: { disable_with: "Envoi..." } + = submit_tag 'Envoyer', class: 'button', data: { disable: true } diff --git a/app/views/dossiers/commentaires/_form.html.haml b/app/views/dossiers/commentaires/_form.html.haml index f4011836a..a142bdf23 100644 --- a/app/views/dossiers/commentaires/_form.html.haml +++ b/app/views/dossiers/commentaires/_form.html.haml @@ -7,4 +7,4 @@ %h4.text-primary{ style: 'margin-top: 0px;' } Ajouter un fichier = file_field_tag "file", accept: Commentaire.new.file.accept_extension_list, style: 'float: left; margin-left: 20px;' .col-md-6.text-right - = submit_tag 'Envoyer', id: 'save-message', class: 'form-control btn btn-danger', data: { disable_with: 'Envoi...' } + = submit_tag 'Envoyer', id: 'save-message', class: 'form-control btn btn-danger', data: { disable: true } diff --git a/app/views/dossiers/etapes/etape_2/_entreprise.html.haml b/app/views/dossiers/etapes/etape_2/_entreprise.html.haml index 7298345b1..033584354 100644 --- a/app/views/dossiers/etapes/etape_2/_entreprise.html.haml +++ b/app/views/dossiers/etapes/etape_2/_entreprise.html.haml @@ -20,7 +20,7 @@ .form-group.form-group-lg = f.text_field :siret, id: "dossier-siret", class: "form-control", placeholder: "Entrez votre Siret", value: @siret = f.hidden_field :dossier_id, value: @facade.dossier.id - = f.submit 'Valider', class: %w(btn btn-lg btn-success), id: 'submit-siret', data: { disable_with: "Recherche en cours ..." } + = f.submit 'Valider', class: %w(btn btn-lg btn-success), id: 'submit-siret', data: { disable: true } - else %br #recap-info-entreprise diff --git a/app/views/layouts/_etape_suivante.html.haml b/app/views/layouts/_etape_suivante.html.haml index 23b68d504..0a584ed5e 100644 --- a/app/views/layouts/_etape_suivante.html.haml +++ b/app/views/layouts/_etape_suivante.html.haml @@ -1 +1 @@ -= submit_tag 'Etape suivante', class: %w(btn btn btn-info), style: 'float: right;', id: 'etape_suivante', data: { disable_with: 'Etape suivante', submit: true } += submit_tag 'Etape suivante', class: %w(btn btn btn-info), style: 'float: right;', id: 'etape_suivante', data: { disable: true, submit: true } diff --git a/app/views/layouts/_modifications_terminees.html.haml b/app/views/layouts/_modifications_terminees.html.haml index d653f1044..085d66947 100644 --- a/app/views/layouts/_modifications_terminees.html.haml +++ b/app/views/layouts/_modifications_terminees.html.haml @@ -1,3 +1,3 @@ %div{ style: 'float: right;' } %a.btn{ href: "/users/dossiers/#{@dossier.id}/recapitulatif" } Retour - = submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable_with: 'Modification terminée', submit: true } + = submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable: true, submit: true } diff --git a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml index ede49a733..58b2d42e8 100644 --- a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml +++ b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml @@ -12,7 +12,7 @@ locals: { champ: champ, form: champ_form, seen_at: @annotations_privees_seen_at } .send-wrapper - = f.submit 'Sauvegarder', class: 'button send', data: { disable_with: "Envoi..." } + = f.submit 'Sauvegarder', class: 'button send', data: { disable: true } - else %h2.empty-text Aucune annotation privée diff --git a/app/views/new_gestionnaire/shared/messages/_form.html.haml b/app/views/new_gestionnaire/shared/messages/_form.html.haml index 09821e729..aff5b4500 100644 --- a/app/views/new_gestionnaire/shared/messages/_form.html.haml +++ b/app/views/new_gestionnaire/shared/messages/_form.html.haml @@ -8,4 +8,4 @@ (taille max : 20 Mo) .send-wrapper - = f.submit 'Envoyer', class: 'button send', data: { disable_with: "Envoi…" } + = f.submit 'Envoyer', class: 'button send', data: { disable: true } diff --git a/app/views/shared/dossiers/_edit.html.haml b/app/views/shared/dossiers/_edit.html.haml index beae0cdbd..ba27df72a 100644 --- a/app/views/shared/dossiers/_edit.html.haml +++ b/app/views/shared/dossiers/_edit.html.haml @@ -64,7 +64,7 @@ = link_to ask_deletion_dossier_path(dossier), method: :post, class: 'button danger', - data: { disable_with: 'Supprimer le brouillon', confirm: 'En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?' } do + data: { disable: true, confirm: 'En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?' } do Supprimer le brouillon = f.button 'Enregistrer le brouillon', @@ -72,18 +72,18 @@ name: :save_draft, value: true, class: 'button send secondary', - data: { disable_with: 'Enregistrer le brouillon' } + data: { disable: true } - if dossier.can_transition_to_en_construction? = f.button 'Soumettre le dossier', class: 'button send primary', disabled: !current_user.owns?(dossier), - data: { disable_with: 'Soumettre le dossier' } + data: { disable: true } - else = f.button 'Enregistrer les modifications du dossier', class: 'button send primary', - data: { disable_with: 'Enregistrer les modifications du dossier' } + data: { disable: true } - if dossier.brouillon? && !current_user.owns?(dossier) .send-notice.invite-cannot-submit diff --git a/app/views/users/recapitulatif/_modal_upload_pj.html.haml b/app/views/users/recapitulatif/_modal_upload_pj.html.haml index 58adcae3f..8afae1798 100644 --- a/app/views/users/recapitulatif/_modal_upload_pj.html.haml +++ b/app/views/users/recapitulatif/_modal_upload_pj.html.haml @@ -14,4 +14,4 @@ = render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier } .modal-footer - = submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable_with: 'Modification terminée', submit: true } + = submit_tag 'Modification terminée', class: %w(btn btn btn-info), id: 'modification_terminee', data: { disable: true, submit: true } diff --git a/app/views/users/siret/_pro.html.haml b/app/views/users/siret/_pro.html.haml index 5ddb0de3d..d9ac910fc 100644 --- a/app/views/users/siret/_pro.html.haml +++ b/app/views/users/siret/_pro.html.haml @@ -13,5 +13,5 @@ .form-group.form-group-lg = text_field_tag :siret, nil, :class => "form-control", :placeholder => "Entrez votre Siret", :id => "siret", :name => "siret", :maxlength => 14, :style => 'margin-bottom: 10px', value: @siret %br - = submit_tag "Commencer", class: %w(btn btn-lg btn-success), style: 'margin-top: 20px;', data: { disable_with: "Commencer", submit: true } + = submit_tag "Commencer", class: %w(btn btn-lg btn-success), style: 'margin-top: 20px;', data: { disable: true, submit: true } %input{ type: 'hidden', value: "#{@procedure.id}", name: 'procedure_id', id: 'procedure_id' } From 1af4b2aa6e3bd478e18b3cba2cd45767ea3f462a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 23 Aug 2018 11:21:51 +0200 Subject: [PATCH 02/17] Fix transfer modal not opening --- app/views/admin/procedures/_modal_transfer.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/procedures/_modal_transfer.html.haml b/app/views/admin/procedures/_modal_transfer.html.haml index 12e2fe6cc..02aeb2c36 100644 --- a/app/views/admin/procedures/_modal_transfer.html.haml +++ b/app/views/admin/procedures/_modal_transfer.html.haml @@ -1,4 +1,4 @@ -#transferModal.modal.fade{ "aria-labelledby" => "TransferProcedureModal", :role => "dialog", :tabindex => "-1" } +#transfer-modal.modal.fade{ "aria-labelledby" => "TransferProcedureModal", :role => "dialog", :tabindex => "-1" } .modal-dialog.modal-md{ :role => "document" } = form_tag admin_procedure_transfer_path(procedure_id: @procedure.id), method: :post, remote: true do .modal-content From 650a7406425e25cd8687e8387286c5238a2f0b1a Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 11:47:13 +0200 Subject: [PATCH 03/17] [#2179] Remove dead code --- app/controllers/new_gestionnaire/recherche_controller.rb | 3 +-- app/models/search.rb | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/controllers/new_gestionnaire/recherche_controller.rb b/app/controllers/new_gestionnaire/recherche_controller.rb index 58658a08b..74d00107e 100644 --- a/app/controllers/new_gestionnaire/recherche_controller.rb +++ b/app/controllers/new_gestionnaire/recherche_controller.rb @@ -17,8 +17,7 @@ module NewGestionnaire if @dossiers.empty? @dossiers = Search.new( gestionnaire: current_gestionnaire, - query: @search_terms, - page: params[:page] + query: @search_terms ).results end end diff --git a/app/models/search.rb b/app/models/search.rb index 3ab9adbd0..8f84ce027 100644 --- a/app/models/search.rb +++ b/app/models/search.rb @@ -33,7 +33,6 @@ class Search < ApplicationRecord attr_accessor :gestionnaire attr_accessor :query - attr_accessor :page belongs_to :dossier @@ -58,10 +57,6 @@ class Search < ApplicationRecord .order("rank DESC") .preload(:dossier) - if @page.present? - q = q.paginate(page: @page) - end - Results.new(q) end From 57fd59b8d5146d070c380838b55aa34f832bbfef Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 12:03:01 +0200 Subject: [PATCH 04/17] [#2179] Move code to DossierSearchService --- .../new_gestionnaire/recherche_controller.rb | 36 +---------------- app/services/dossier_search_service.rb | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 35 deletions(-) create mode 100644 app/services/dossier_search_service.rb diff --git a/app/controllers/new_gestionnaire/recherche_controller.rb b/app/controllers/new_gestionnaire/recherche_controller.rb index 74d00107e..ec58b9083 100644 --- a/app/controllers/new_gestionnaire/recherche_controller.rb +++ b/app/controllers/new_gestionnaire/recherche_controller.rb @@ -2,41 +2,7 @@ module NewGestionnaire class RechercheController < GestionnaireController def index @search_terms = params[:q] - - # exact id match? - id = @search_terms.to_i - if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. - @dossiers = dossiers_by_id(id) - end - - if @dossiers.nil? - @dossiers = Dossier.none - end - - # full text search - if @dossiers.empty? - @dossiers = Search.new( - gestionnaire: current_gestionnaire, - query: @search_terms - ).results - end - end - - private - - def dossiers_by_id(id) - dossiers = current_gestionnaire.dossiers.where(id: id) + - current_gestionnaire.dossiers_from_avis.where(id: id) - dossiers.uniq - end - - def id_compatible?(number) - begin - ActiveRecord::Type::Integer.new.serialize(number) - true - rescue ActiveModel::RangeError - false - end + @dossiers = DossierSearchService.matching_dossiers_for_gestionnaire(@search_terms) end end end diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb new file mode 100644 index 000000000..1cf851b29 --- /dev/null +++ b/app/services/dossier_search_service.rb @@ -0,0 +1,40 @@ +class DossierSearchService + def self.matching_dossiers_for_gestionnaire(search_terms) + # exact id match? + id = search_terms.to_i + if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. + dossiers = dossiers_by_id(id) + end + + if dossiers.nil? + dossiers = Dossier.none + end + + # full text search + if dossiers.empty? + dossiers = Search.new( + gestionnaire: current_gestionnaire, + query: search_terms + ).results + end + + dossiers + end + + private + + def self.dossiers_by_id(id) + dossiers = current_gestionnaire.dossiers.where(id: id) + + current_gestionnaire.dossiers_from_avis.where(id: id) + dossiers.uniq + end + + def self.id_compatible?(number) + begin + ActiveRecord::Type::Integer.new.serialize(number) + true + rescue ActiveModel::RangeError + false + end + end +end From a72388bb3762de7c68783e0b3d702258ff15b0d2 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 12:04:49 +0200 Subject: [PATCH 05/17] [#2179] Don't depend on current_gestionnaire in DossierSearchService --- .../new_gestionnaire/recherche_controller.rb | 2 +- app/services/dossier_search_service.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/new_gestionnaire/recherche_controller.rb b/app/controllers/new_gestionnaire/recherche_controller.rb index ec58b9083..c50d321ad 100644 --- a/app/controllers/new_gestionnaire/recherche_controller.rb +++ b/app/controllers/new_gestionnaire/recherche_controller.rb @@ -2,7 +2,7 @@ module NewGestionnaire class RechercheController < GestionnaireController def index @search_terms = params[:q] - @dossiers = DossierSearchService.matching_dossiers_for_gestionnaire(@search_terms) + @dossiers = DossierSearchService.matching_dossiers_for_gestionnaire(@search_terms, current_gestionnaire) end end end diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 1cf851b29..c00c2964f 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -1,9 +1,9 @@ class DossierSearchService - def self.matching_dossiers_for_gestionnaire(search_terms) + def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire) # exact id match? id = search_terms.to_i if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. - dossiers = dossiers_by_id(id) + dossiers = dossiers_by_id(id, gestionnaire) end if dossiers.nil? @@ -13,7 +13,7 @@ class DossierSearchService # full text search if dossiers.empty? dossiers = Search.new( - gestionnaire: current_gestionnaire, + gestionnaire: gestionnaire, query: search_terms ).results end @@ -23,9 +23,9 @@ class DossierSearchService private - def self.dossiers_by_id(id) - dossiers = current_gestionnaire.dossiers.where(id: id) + - current_gestionnaire.dossiers_from_avis.where(id: id) + def self.dossiers_by_id(id, gestionnaire) + dossiers = gestionnaire.dossiers.where(id: id) + + gestionnaire.dossiers_from_avis.where(id: id) dossiers.uniq end From d734f978a32a0b2cf7a68513d710a80edee82ec0 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:29:37 +0200 Subject: [PATCH 06/17] [#2179] Extract dossiers_by_exact_id_for_gestionnaire method --- app/services/dossier_search_service.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index c00c2964f..e95af3b8d 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -1,14 +1,7 @@ class DossierSearchService def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire) # exact id match? - id = search_terms.to_i - if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. - dossiers = dossiers_by_id(id, gestionnaire) - end - - if dossiers.nil? - dossiers = Dossier.none - end + dossiers = dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) # full text search if dossiers.empty? @@ -23,6 +16,17 @@ class DossierSearchService private + def self.dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) + id = search_terms.to_i + if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. + dossiers = dossiers_by_id(id, gestionnaire) + end + + if dossiers.nil? + dossiers = Dossier.none + end + end + def self.dossiers_by_id(id, gestionnaire) dossiers = gestionnaire.dossiers.where(id: id) + gestionnaire.dossiers_from_avis.where(id: id) From b3cb06b7e590d31adba6938a91d9b27ccb038f02 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:32:17 +0200 Subject: [PATCH 07/17] [#2179] Extract dossier_by_full_text_for_gestionnaire method --- app/services/dossier_search_service.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index e95af3b8d..899ab383b 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -5,10 +5,7 @@ class DossierSearchService # full text search if dossiers.empty? - dossiers = Search.new( - gestionnaire: gestionnaire, - query: search_terms - ).results + dossier = dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) end dossiers @@ -41,4 +38,11 @@ class DossierSearchService false end end + + def self.dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) + Search.new( + gestionnaire: gestionnaire, + query: search_terms + ).results + end end From a42c4ade4cc2b95ac37c720472320cfb32edb089 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:45:50 +0200 Subject: [PATCH 08/17] [#2179] Simplify id_compatible? --- app/services/dossier_search_service.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 899ab383b..13cee573a 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -31,12 +31,10 @@ class DossierSearchService end def self.id_compatible?(number) - begin - ActiveRecord::Type::Integer.new.serialize(number) - true - rescue ActiveModel::RangeError - false - end + ActiveRecord::Type::Integer.new.serialize(number) + true + rescue ActiveModel::RangeError + false end def self.dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) From 20b886fb85fa5e1a84b9a2b34294dd8dac31bca9 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:53:22 +0200 Subject: [PATCH 09/17] [#2179] Simplify dossiers_by_id --- app/services/dossier_search_service.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 13cee573a..38ce56610 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -25,9 +25,7 @@ class DossierSearchService end def self.dossiers_by_id(id, gestionnaire) - dossiers = gestionnaire.dossiers.where(id: id) + - gestionnaire.dossiers_from_avis.where(id: id) - dossiers.uniq + (gestionnaire.dossiers.where(id: id) + gestionnaire.dossiers_from_avis.where(id: id)).uniq end def self.id_compatible?(number) From 8744e9b83ddf05d3bf634a5336f0c7d815e1d990 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:54:55 +0200 Subject: [PATCH 10/17] [#2179] Simplify dossier_by_exact_id_for_gestionnaire --- app/services/dossier_search_service.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 38ce56610..5c735bb52 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -16,11 +16,9 @@ class DossierSearchService def self.dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) id = search_terms.to_i if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this. - dossiers = dossiers_by_id(id, gestionnaire) - end - - if dossiers.nil? - dossiers = Dossier.none + dossiers_by_id(id, gestionnaire) + else + Dossier.none end end From 8fc359c54de185c8225fd394181bee91db378e86 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:56:21 +0200 Subject: [PATCH 11/17] [#2179] Simplify matching_dossiers_for_gestionnaire --- app/services/dossier_search_service.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 5c735bb52..e5ce40c04 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -1,14 +1,7 @@ class DossierSearchService def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire) - # exact id match? - dossiers = dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) - - # full text search - if dossiers.empty? - dossier = dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) - end - - dossiers + dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) + .presence || dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) end private From d681b1116f1a553d1beb84e6ca29306a78e5fc03 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 15:08:10 +0200 Subject: [PATCH 12/17] [Fix #2179] Use new full text search --- app/services/dossier_search_service.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index e5ce40c04..7bfb521e9 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -27,9 +27,21 @@ class DossierSearchService end def self.dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire) - Search.new( - gestionnaire: gestionnaire, - query: search_terms - ).results + ts_vector = "to_tsvector('french', search_terms || private_search_terms)" + ts_query = "to_tsquery('french', #{Dossier.connection.quote(to_tsquery(search_terms))})" + + gestionnaire + .dossiers + .not_archived + .state_not_brouillon + .where("#{ts_vector} @@ #{ts_query}") + .order("COALESCE(ts_rank(#{ts_vector}, #{ts_query}), 0) DESC") + end + + def self.to_tsquery(search_terms) + search_terms.gsub(/['?\\:&|!]/, "") # drop disallowed characters + .split(/\s+/) # split words + .map { |x| "#{x}:*" } # enable prefix matching + .join(" & ") end end From 7643459a558efc8371f45dba6a22a28e3681b0b5 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 15:47:49 +0200 Subject: [PATCH 13/17] [#2179] Reuse search spec for search service --- .../dossier_search_service_spec.rb} | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) rename spec/{models/search_spec.rb => services/dossier_search_service_spec.rb} (84%) diff --git a/spec/models/search_spec.rb b/spec/services/dossier_search_service_spec.rb similarity index 84% rename from spec/models/search_spec.rb rename to spec/services/dossier_search_service_spec.rb index 93365ae3e..697de3aa5 100644 --- a/spec/models/search_spec.rb +++ b/spec/services/dossier_search_service_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe Search do - describe '#results' do +describe DossierSearchService do + describe '#matching_dossiers_for_gestionnaire' do subject { liste_dossiers } let(:liste_dossiers) do - described_class.new(gestionnaire: gestionnaire_1, query: terms).results + described_class.matching_dossiers_for_gestionnaire(terms, gestionnaire_1) end let(:administrateur_1) { create(:administrateur) } @@ -23,14 +23,17 @@ describe Search do let(:procedure_2) { create(:procedure, :published, administrateur: administrateur_2) } let!(:dossier_0) { create(:dossier, state: 'brouillon', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) } - let!(:dossier_1) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) } - let!(:dossier_2) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) } - let!(:dossier_3) { create(:dossier, state: 'en_construction', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) } - let!(:dossier_archived) { create(:dossier, state: 'en_construction', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) } - let!(:etablissement_1) { create(:etablissement, entreprise_raison_sociale: 'OCTO Academy', dossier: dossier_1, siret: '41636169600051') } - let!(:etablissement_2) { create(:etablissement, entreprise_raison_sociale: 'Plop octo', dossier: dossier_2, siret: '41816602300012') } - let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', dossier: dossier_3, siret: '41816609600051') } + let!(:etablissement_1) { create(:etablissement, entreprise_raison_sociale: 'OCTO Academy', siret: '41636169600051') } + let!(:dossier_1) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'contact@test.com'), etablissement: etablissement_1) } + + let!(:etablissement_2) { create(:etablissement, entreprise_raison_sociale: 'Plop octo', siret: '41816602300012') } + let!(:dossier_2) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com'), etablissement: etablissement_2) } + + let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') } + let!(:dossier_3) { create(:dossier, state: 'en_construction', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) } + + let!(:dossier_archived) { create(:dossier, state: 'en_construction', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) } describe 'search is empty' do let(:terms) { '' } From 1134877d5912de54bb5f583f4480e73112dca348 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 15:09:33 +0200 Subject: [PATCH 14/17] [#2179] Remove newly dead code --- app/models/search.rb | 77 -------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 app/models/search.rb diff --git a/app/models/search.rb b/app/models/search.rb deleted file mode 100644 index 8f84ce027..000000000 --- a/app/models/search.rb +++ /dev/null @@ -1,77 +0,0 @@ -# See: -# - https://robots.thoughtbot.com/implementing-multi-table-full-text-search-with-postgres -# - http://calebthompson.io/talks/search.html -class Search < ApplicationRecord - # :nodoc: - # - # Englobs a search result (actually a collection of Search objects) so it acts - # like a collection of regular Dossier objects, which can be decorated, - # paginated, ... - class Results - include Enumerable - - def initialize(results) - @results = results - end - - def each - @results.each do |search| - yield search.dossier - end - end - - def method_missing(name, *args, &block) - @results.__send__(name, *args, &block) - end - - def decorate! - @results.each do |search| - search.dossier = search.dossier.decorate - end - end - end - - attr_accessor :gestionnaire - attr_accessor :query - - belongs_to :dossier - - def results - if @query.blank? - return Search.none - end - - search_term = Search.connection.quote(to_tsquery) - - dossier_ids = @gestionnaire.dossiers - .select(:id) - .not_archived - .state_not_brouillon - - q = Search - .select("DISTINCT(searches.dossier_id)") - .select("COALESCE(ts_rank(to_tsvector('french', searches.term::text), to_tsquery('french', #{search_term})), 0) AS rank") - .joins(:dossier) - .where(dossier_id: dossier_ids) - .where("to_tsvector('french', searches.term::text) @@ to_tsquery('french', #{search_term})") - .order("rank DESC") - .preload(:dossier) - - Results.new(q) - end - - # def self.refresh - # # TODO: could be executed concurrently - # # See https://github.com/thoughtbot/scenic#what-about-materialized-views - # Scenic.database.refresh_materialized_view(table_name, concurrently: false) - # end - - private - - def to_tsquery - @query.gsub(/['?\\:&|!]/, "") # drop disallowed characters - .split(/\s+/) # split words - .map { |x| "#{x}:*" } # enable prefix matching - .join(" & ") - end -end From cef0eafb1a589ef90f06b9f6e27aea0dbac486ba Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 22 Aug 2018 18:36:24 +0200 Subject: [PATCH 15/17] [#2179] Tolerate spurious spaces around search terms --- app/services/dossier_search_service.rb | 7 ++++--- spec/services/dossier_search_service_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 7bfb521e9..d7c61d5f7 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -39,9 +39,10 @@ class DossierSearchService end def self.to_tsquery(search_terms) - search_terms.gsub(/['?\\:&|!]/, "") # drop disallowed characters - .split(/\s+/) # split words - .map { |x| "#{x}:*" } # enable prefix matching + search_terms.strip + .gsub(/['?\\:&|!]/, "") # drop disallowed characters + .split(/\s+/) # split words + .map { |x| "#{x}:*" } # enable prefix matching .join(" & ") end end diff --git a/spec/services/dossier_search_service_spec.rb b/spec/services/dossier_search_service_spec.rb index 697de3aa5..9099d7aa4 100644 --- a/spec/services/dossier_search_service_spec.rb +++ b/spec/services/dossier_search_service_spec.rb @@ -73,6 +73,12 @@ describe DossierSearchService do it { expect(subject.size).to eq(2) } end + describe 'search terms surrounded with spurious spaces' do + let(:terms) { ' OCTO ' } + + it { expect(subject.size).to eq(2) } + end + describe 'search on multiple fields' do let(:terms) { 'octo plop' } From ee43650c32986d253cc059937a37a27810d124f8 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 20 Aug 2018 17:20:51 +0200 Subject: [PATCH 16/17] Demande: add nb_of_procedure, deadline and nb_of_dossier fields --- .../stylesheets/new_design/demande.scss | 17 +++++++++ app/controllers/demandes_controller.rb | 18 ++++++++- app/lib/pipedrive/deal_adapter.rb | 21 ++++++++++- app/services/pipedrive_service.rb | 4 +- app/views/demandes/new.html.haml | 37 +++++++++++++++++-- 5 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 app/assets/stylesheets/new_design/demande.scss diff --git a/app/assets/stylesheets/new_design/demande.scss b/app/assets/stylesheets/new_design/demande.scss new file mode 100644 index 000000000..6b0b88451 --- /dev/null +++ b/app/assets/stylesheets/new_design/demande.scss @@ -0,0 +1,17 @@ +@import "constants"; + +.demande { + padding-bottom: $default-padding; + + h1 { + margin-bottom: $default-padding; + } + + .intro { + margin: $default-padding 0; + } + + b { + font-weight: bold; + } +} diff --git a/app/controllers/demandes_controller.rb b/app/controllers/demandes_controller.rb index 53fad026d..c381df1ae 100644 --- a/app/controllers/demandes_controller.rb +++ b/app/controllers/demandes_controller.rb @@ -12,7 +12,10 @@ class DemandesController < ApplicationController demande_params[:poste], demande_params[:source], demande_params[:organization_name], - demande_params[:address] + demande_params[:address], + demande_params[:nb_of_procedures], + demande_params[:nb_of_dossiers], + demande_params[:deadline] ) flash.notice = 'Votre demande a bien été enregistrée, nous vous contacterons rapidement.' redirect_to root_path @@ -21,6 +24,17 @@ class DemandesController < ApplicationController private def demande_params - params.permit(:organization_name, :poste, :name, :email, :phone, :source, :address) + params.permit( + :organization_name, + :poste, + :name, + :email, + :phone, + :source, + :address, + :nb_of_procedures, + :nb_of_dossiers, + :deadline + ) end end diff --git a/app/lib/pipedrive/deal_adapter.rb b/app/lib/pipedrive/deal_adapter.rb index b86654771..80919f229 100644 --- a/app/lib/pipedrive/deal_adapter.rb +++ b/app/lib/pipedrive/deal_adapter.rb @@ -10,6 +10,20 @@ class Pipedrive::DealAdapter PIPEDRIVE_LOST_STATUS = "lost" PIPEDRIVE_LOST_REASON = "refusé depuis DS" + PIPEDRIVE_NB_OF_PROCEDURES_ATTRIBUTE_ID = "b22f8710352a7fb548623c062bf82ed6d1b6b704" + PIPEDRIVE_NB_OF_PROCEDURES_DO_NOT_KNOW_VALUE = "Je ne sais pas" + PIPEDRIVE_NB_OF_PROCEDURES_1_VALUE = "juste 1" + PIPEDRIVE_NB_OF_PROCEDURES_1_TO_10_VALUE = "de 1 a 10" + PIPEDRIVE_NB_OF_PROCEDURES_10_TO_100_VALUE = "de 10 a 100" + PIPEDRIVE_NB_OF_PROCEDURES_ABOVE_100_VALUE = "Plus de 100" + + PIPEDRIVE_DEADLINE_ATTRIBUTE_ID = "36a72c82af9d9f0d476b041ede8876844a249bf2" + PIPEDRIVE_DEADLINE_ASAP_VALUE = "Le plus vite possible" + PIPEDRIVE_DEADLINE_NEXT_3_MONTHS_VALUE = "Dans les 3 prochain mois" + PIPEDRIVE_DEADLINE_NEXT_6_MONTHS_VALUE = "Dans les 6 prochain mois" + PIPEDRIVE_DEADLINE_NEXT_12_MONTHS_VALUE = "Dans les 12 prochain mois" + PIPEDRIVE_DEADLINE_NO_DATE_VALUE = "Pas de date" + def self.refuse_deal(deal_id, owner_id) params = { user_id: owner_id, @@ -32,12 +46,15 @@ class Pipedrive::DealAdapter Pipedrive::API.put_deal(deal_id, params) end - def self.add_deal(organisation_id, person_id, title) + def self.add_deal(organisation_id, person_id, title, nb_of_procedures, nb_of_dossiers, deadline) params = { org_id: organisation_id, person_id: person_id, title: title, - user_id: Pipedrive::PersonAdapter::PIPEDRIVE_ROBOT_ID + user_id: Pipedrive::PersonAdapter::PIPEDRIVE_ROBOT_ID, + "#{PIPEDRIVE_NB_OF_PROCEDURES_ATTRIBUTE_ID}": nb_of_procedures, + value: nb_of_dossiers, + "#{PIPEDRIVE_DEADLINE_ATTRIBUTE_ID}": deadline, } Pipedrive::API.post_deal(params) diff --git a/app/services/pipedrive_service.rb b/app/services/pipedrive_service.rb index df46dca6b..ecd9b8a17 100644 --- a/app/services/pipedrive_service.rb +++ b/app/services/pipedrive_service.rb @@ -17,9 +17,9 @@ class PipedriveService Pipedrive::PersonAdapter.get_demandes_from_persons_owned_by_robot end - def self.add_demande(email, phone, name, poste, source, organization_name, address) + def self.add_demande(email, phone, name, poste, source, organization_name, address, nb_of_procedures, nb_of_dossiers, deadline) organization_id = Pipedrive::OrganizationAdapter.add_organization(organization_name, address) person_id = Pipedrive::PersonAdapter.add_person(email, phone, name, organization_id, poste, source) - Pipedrive::DealAdapter.add_deal(organization_id, person_id, organization_name) + Pipedrive::DealAdapter.add_deal(organization_id, person_id, organization_name, nb_of_procedures, nb_of_dossiers, deadline) end end diff --git a/app/views/demandes/new.html.haml b/app/views/demandes/new.html.haml index ca4a68199..6eab8c947 100644 --- a/app/views/demandes/new.html.haml +++ b/app/views/demandes/new.html.haml @@ -1,7 +1,9 @@ -.container +.container.demande %h1 Demande de compte administrateur - %p Pour obtenir un compte administrateur sur demarches-simplifiees.fr, veuillez remplir le formulaire ci-dessous et un membre de notre équipe vous contactera très prochainement. - %p Tous les champs sont obligatoires. + + %p.intro Attention, la création de compte administrateur est réservée uniquement aux organismes publics. Elle ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues d'utilité publique), ni les personnes souhaitant remplir un dossier ou faire une démarche en ligne. Ce compte vous permettra de créer des démarches sur demarches-simplifiees.fr, vous pourrez ensuite les diffuser en ligne auprès de vos usagers. + %p.intro Pour obtenir un compte administrateur sur demarches-simplifiees.fr, veuillez remplir le formulaire ci-dessous et un membre de notre équipe vous contactera dès que possible. + %p.intro Tous les champs sont obligatoires. = form_tag({ controller: 'demandes', action: 'create' }, class: 'form') do @@ -40,4 +42,33 @@ %span.mandatory * = text_field_tag :address, nil, required: true + = label_tag :nb_of_procedures do + Combien de procédures souhaitez-vous dématerialiser ? + %span.mandatory * + = select_tag :nb_of_procedures, + options_for_select({ 'je ne sais pas' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_DO_NOT_KNOW_VALUE, + '1' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_VALUE, + '1 à 10' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_TO_10_VALUE, + '10 à 100 ' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_10_TO_100_VALUE, + 'plus de 100' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_ABOVE_100_VALUE }), + prompt: 'choisir un intervalle', + required: true + + = label_tag :deadline do + À quelle échance voudriez-vous dématerialiser ? + %span.mandatory * + = select_tag :deadline, + options_for_select({ 'le plus vite possible' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_ASAP_VALUE, + 'dans les 3 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_3_MONTHS_VALUE, + 'dans les 6 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_6_MONTHS_VALUE, + 'dans les 12 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_12_MONTHS_VALUE, + 'pas de date' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NO_DATE_VALUE }), + prompt: 'choisir une échéance', + required: true + + = label_tag :nb_of_dossiers do + Nombre de dossiers usagers qui seront démateerialisés, par an ? (Mettez 0 si vous ne savez pas) + %span.mandatory * + = number_field_tag :nb_of_dossiers, nil, required: true + = submit_tag 'Envoyer', class: 'button', data: { disable: true } From d9a9677d1dac4206ebbe85ca3d01d3022529a2b0 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 22 Aug 2018 20:50:08 +0200 Subject: [PATCH 17/17] [fix #2397] Manager: update crm conf --- app/lib/pipedrive/deal_adapter.rb | 9 +++++---- app/views/manager/demandes/index.html.erb | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/lib/pipedrive/deal_adapter.rb b/app/lib/pipedrive/deal_adapter.rb index 80919f229..725a62936 100644 --- a/app/lib/pipedrive/deal_adapter.rb +++ b/app/lib/pipedrive/deal_adapter.rb @@ -1,11 +1,12 @@ class Pipedrive::DealAdapter PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID = 35 - PIPEDRIVE_REGIONS_STOCK_STAGE_ID = 24 - PIPEDRIVE_PREFECTURES_STOCK_STAGE_ID = 20 - PIPEDRIVE_DEPARTEMENTS_STOCK_STAGE_ID = 30 - PIPEDRIVE_COMMUNES_STOCK_STAGE_ID = 40 + PIPEDRIVE_SERVICE_DECO_REGIONAL_STOCK_STAGE_ID = 24 + PIPEDRIVE_SERVICE_DECO_DEPARTEMENTAL_STOCK_STAGE_ID = 20 + PIPEDRIVE_COLLECTIVITE_DEP_OU_REG_STOCK_STAGE_ID = 30 + PIPEDRIVE_COLLECTIVITE_LOCALE_STOCK_STAGE_ID = 40 PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID = 1 PIPEDRIVE_ORGANISMES_REFUSES_STOCK_STAGE_ID = 45 + PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID = 48 PIPEDRIVE_LOST_STATUS = "lost" PIPEDRIVE_LOST_REASON = "refusé depuis DS" diff --git a/app/views/manager/demandes/index.html.erb b/app/views/manager/demandes/index.html.erb index cefc88e74..7a45aa726 100644 --- a/app/views/manager/demandes/index.html.erb +++ b/app/views/manager/demandes/index.html.erb @@ -35,11 +35,12 @@ <%= select_tag "stage_id", options_for_select({ "administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID, - "région" => Pipedrive::DealAdapter::PIPEDRIVE_REGIONS_STOCK_STAGE_ID, - "préfecture" => Pipedrive::DealAdapter::PIPEDRIVE_PREFECTURES_STOCK_STAGE_ID, - "département" =>Pipedrive::DealAdapter::PIPEDRIVE_DEPARTEMENTS_STOCK_STAGE_ID, - "commune" => Pipedrive::DealAdapter::PIPEDRIVE_COMMUNES_STOCK_STAGE_ID, - "organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID + "service déco. régional" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_REGIONAL_STOCK_STAGE_ID, + "service déco. départemental" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_DEPARTEMENTAL_STOCK_STAGE_ID, + "collectivité dép. ou rég." =>Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_DEP_OU_REG_STOCK_STAGE_ID, + "collectivité locale" => Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_LOCALE_STOCK_STAGE_ID, + "organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID, + "suspect" => Pipedrive::DealAdapter::PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID }), style: 'margin-bottom: 20px; width: inherit;' %>