Fix create dossier with siret
This commit is contained in:
parent
e3ce4c4f8c
commit
94a503a2c4
3 changed files with 12 additions and 3 deletions
|
@ -107,8 +107,14 @@ class Users::DossiersController < UsersController
|
|||
|
||||
etablissement_attributes = SIRETService.fetch(siret, @facade.dossier)
|
||||
|
||||
if etablissement_attributes.present? && @facade.dossier.create_etablissement(etablissement_attributes)
|
||||
@facade.dossier.mandataire_social!(current_user.france_connect_information)
|
||||
if etablissement_attributes.present?
|
||||
etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit!
|
||||
etablissement = @facade.dossier.create_etablissement(etablissement_attributes)
|
||||
if etablissement.save
|
||||
@facade.dossier.mandataire_social!(current_user.france_connect_information)
|
||||
else
|
||||
return errors_valid_siret
|
||||
end
|
||||
else
|
||||
return errors_valid_siret
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class SIADE::EtablissementAdapter
|
|||
|
||||
def success?
|
||||
data_source
|
||||
rescue => e
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ class SIADE::RNAAdapter
|
|||
end
|
||||
|
||||
def to_params
|
||||
if data_source[:association][:id].nil?
|
||||
return nil
|
||||
end
|
||||
params = data_source[:association].slice(*attr_to_fetch)
|
||||
params[:rna] = data_source[:association][:id]
|
||||
params
|
||||
|
|
Loading…
Reference in a new issue