Merge branch 'dev'
This commit is contained in:
commit
32914a5d08
33 changed files with 166 additions and 131 deletions
2
Gemfile
2
Gemfile
|
@ -38,8 +38,6 @@ gem 'kaminari'
|
||||||
# Decorators
|
# Decorators
|
||||||
gem 'draper'
|
gem 'draper'
|
||||||
|
|
||||||
gem 'unicode_utils'
|
|
||||||
|
|
||||||
# Gestion des comptes utilisateurs
|
# Gestion des comptes utilisateurs
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'devise-async'
|
gem 'devise-async'
|
||||||
|
|
|
@ -746,7 +746,6 @@ GEM
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.5)
|
unf_ext (0.0.7.5)
|
||||||
unicode-display_width (1.3.2)
|
unicode-display_width (1.3.2)
|
||||||
unicode_utils (1.4.0)
|
|
||||||
unicorn (5.4.0)
|
unicorn (5.4.0)
|
||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
|
@ -866,7 +865,6 @@ DEPENDENCIES
|
||||||
turbolinks
|
turbolinks
|
||||||
typhoeus
|
typhoeus
|
||||||
uglifier
|
uglifier
|
||||||
unicode_utils
|
|
||||||
unicorn
|
unicorn
|
||||||
vcr
|
vcr
|
||||||
warden!
|
warden!
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Admin::AttestationTemplatesController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def uninterlaced_png(uploaded_file)
|
def uninterlaced_png(uploaded_file)
|
||||||
if uploaded_file.present? && uploaded_file.content_type == 'image/png'
|
if uploaded_file&.content_type == 'image/png'
|
||||||
chunky_img = ChunkyPNG::Image.from_io(uploaded_file)
|
chunky_img = ChunkyPNG::Image.from_io(uploaded_file)
|
||||||
chunky_img.save(uploaded_file.tempfile.to_path, interlace: false)
|
chunky_img.save(uploaded_file.tempfile.to_path, interlace: false)
|
||||||
uploaded_file.tempfile.reopen(uploaded_file.tempfile.to_path, 'rb')
|
uploaded_file.tempfile.reopen(uploaded_file.tempfile.to_path, 'rb')
|
||||||
|
|
|
@ -225,7 +225,7 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def procedure_params
|
def procedure_params
|
||||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :notice, :web_hook_url, :euro_flag, :logo, :auto_archive_on]
|
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :notice, :web_hook_url, :euro_flag, :logo, :auto_archive_on]
|
||||||
if @procedure.try(:locked?)
|
if @procedure&.locked?
|
||||||
params.require(:procedure).permit(*editable_params)
|
params.require(:procedure).permit(*editable_params)
|
||||||
else
|
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, :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)
|
||||||
|
|
|
@ -118,7 +118,7 @@ module NewGestionnaire
|
||||||
# a gestionnaire is authenticated ... lets see if it can view the dossier
|
# a gestionnaire is authenticated ... lets see if it can view the dossier
|
||||||
|
|
||||||
redirect_to gestionnaire_avis_url(avis)
|
redirect_to gestionnaire_avis_url(avis)
|
||||||
elsif avis.gestionnaire.present? && avis.gestionnaire.email == params[:email]
|
elsif avis.gestionnaire&.email == params[:email]
|
||||||
# the avis gestionnaire has already signed up and it sould sign in
|
# the avis gestionnaire has already signed up and it sould sign in
|
||||||
|
|
||||||
redirect_to new_gestionnaire_session_url
|
redirect_to new_gestionnaire_session_url
|
||||||
|
|
|
@ -138,7 +138,7 @@ module NewUser
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_with_champs
|
def dossier_with_champs
|
||||||
@dossier_with_champs ||= Dossier.with_ordered_champs.find(params[:id])
|
Dossier.with_ordered_champs.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_ownership!
|
def ensure_ownership!
|
||||||
|
|
|
@ -15,9 +15,9 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_email
|
def current_email
|
||||||
current_user.try(:email) ||
|
current_user&.email ||
|
||||||
current_gestionnaire.try(:email) ||
|
current_gestionnaire&.email ||
|
||||||
current_administrateur.try(:email)
|
current_administrateur&.email
|
||||||
end
|
end
|
||||||
|
|
||||||
def root_path_for_profile(nav_bar_profile)
|
def root_path_for_profile(nav_bar_profile)
|
||||||
|
|
|
@ -3,8 +3,9 @@ class FindDubiousProceduresJob < ApplicationJob
|
||||||
|
|
||||||
FORBIDDEN_KEYWORDS = [
|
FORBIDDEN_KEYWORDS = [
|
||||||
'NIR', 'NIRPP', 'race', 'religion',
|
'NIR', 'NIRPP', 'race', 'religion',
|
||||||
'carte bancaire', 'carte bleue', 'sécurité sociale', 'nationalité',
|
'carte bancaire', 'carte bleue', 'sécurité sociale',
|
||||||
'agdref', 'handicap', 'syndicat', 'politique'
|
'agdref', 'handicap', 'syndicat', 'syndical',
|
||||||
|
'parti politique', 'opinion politique', 'bord politique', 'courant politique'
|
||||||
]
|
]
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class AvisMailer < ApplicationMailer
|
class AvisMailer < ApplicationMailer
|
||||||
def avis_invitation(avis)
|
def avis_invitation(avis)
|
||||||
@avis = avis
|
@avis = avis
|
||||||
email = @avis.gestionnaire.try(:email) || @avis.email
|
email = @avis.gestionnaire&.email || @avis.email
|
||||||
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
|
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
class NotificationMailer < ApplicationMailer
|
class NotificationMailer < ApplicationMailer
|
||||||
default to: Proc.new { @user.email }
|
def new_answer(dossier)
|
||||||
|
subject = "Nouveau message pour votre dossier demarches-simplifiees.fr nº #{dossier.id}"
|
||||||
|
|
||||||
def send_dossier_received(dossier_id)
|
send_mail(dossier, subject)
|
||||||
dossier = Dossier.find(dossier_id)
|
|
||||||
send_notification(dossier, dossier.procedure.received_mail_template)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_draft_notification(dossier)
|
def send_draft_notification(dossier)
|
||||||
vars_mailer(dossier)
|
subject = "Retrouvez votre brouillon pour la démarche : #{dossier.procedure.libelle}"
|
||||||
|
|
||||||
@subject = "Retrouvez votre brouillon pour la démarche : #{dossier.procedure.libelle}"
|
send_mail(dossier, subject)
|
||||||
|
end
|
||||||
|
|
||||||
mail(subject: @subject)
|
def send_dossier_received(dossier)
|
||||||
|
send_notification(dossier, dossier.procedure.received_mail_template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_initiated_notification(dossier)
|
def send_initiated_notification(dossier)
|
||||||
|
@ -30,39 +31,31 @@ class NotificationMailer < ApplicationMailer
|
||||||
send_notification(dossier, dossier.procedure.without_continuation_mail_template)
|
send_notification(dossier, dossier.procedure.without_continuation_mail_template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_answer(dossier)
|
|
||||||
send_mail dossier, "Nouveau message pour votre dossier demarches-simplifiees.fr nº #{dossier.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def send_notification(dossier, mail_template)
|
def send_mail(dossier, subject)
|
||||||
vars_mailer(dossier)
|
@dossier = dossier
|
||||||
|
email = dossier.user.email
|
||||||
|
|
||||||
@subject = mail_template.subject_for_dossier dossier
|
mail(subject: subject, to: email)
|
||||||
@body = mail_template.body_for_dossier dossier
|
|
||||||
|
|
||||||
create_commentaire_for_notification
|
|
||||||
|
|
||||||
mail(subject: @subject) { |format| format.html { @body } }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_commentaire_for_notification
|
def send_notification(dossier, mail_template)
|
||||||
|
email = dossier.user.email
|
||||||
|
|
||||||
|
subject = mail_template.subject_for_dossier(dossier)
|
||||||
|
body = mail_template.body_for_dossier(dossier)
|
||||||
|
|
||||||
|
create_commentaire_for_notification(dossier, subject, body)
|
||||||
|
|
||||||
|
mail(subject: subject, to: email) { |format| format.html { body } }
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_commentaire_for_notification(dossier, subject, body)
|
||||||
Commentaire.create(
|
Commentaire.create(
|
||||||
dossier: @dossier,
|
dossier: dossier,
|
||||||
email: I18n.t("dynamics.contact_email"),
|
email: I18n.t("dynamics.contact_email"),
|
||||||
body: ["[#{@subject}]", @body].join("<br><br>")
|
body: ["[#{subject}]", body].join("<br><br>")
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def vars_mailer(dossier)
|
|
||||||
@dossier = dossier
|
|
||||||
@user = dossier.user
|
|
||||||
end
|
|
||||||
|
|
||||||
def send_mail(dossier, subject)
|
|
||||||
vars_mailer dossier
|
|
||||||
|
|
||||||
mail(subject: subject)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Avis < ApplicationRecord
|
||||||
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
||||||
|
|
||||||
def email_to_display
|
def email_to_display
|
||||||
gestionnaire.try(:email) || email
|
gestionnaire&.email || email
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.link_avis_to_gestionnaire(gestionnaire)
|
def self.link_avis_to_gestionnaire(gestionnaire)
|
||||||
|
@ -27,8 +27,7 @@ class Avis < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.avis_exists_and_email_belongs_to_avis?(avis_id, email)
|
def self.avis_exists_and_email_belongs_to_avis?(avis_id, email)
|
||||||
avis = Avis.find_by(id: avis_id)
|
Avis.find_by(id: avis_id)&.email == email
|
||||||
avis.present? && avis.email == email
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -323,7 +323,7 @@ class Dossier < ApplicationRecord
|
||||||
|
|
||||||
def send_dossier_received
|
def send_dossier_received
|
||||||
if saved_change_to_state? && en_instruction?
|
if saved_change_to_state? && en_instruction?
|
||||||
NotificationMailer.send_dossier_received(id).deliver_later
|
NotificationMailer.send_dossier_received(self).deliver_later
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Mails
|
||||||
|
|
||||||
def self.default_template_name_for_procedure(procedure)
|
def self.default_template_name_for_procedure(procedure)
|
||||||
attestation_template = procedure.attestation_template
|
attestation_template = procedure.attestation_template
|
||||||
if attestation_template.present? && attestation_template.activated?
|
if attestation_template&.activated?
|
||||||
"mails/closed_mail_with_attestation"
|
"mails/closed_mail_with_attestation"
|
||||||
else
|
else
|
||||||
"mails/closed_mail"
|
"mails/closed_mail"
|
||||||
|
|
|
@ -209,11 +209,11 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
procedure.administrateur = admin
|
procedure.administrateur = admin
|
||||||
procedure.initiated_mail = initiated_mail.try(:dup)
|
procedure.initiated_mail = initiated_mail&.dup
|
||||||
procedure.received_mail = received_mail.try(:dup)
|
procedure.received_mail = received_mail&.dup
|
||||||
procedure.closed_mail = closed_mail.try(:dup)
|
procedure.closed_mail = closed_mail&.dup
|
||||||
procedure.refused_mail = refused_mail.try(:dup)
|
procedure.refused_mail = refused_mail&.dup
|
||||||
procedure.without_continuation_mail = without_continuation_mail.try(:dup)
|
procedure.without_continuation_mail = without_continuation_mail&.dup
|
||||||
|
|
||||||
procedure.cloned_from_library = from_library
|
procedure.cloned_from_library = from_library
|
||||||
procedure.parent_procedure = self
|
procedure.parent_procedure = self
|
||||||
|
|
|
@ -31,7 +31,7 @@ class DossierSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def email
|
def email
|
||||||
object.user.try(:email)
|
object.user&.email
|
||||||
end
|
end
|
||||||
|
|
||||||
def entreprise
|
def entreprise
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
||||||
:individual_birthdate
|
:individual_birthdate
|
||||||
|
|
||||||
def email
|
def email
|
||||||
object.user.try(:email)
|
object.user&.email
|
||||||
end
|
end
|
||||||
|
|
||||||
def state
|
def state
|
||||||
|
@ -47,19 +47,19 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def individual_prenom
|
def individual_prenom
|
||||||
object.individual.try(:prenom)
|
object.individual&.prenom
|
||||||
end
|
end
|
||||||
|
|
||||||
def individual_nom
|
def individual_nom
|
||||||
object.individual.try(:nom)
|
object.individual&.nom
|
||||||
end
|
end
|
||||||
|
|
||||||
def individual_birthdate
|
def individual_birthdate
|
||||||
object.individual.try(:birthdate)
|
object.individual&.birthdate
|
||||||
end
|
end
|
||||||
|
|
||||||
def individual_gender
|
def individual_gender
|
||||||
object.individual.try(:gender)
|
object.individual&.gender
|
||||||
end
|
end
|
||||||
|
|
||||||
def emails_accompagnateurs
|
def emails_accompagnateurs
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
class IndividualSerializer < ActiveModel::Serializer
|
class IndividualSerializer < ActiveModel::Serializer
|
||||||
|
attribute :gender, key: :civilite
|
||||||
attributes :nom, :prenom
|
attributes :nom, :prenom
|
||||||
|
attribute :birthdate, key: :date_naissance, if: :include_birthdate?
|
||||||
|
|
||||||
|
def include_birthdate?
|
||||||
|
object&.dossier&.procedure&.ask_birthday
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
||||||
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
|
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
|
||||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
= 'éditer'.upcase
|
= 'ÉDITER'
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
- if user_signed_in? && (@facade.dossier.owner_or_invite?(current_user))
|
||||||
= link_to modifier_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
|
= link_to modifier_dossier_path(@facade.dossier), class: 'action', id: 'maj_infos' do
|
||||||
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
= "éditer".upcase
|
= "ÉDITER"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
- if @facade.procedure.for_individual?
|
- if @facade.procedure.for_individual?
|
||||||
.row.title-row
|
.row.title-row
|
||||||
.col-xs-4.split-hr
|
.col-xs-4.split-hr
|
||||||
.col-xs-4.dossier-title= t('utils.depositaire').upcase
|
.col-xs-4.dossier-title= t('utils.depositaire')
|
||||||
.col-xs-4.split-hr
|
.col-xs-4.split-hr
|
||||||
.row
|
.row
|
||||||
.col-xs-6.depositaire-label Civilité
|
.col-xs-6.depositaire-label Civilité
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
- if champ.type_champ == 'header_section'
|
- if champ.type_champ == 'header_section'
|
||||||
.row.title-row.margin-top-40
|
.row.title-row.margin-top-40
|
||||||
.col-xs-3.split-hr
|
.col-xs-3.split-hr
|
||||||
.col-xs-6.dossier-title= champ.libelle.upcase
|
.col-xs-6.dossier-title= champ.libelle
|
||||||
.col-xs-3.split-hr
|
.col-xs-3.split-hr
|
||||||
- else
|
- else
|
||||||
.row
|
.row
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
.col-xs-12
|
.col-xs-12
|
||||||
.row.title-row
|
.row.title-row
|
||||||
.col-xs-4.split-hr
|
.col-xs-4.split-hr
|
||||||
.col-xs-4.dossier-title= t('utils.pieces').upcase
|
.col-xs-4.dossier-title= t('utils.pieces')
|
||||||
.col-xs-4.split-hr
|
.col-xs-4.split-hr
|
||||||
|
|
||||||
.col-xs-12#pieces-justificatives.margin-bot-40
|
.col-xs-12#pieces-justificatives.margin-bot-40
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/ We can't use &. because the controller may not implement #nav_bar_profile
|
||||||
- nav_bar_profile = controller.try(:nav_bar_profile)
|
- nav_bar_profile = controller.try(:nav_bar_profile)
|
||||||
|
|
||||||
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
|
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.en-cours
|
.en-cours
|
||||||
%b
|
%b
|
||||||
= dossier_count = current_administrateur.procedures.count
|
= dossier_count = current_administrateur.procedures.count
|
||||||
= ("Procedures".pluralize(dossier_count)).upcase
|
= "Procedures".pluralize(dossier_count)
|
||||||
|
|
||||||
#action-block
|
#action-block
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#first-block
|
#first-block
|
||||||
.en-cours
|
.en-cours
|
||||||
= dossier_count = current_user.dossiers.count
|
= dossier_count = current_user.dossiers.count
|
||||||
= ("Dossier".pluralize(dossier_count)).upcase
|
= "Dossier".pluralize(dossier_count)
|
||||||
%br
|
%br
|
||||||
EN COURS
|
EN COURS
|
||||||
|
|
||||||
|
|
|
@ -8,54 +8,58 @@
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="main-content__body main-content__body--flush">
|
<% if @pending_demandes.present? %>
|
||||||
<table>
|
<section class="main-content__body main-content__body--flush">
|
||||||
<thead>
|
<table>
|
||||||
<% keys = @pending_demandes.first.keys %>
|
<thead>
|
||||||
<tr>
|
<% keys = @pending_demandes.first.keys %>
|
||||||
<% keys.each do |key| %>
|
|
||||||
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
|
|
||||||
<%= key %>
|
|
||||||
</th>
|
|
||||||
<% end %>
|
|
||||||
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
|
|
||||||
</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @pending_demandes.each do |demande| %>
|
|
||||||
<tr>
|
<tr>
|
||||||
<% keys.each do |key| %>
|
<% keys.each do |key| %>
|
||||||
<td class="cell-data cell-data--string">
|
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
|
||||||
<%= demande[key] %>
|
<%= key %>
|
||||||
</td>
|
</th>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td class="cell-data cell-data--string" style="text-align: center;">
|
<th class="cell-label cell-label--string cell-label--false" scope="col" role="columnheader" aria-sort="none">
|
||||||
<%= form_tag(manager_demandes_create_administrateur_path) do -%>
|
</th>
|
||||||
<%= select_tag "stage_id",
|
</thead>
|
||||||
options_for_select({
|
<tbody>
|
||||||
"administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID,
|
<% @pending_demandes.each do |demande| %>
|
||||||
"région" => Pipedrive::DealAdapter::PIPEDRIVE_REGIONS_STOCK_STAGE_ID,
|
<tr>
|
||||||
"préfecture" => Pipedrive::DealAdapter::PIPEDRIVE_PREFECTURES_STOCK_STAGE_ID,
|
<% keys.each do |key| %>
|
||||||
"département" =>Pipedrive::DealAdapter::PIPEDRIVE_DEPARTEMENTS_STOCK_STAGE_ID,
|
<td class="cell-data cell-data--string">
|
||||||
"commune" => Pipedrive::DealAdapter::PIPEDRIVE_COMMUNES_STOCK_STAGE_ID,
|
<%= demande[key] %>
|
||||||
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID
|
</td>
|
||||||
}),
|
<% end %>
|
||||||
style: 'margin-bottom: 20px; width: inherit;' %>
|
<td class="cell-data cell-data--string" style="text-align: center;">
|
||||||
|
<%= form_tag(manager_demandes_create_administrateur_path) do -%>
|
||||||
|
<%= 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
|
||||||
|
}),
|
||||||
|
style: 'margin-bottom: 20px; width: inherit;' %>
|
||||||
|
|
||||||
<%= hidden_field_tag 'email', demande[:email] %>
|
<%= hidden_field_tag 'email', demande[:email] %>
|
||||||
<%= hidden_field_tag 'person_id', demande[:person_id] %>
|
<%= hidden_field_tag 'person_id', demande[:person_id] %>
|
||||||
|
|
||||||
<%= submit_tag 'Créer' %>
|
<%= submit_tag 'Créer' %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</td>
|
</td>
|
||||||
<td class="cell-data cell-data--string" style="text-align: center;">
|
<td class="cell-data cell-data--string" style="text-align: center;">
|
||||||
<%= button_to('Refuser',
|
<%= button_to('Refuser',
|
||||||
manager_demandes_refuse_administrateur_path,
|
manager_demandes_refuse_administrateur_path,
|
||||||
params: { person_id: demande[:person_id], email: demande[:email] },
|
params: { person_id: demande[:person_id], email: demande[:email] },
|
||||||
style: 'background-color: #FFFFFF; color: #293f54; border: 1px solid #dfe0e1') %>
|
style: 'background-color: #FFFFFF; color: #293f54; border: 1px solid #dfe0e1') %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
<% else %>
|
||||||
|
<h1>Aucune demande</h1>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- dossier = Dossier.find_by(id: champ.value)
|
- dossier = Dossier.find_by(id: champ.value)
|
||||||
- show_text_summary = dossier.present?
|
- show_text_summary = dossier.present?
|
||||||
- show_warning = !show_text_summary && champ.value.present?
|
- show_warning = !show_text_summary && champ.value.present?
|
||||||
- text_summary = sanitize(dossier.try(:text_summary))
|
- text_summary = sanitize(dossier&.text_summary)
|
||||||
|
|
||||||
.dossier-link
|
.dossier-link
|
||||||
= form.number_field :value,
|
= form.number_field :value,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- dossier = Dossier.find_by(id: champ.value)
|
- dossier = Dossier.find_by(id: champ.value)
|
||||||
- show_text_summary = dossier.present?
|
- show_text_summary = dossier.present?
|
||||||
- show_warning = !show_text_summary && champ.value.present?
|
- show_warning = !show_text_summary && champ.value.present?
|
||||||
- text_summary = dossier.try(:text_summary)
|
- text_summary = dossier&.text_summary
|
||||||
|
|
||||||
.dossier-link
|
.dossier-link
|
||||||
%input.form-control{ name: "champs['#{ champ.id }']",
|
%input.form-control{ name: "champs['#{ champ.id }']",
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
require "unicode_utils/upcase"
|
|
||||||
|
|
||||||
class String
|
|
||||||
def upcase
|
|
||||||
UnicodeUtils.upcase(self)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +1,11 @@
|
||||||
namespace :'2018_02_28_clean_invalid_emails_accounts' do
|
namespace :'2018_02_28_clean_invalid_emails_accounts' do
|
||||||
task clean: :environment do
|
task clean: :environment do
|
||||||
Gestionnaire.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
Gestionnaire.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||||
Gestionnaire.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||||
end
|
end
|
||||||
|
|
||||||
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
User.pluck(:email, :id).select { |e, id| e.include?(" ") }.each do |email, id|
|
||||||
User.find_by(id: id, current_sign_in_at: nil).try(:destroy) # ensure account was never used
|
User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
29
lib/tasks/2018_05_30_missed_ar_messages.rake
Normal file
29
lib/tasks/2018_05_30_missed_ar_messages.rake
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
namespace :'2018_05_30_missed_ar_messages' do
|
||||||
|
task restore: :environment do
|
||||||
|
create_commentaires(:en_construction_at, :initiated_mail_template)
|
||||||
|
create_commentaires(:processed_at, :closed_mail_template, Dossier.where(state: 'accepte'))
|
||||||
|
create_commentaires(:processed_at, :refused_mail_template, Dossier.where(state: 'refuse'))
|
||||||
|
create_commentaires(:processed_at, :without_continuation_mail_template, Dossier.where(state: 'sans_suite'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_commentaires(date_name, template_name, dossiers = Dossier)
|
||||||
|
error_range = DateTime.new(2018, 05, 28, 13, 33)..DateTime.new(2018, 05, 30, 15, 39)
|
||||||
|
|
||||||
|
dossiers.includes(:procedure).where(date_name => error_range).find_each(batch_size: 100) do |dossier|
|
||||||
|
print "#{dossier.id}\n"
|
||||||
|
create_commentaire(dossier, dossier.procedure.send(template_name), dossier.send(date_name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_commentaire(dossier, template, date)
|
||||||
|
subject = template.subject_for_dossier(dossier)
|
||||||
|
body = template.body_for_dossier(dossier)
|
||||||
|
|
||||||
|
Commentaire.create(
|
||||||
|
dossier: dossier,
|
||||||
|
email: I18n.t("dynamics.contact_email"),
|
||||||
|
body: "[#{subject}]<br><br>#{body}",
|
||||||
|
created_at: date
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -71,7 +71,10 @@ namespace :dev do
|
||||||
task :import_db do
|
task :import_db do
|
||||||
filename = "tps_prod_#{1.day.ago.strftime("%d-%m-%Y")}.sql"
|
filename = "tps_prod_#{1.day.ago.strftime("%d-%m-%Y")}.sql"
|
||||||
local_file = "/tmp/#{filename}"
|
local_file = "/tmp/#{filename}"
|
||||||
run_and_stop_if_error "scp -C deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}"
|
|
||||||
|
if !File.exist?(local_file)
|
||||||
|
run_and_stop_if_error "scp -C deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}"
|
||||||
|
end
|
||||||
|
|
||||||
dev_env_param = "RAILS_ENV=development"
|
dev_env_param = "RAILS_ENV=development"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.send_dossier_received' do
|
describe '.send_dossier_received' do
|
||||||
subject { described_class.send_dossier_received(dossier.id) }
|
subject { described_class.send_dossier_received(dossier) }
|
||||||
let(:email_template) { create(:received_mail) }
|
let(:email_template) { create(:received_mail) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -603,7 +603,7 @@ describe Dossier do
|
||||||
|
|
||||||
it "sends an email when the dossier becomes en_instruction" do
|
it "sends an email when the dossier becomes en_instruction" do
|
||||||
dossier.en_instruction!
|
dossier.en_instruction!
|
||||||
expect(NotificationMailer).to have_received(:send_dossier_received).with(dossier.id)
|
expect(NotificationMailer).to have_received(:send_dossier_received).with(dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not an email when the dossier becomes accepte" do
|
it "does not an email when the dossier becomes accepte" do
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
describe IndividualSerializer do
|
describe IndividualSerializer do
|
||||||
describe '#attributes' do
|
describe '#attributes' do
|
||||||
let(:individual){ Individual.create(nom: 'nom', prenom: 'prenom') }
|
let(:procedure) { build(:procedure) }
|
||||||
|
let(:dossier) { build(:dossier, procedure: procedure) }
|
||||||
|
let(:individual) { build(:individual, gender: 'M.', nom: 'nom', prenom: 'prenom', birthdate: Date.new(2001, 8, 27), dossier: dossier) }
|
||||||
|
|
||||||
subject { IndividualSerializer.new(individual).serializable_hash }
|
subject { IndividualSerializer.new(individual).serializable_hash }
|
||||||
|
|
||||||
|
it { is_expected.to include(civilite: 'M.') }
|
||||||
it { is_expected.to include(nom: 'nom') }
|
it { is_expected.to include(nom: 'nom') }
|
||||||
it { is_expected.to include(prenom: 'prenom') }
|
it { is_expected.to include(prenom: 'prenom') }
|
||||||
|
it { is_expected.not_to have_key(:date_naissance) }
|
||||||
|
|
||||||
|
context 'when the procedure asks for a birthdate' do
|
||||||
|
let(:procedure) { build(:procedure, ask_birthday: true) }
|
||||||
|
|
||||||
|
it { is_expected.to include(date_naissance: Date.new(2001, 8, 27)) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue