Merge branch 'main' into 6624/etq-instructeur-je-souhaite-supprimer-des-messages-envoyes-par-erreur
This commit is contained in:
commit
82b23b92c0
11 changed files with 58 additions and 59 deletions
|
@ -2,14 +2,24 @@ class Champs::PieceJustificativeController < ApplicationController
|
|||
before_action :authenticate_logged_user!
|
||||
|
||||
def update
|
||||
@champ = policy_scope(Champ).find(params[:champ_id])
|
||||
|
||||
@champ.piece_justificative_file.attach(params[:blob_signed_id])
|
||||
if @champ.save
|
||||
if attach_piece_justificative_or_retry
|
||||
render :show
|
||||
else
|
||||
errors = @champ.errors.full_messages
|
||||
render :json => { errors: errors }, :status => 422
|
||||
render json: { errors: @champ.errors.full_messages }, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def attach_piece_justificative
|
||||
@champ = policy_scope(Champ).find(params[:champ_id])
|
||||
@champ.piece_justificative_file.attach(params[:blob_signed_id])
|
||||
@champ.save
|
||||
end
|
||||
|
||||
def attach_piece_justificative_or_retry
|
||||
attach_piece_justificative
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
attach_piece_justificative
|
||||
end
|
||||
end
|
||||
|
|
|
@ -251,11 +251,11 @@ module NewAdministrateur
|
|||
end
|
||||
|
||||
def procedure_params
|
||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :euro_flag, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token]
|
||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token, :duree_conservation_dossiers_dans_ds]
|
||||
permited_params = 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, :path)
|
||||
params.require(:procedure).permit(*editable_params, :for_individual, :path)
|
||||
end
|
||||
if permited_params[:auto_archive_on].present?
|
||||
permited_params[:auto_archive_on] = Date.parse(permited_params[:auto_archive_on]) + 1.day
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
module Users
|
||||
class ProfilController < UserController
|
||||
before_action :ensure_update_email_is_authorized, only: :update_email
|
||||
before_action :find_transfers, only: [:show, :renew_api_token]
|
||||
|
||||
def show
|
||||
@waiting_merge_emails = waiting_merge_emails
|
||||
@waiting_transfers = current_user.dossiers.joins(:transfer).group('dossier_transfers.email').count.to_a
|
||||
end
|
||||
|
||||
def renew_api_token
|
||||
|
@ -56,6 +55,11 @@ module Users
|
|||
|
||||
private
|
||||
|
||||
def find_transfers
|
||||
@waiting_merge_emails = waiting_merge_emails
|
||||
@waiting_transfers = current_user.dossiers.joins(:transfer).group('dossier_transfers.email').count.to_a
|
||||
end
|
||||
|
||||
def waiting_merge_emails
|
||||
users_requesting_merge.pluck(:email)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module ConservationDeDonneesHelper
|
||||
def politiques_conservation_de_donnees(procedure)
|
||||
[conservation_dans_ds(procedure), conservation_hors_ds(procedure)].compact
|
||||
[conservation_dans_ds(procedure)].compact
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -10,10 +10,4 @@ module ConservationDeDonneesHelper
|
|||
"Dans #{APPLICATION_NAME} : #{procedure.duree_conservation_dossiers_dans_ds} mois"
|
||||
end
|
||||
end
|
||||
|
||||
def conservation_hors_ds(procedure)
|
||||
if procedure.duree_conservation_dossiers_hors_ds.present?
|
||||
"Par l’administration : #{procedure.duree_conservation_dossiers_hors_ds} mois"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -83,14 +83,16 @@ class Dossier < ApplicationRecord
|
|||
has_many :avis, inverse_of: :dossier, dependent: :destroy
|
||||
has_many :experts, through: :avis
|
||||
has_many :traitements, -> { order(:processed_at) }, inverse_of: :dossier, dependent: :destroy do
|
||||
def passer_en_construction(processed_at: Time.zone.now)
|
||||
def passer_en_construction(instructeur: nil, processed_at: Time.zone.now)
|
||||
build(state: Dossier.states.fetch(:en_construction),
|
||||
instructeur_email: instructeur&.email,
|
||||
process_expired: false,
|
||||
processed_at: processed_at)
|
||||
end
|
||||
|
||||
def passer_en_instruction(processed_at: Time.zone.now)
|
||||
def passer_en_instruction(instructeur: nil, processed_at: Time.zone.now)
|
||||
build(state: Dossier.states.fetch(:en_instruction),
|
||||
instructeur_email: instructeur&.email,
|
||||
process_expired: false,
|
||||
processed_at: processed_at)
|
||||
end
|
||||
|
@ -735,7 +737,7 @@ class Dossier < ApplicationRecord
|
|||
self.en_construction_close_to_expiration_notice_sent_at = nil
|
||||
self.conservation_extension = 0.days
|
||||
self.en_instruction_at = self.traitements
|
||||
.passer_en_instruction
|
||||
.passer_en_instruction(instructeur: instructeur)
|
||||
.processed_at
|
||||
save!
|
||||
|
||||
|
@ -759,7 +761,7 @@ class Dossier < ApplicationRecord
|
|||
self.en_construction_close_to_expiration_notice_sent_at = nil
|
||||
self.conservation_extension = 0.days
|
||||
self.en_construction_at = self.traitements
|
||||
.passer_en_construction
|
||||
.passer_en_construction(instructeur: instructeur)
|
||||
.processed_at
|
||||
save!
|
||||
log_dossier_operation(instructeur, :repasser_en_construction)
|
||||
|
@ -770,7 +772,7 @@ class Dossier < ApplicationRecord
|
|||
self.termine_close_to_expiration_notice_sent_at = nil
|
||||
self.conservation_extension = 0.days
|
||||
self.en_instruction_at = self.traitements
|
||||
.passer_en_instruction
|
||||
.passer_en_instruction(instructeur: instructeur)
|
||||
.processed_at
|
||||
attestation&.destroy
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#
|
||||
|
||||
class Procedure < ApplicationRecord
|
||||
self.ignored_columns = [:duree_conservation_dossiers_hors_ds]
|
||||
include ProcedureStatsConcern
|
||||
include EncryptableConcern
|
||||
include FileValidationConcern
|
||||
|
@ -238,7 +239,6 @@ class Procedure < ApplicationRecord
|
|||
validate :check_juridique
|
||||
validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,200}\z/ }, uniqueness: { scope: [:path, :closed_at, :hidden_at, :unpublished_at], case_sensitive: false }
|
||||
validates :duree_conservation_dossiers_dans_ds, allow_nil: false, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: MAX_DUREE_CONSERVATION }
|
||||
validates :duree_conservation_dossiers_hors_ds, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||
validates_with MonAvisEmbedValidator
|
||||
|
||||
FILE_MAX_SIZE = 20.megabytes
|
||||
|
|
|
@ -2,18 +2,12 @@
|
|||
- if traitements.any?
|
||||
%ul.tab-list
|
||||
- traitements.each do |traitement|
|
||||
- if traitement.instructeur_email.present?
|
||||
%li
|
||||
= "Le #{l(traitement.processed_at, format: '%d %B %Y à %R')}, "
|
||||
= traitement.instructeur_email
|
||||
a
|
||||
%strong= t(traitement.state, scope: 'activerecord.attributes.traitement.state').downcase
|
||||
ce dossier
|
||||
- else
|
||||
%li
|
||||
= "Le #{l(traitement.processed_at, format: '%d %B %Y à %R')}, "
|
||||
ce dossier a été
|
||||
%strong= t(traitement.state, scope: 'activerecord.attributes.traitement.state').downcase
|
||||
%li
|
||||
- processed_at = l(traitement.processed_at, format: '%d %B %Y à %R')
|
||||
- if traitement.instructeur_email.present?
|
||||
= t(".with_email.#{traitement.state}", processed_at: processed_at, email: traitement.instructeur_email)
|
||||
- else
|
||||
= t(".without_email.#{traitement.state}", processed_at: processed_at)
|
||||
- else
|
||||
%p.tab-paragraph Aucune décision n’a été rendue
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#profil-page.container
|
||||
%h1 Profil
|
||||
|
||||
- if @waiting_merge_emails&.any?
|
||||
- if @waiting_merge_emails.present?
|
||||
.card
|
||||
.card-title Demande de fusion de comptes
|
||||
%p
|
||||
|
@ -37,7 +37,7 @@
|
|||
application_name: APPLICATION_NAME,
|
||||
legit_admin_domains: LEGIT_ADMIN_DOMAINS.join(', '))
|
||||
|
||||
= form_for @current_user, url: update_email_path, method: :patch, html: { class: 'form' } do |f|
|
||||
= form_for current_user, url: update_email_path, method: :patch, html: { class: 'form' } do |f|
|
||||
= f.email_field :email, value: nil, placeholder: 'Nouvelle adresse email', required: true
|
||||
= f.submit "Changer mon adresse", class: 'button primary'
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
= email_field_tag :next_owner, nil, required: true
|
||||
= submit_tag "Transférer tous mes dossiers", class: 'button primary', data: { confirm: t('.transfer_confirmation') }
|
||||
|
||||
- if @waiting_transfers.any?
|
||||
- if @waiting_transfers.present?
|
||||
.card.warning
|
||||
.card-title= t('.waiting_transfers')
|
||||
%ul
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue