Merge pull request #4258 from betagouv/dev

2019-08-28-02
This commit is contained in:
Paul Chavard 2019-08-28 17:26:18 +02:00 committed by GitHub
commit 97978d78b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 40 deletions

View file

@ -22,8 +22,8 @@ module Instructeurs
end end
def apercu_attestation def apercu_attestation
@title = dossier.procedure.attestation_template.title @title = dossier.procedure.attestation_template.title_for_dossier(dossier)
@body = dossier.procedure.attestation_template.body @body = dossier.procedure.attestation_template.body_for_dossier(dossier)
@footer = dossier.procedure.attestation_template.footer @footer = dossier.procedure.attestation_template.footer
@created_at = Time.zone.now @created_at = Time.zone.now
@logo = dossier.procedure.attestation_template&.proxy_logo @logo = dossier.procedure.attestation_template&.proxy_logo

View file

@ -258,7 +258,7 @@ module Users
def show_demarche_en_test_banner def show_demarche_en_test_banner
if @dossier.present? && @dossier.procedure.brouillon? 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 na 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
end end

View file

@ -1,38 +1,12 @@
module BizDev module BizDev
BIZ_DEV_MAPPING = { NAME = "Équipe DS"
9 => PIPEDRIVE_ID = 6019737
{
full_name: "Philippe Vrignaud",
pipedrive_id: 2753338
},
10 =>
{
full_name: "Benjamin Doberset",
pipedrive_id: 4223834
}
}
BIZ_DEV_IDS = BIZ_DEV_MAPPING.keys
def self.full_name(administration_id) def self.full_name(administration_id)
id = ensure_proper_administration_id(administration_id) NAME
BIZ_DEV_MAPPING[id][:full_name]
end end
def self.pipedrive_id(administration_id) def self.pipedrive_id(administration_id)
id = ensure_proper_administration_id(administration_id) PIPEDRIVE_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
end end
end end

View file

@ -122,6 +122,14 @@ class AttestationTemplate < ApplicationRecord
end end
end end
def title_for_dossier(dossier)
replace_tags(title, dossier)
end
def body_for_dossier(dossier)
replace_tags(body, dossier)
end
private private
def used_tags def used_tags
@ -138,8 +146,8 @@ class AttestationTemplate < ApplicationRecord
def build_pdf(dossier) def build_pdf(dossier)
action_view = ActionView::Base.new(ActionController::Base.view_paths, action_view = ActionView::Base.new(ActionController::Base.view_paths,
logo: proxy_logo, logo: proxy_logo,
title: replace_tags(title, dossier), title: title_for_dossier(dossier),
body: replace_tags(body, dossier), body: body_for_dossier(dossier),
signature: proxy_signature, signature: proxy_signature,
footer: footer, footer: footer,
created_at: Time.zone.now) created_at: Time.zone.now)

View file

@ -139,5 +139,4 @@
(à 00h01) (à 00h01)
%p.help-block %p.help-block
%i.fa.fa-info-circle %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" 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).
(c'est à dire ceux qui ont été déposés), au statut "en instruction", ce qui ne permet plus aux usagers de les modifier.

View file

@ -1,10 +1,10 @@
require 'spec_helper' require 'spec_helper'
describe BizDev, lib: true do 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 } 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 describe '#full_name' do
subject { described_class.full_name(administration_id) } subject { described_class.full_name(administration_id) }

View file

@ -11,7 +11,7 @@ RSpec.describe AdministrationMailer, type: :mailer do
describe '#invite_admin' do describe '#invite_admin' do
let(:admin) { create(:administrateur) } let(:admin) { create(:administrateur) }
let(:token) { "Toc toc toc" } 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) } subject { described_class.invite_admin(admin, token, administration_id) }