simply deal with multiple agent_connect_information by taking the last used
This commit is contained in:
parent
ca17524559
commit
df0298ac42
3 changed files with 7 additions and 3 deletions
|
@ -56,7 +56,7 @@ class RecoveriesController < ApplicationController
|
|||
private
|
||||
|
||||
def nature_params = params[:nature]
|
||||
def siret = current_instructeur.agent_connect_information.siret
|
||||
def siret = current_instructeur.last_agent_connect_information.siret
|
||||
def previous_email = params[:previous_email]
|
||||
def procedure_ids = params[:procedure_ids].map(&:to_i)
|
||||
|
||||
|
@ -70,7 +70,7 @@ class RecoveriesController < ApplicationController
|
|||
end
|
||||
|
||||
def ensure_agent_connect_is_used
|
||||
if current_instructeur&.agent_connect_information.nil?
|
||||
if current_instructeur&.last_agent_connect_information.nil?
|
||||
redirect_to support_recovery_path(error: :must_use_agent_connect)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -298,6 +298,10 @@ class Instructeur < ApplicationRecord
|
|||
.update_all(claimant_id: id)
|
||||
end
|
||||
|
||||
def last_agent_connect_information
|
||||
agent_connect_information.order(updated_at: :desc).first
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
%h2 Identification du propriétaire des dossiers
|
||||
|
||||
%p Votre organisation est « #{@structure_name} » identifiée par le SIRET #{current_instructeur.agent_connect_information.siret}
|
||||
%p Votre organisation est « #{@structure_name} » identifiée par le SIRET #{current_instructeur.last_agent_connect_information.siret}
|
||||
= form_with do |f|
|
||||
.fr-input-group
|
||||
%label.fr-label{ for: "email" }
|
||||
|
|
Loading…
Reference in a new issue