Track dossier private annotations modifications
This commit is contained in:
parent
dba8d65137
commit
9c472e6524
3 changed files with 10 additions and 2 deletions
|
@ -136,8 +136,8 @@ module Gestionnaires
|
|||
|
||||
def update_annotations
|
||||
dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id])
|
||||
# FIXME: add attachements validation, cf. Champ#piece_justificative_file_errors
|
||||
dossier.update(champs_private_params)
|
||||
dossier.modifier_annotations!(current_gestionnaire)
|
||||
redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier)
|
||||
end
|
||||
|
||||
|
|
|
@ -366,6 +366,11 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def modifier_annotations!(gestionnaire)
|
||||
champs_private.select(&:value_previously_changed?).each do |champ|
|
||||
log_dossier_operation(gestionnaire, :modifier_annotation, champ)
|
||||
end
|
||||
end
|
||||
private
|
||||
|
||||
def log_dossier_operation(author, operation, subject = nil)
|
||||
|
|
|
@ -5,7 +5,8 @@ class DossierOperationLog < ApplicationRecord
|
|||
accepter: 'accepter',
|
||||
refuser: 'refuser',
|
||||
classer_sans_suite: 'classer_sans_suite',
|
||||
supprimer: 'supprimer'
|
||||
supprimer: 'supprimer',
|
||||
modifier_annotation: 'modifier_annotation',
|
||||
}
|
||||
|
||||
belongs_to :dossier
|
||||
|
@ -59,6 +60,8 @@ class DossierOperationLog < ApplicationRecord
|
|||
case subject
|
||||
when Dossier
|
||||
DossierSerializer.new(subject).as_json
|
||||
when Champ
|
||||
ChampSerializer.new(subject).as_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue