From 4032fc61e36459ba4e1bb974af3e30d40022b601 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Wed, 28 Aug 2019 11:37:41 +0200 Subject: [PATCH 1/4] move to only one pipedrive account --- app/lib/biz_dev.rb | 34 +++------------------- spec/lib/biz_dev_spec.rb | 4 +-- spec/mailers/administration_mailer_spec.rb | 2 +- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/app/lib/biz_dev.rb b/app/lib/biz_dev.rb index 52285e23d..5543436ca 100644 --- a/app/lib/biz_dev.rb +++ b/app/lib/biz_dev.rb @@ -1,38 +1,12 @@ module BizDev - BIZ_DEV_MAPPING = { - 9 => - { - full_name: "Philippe Vrignaud", - pipedrive_id: 2753338 - }, - 10 => - { - full_name: "Benjamin Doberset", - pipedrive_id: 4223834 - } - } - - BIZ_DEV_IDS = BIZ_DEV_MAPPING.keys + NAME = "Équipe DS" + PIPEDRIVE_ID = 6019737 def self.full_name(administration_id) - id = ensure_proper_administration_id(administration_id) - - BIZ_DEV_MAPPING[id][:full_name] + NAME end def self.pipedrive_id(administration_id) - id = ensure_proper_administration_id(administration_id) - - BIZ_DEV_MAPPING[id][:pipedrive_id] - end - - private - - def self.ensure_proper_administration_id(administration_id) - if administration_id.in?(BIZ_DEV_IDS) - administration_id - else - BIZ_DEV_IDS[administration_id % BIZ_DEV_IDS.length] - end + PIPEDRIVE_ID end end diff --git a/spec/lib/biz_dev_spec.rb b/spec/lib/biz_dev_spec.rb index e5a59ba5e..475e93332 100644 --- a/spec/lib/biz_dev_spec.rb +++ b/spec/lib/biz_dev_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' describe BizDev, lib: true do - let(:first_biz_dev_id) { BizDev::BIZ_DEV_IDS.first } + let(:first_biz_dev_id) { BizDev::PIPEDRIVE_ID } let(:non_biz_dev_id) { first_biz_dev_id - 1 } - it { expect(BizDev::BIZ_DEV_MAPPING).not_to include(non_biz_dev_id) } + it { expect(BizDev::PIPEDRIVE_ID).not_to eq(non_biz_dev_id) } describe '#full_name' do subject { described_class.full_name(administration_id) } diff --git a/spec/mailers/administration_mailer_spec.rb b/spec/mailers/administration_mailer_spec.rb index 9c009be48..d53c1509c 100644 --- a/spec/mailers/administration_mailer_spec.rb +++ b/spec/mailers/administration_mailer_spec.rb @@ -11,7 +11,7 @@ RSpec.describe AdministrationMailer, type: :mailer do describe '#invite_admin' do let(:admin) { create(:administrateur) } let(:token) { "Toc toc toc" } - let(:administration_id) { BizDev::BIZ_DEV_IDS.first } + let(:administration_id) { BizDev::PIPEDRIVE_ID } subject { described_class.invite_admin(admin, token, administration_id) } From 73d643d1be57859bb7d5e03989244430443d45ef Mon Sep 17 00:00:00 2001 From: benjaminhenkel Date: Wed, 28 Aug 2019 11:37:39 +0200 Subject: [PATCH 2/4] Update flash message for test demarche --- app/controllers/users/dossiers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 2568bce67..c28a7a53a 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -258,7 +258,7 @@ module Users def show_demarche_en_test_banner if @dossier.present? && @dossier.procedure.brouillon? - flash.now.alert = "Ce dossier est déposé sur une démarche en test. Il sera supprimé lors de la publication de la démarche et sa soumission n’a pas de valeur juridique." + flash.now.alert = "Ce dossier est déposé sur une démarche en test. Toute modification de la démarche par l'administrateur (ajout d'un champ, publication de la démarche...) entrainera sa suppression." end end From 2b510a15a2079f0a2f0a41a84986eab520b90d57 Mon Sep 17 00:00:00 2001 From: benjaminhenkel Date: Wed, 28 Aug 2019 11:45:21 +0200 Subject: [PATCH 3/4] Update _informations.html.haml --- app/views/admin/procedures/_informations.html.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index ac8b808ed..6d783feae 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -139,5 +139,4 @@ (à 00h01) %p.help-block %i.fa.fa-info-circle - La clôture automatique suspend la publication de la démarche et entraîne le passage de tous les dossiers "en construction" - (c'est à dire ceux qui ont été déposés), au statut "en instruction", ce qui ne permet plus aux usagers de les modifier. + La clôture automatique suspend la publication de la démarche et entraîne le passage de tous les dossiers au statut "en instruction", ce qui ne permet plus aux usagers de les modifier. Le passage en instruction des dossiers s'accompagne de l'envoi de l'email d'accusé de passage en instruction (configurable par l'administrateur dans la partie "E-mail" de la démarche). From 3c6b35d720e37213203b04b3d01afc31a689d330 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 28 Aug 2019 16:33:51 +0200 Subject: [PATCH 4/4] Fix attestation preview --- app/controllers/instructeurs/dossiers_controller.rb | 4 ++-- app/models/attestation_template.rb | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/instructeurs/dossiers_controller.rb b/app/controllers/instructeurs/dossiers_controller.rb index 744670657..2f676a371 100644 --- a/app/controllers/instructeurs/dossiers_controller.rb +++ b/app/controllers/instructeurs/dossiers_controller.rb @@ -22,8 +22,8 @@ module Instructeurs end def apercu_attestation - @title = dossier.procedure.attestation_template.title - @body = dossier.procedure.attestation_template.body + @title = dossier.procedure.attestation_template.title_for_dossier(dossier) + @body = dossier.procedure.attestation_template.body_for_dossier(dossier) @footer = dossier.procedure.attestation_template.footer @created_at = Time.zone.now @logo = dossier.procedure.attestation_template&.proxy_logo diff --git a/app/models/attestation_template.rb b/app/models/attestation_template.rb index e7d4de85f..4d8d3a3ae 100644 --- a/app/models/attestation_template.rb +++ b/app/models/attestation_template.rb @@ -122,6 +122,14 @@ class AttestationTemplate < ApplicationRecord end end + def title_for_dossier(dossier) + replace_tags(title, dossier) + end + + def body_for_dossier(dossier) + replace_tags(body, dossier) + end + private def used_tags @@ -138,8 +146,8 @@ class AttestationTemplate < ApplicationRecord def build_pdf(dossier) action_view = ActionView::Base.new(ActionController::Base.view_paths, logo: proxy_logo, - title: replace_tags(title, dossier), - body: replace_tags(body, dossier), + title: title_for_dossier(dossier), + body: body_for_dossier(dossier), signature: proxy_signature, footer: footer, created_at: Time.zone.now)