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)
|
etablissement_attributes = SIRETService.fetch(siret, @facade.dossier)
|
||||||
|
|
||||||
if etablissement_attributes.present? && @facade.dossier.create_etablissement(etablissement_attributes)
|
if etablissement_attributes.present?
|
||||||
@facade.dossier.mandataire_social!(current_user.france_connect_information)
|
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
|
else
|
||||||
return errors_valid_siret
|
return errors_valid_siret
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class SIADE::EtablissementAdapter
|
||||||
|
|
||||||
def success?
|
def success?
|
||||||
data_source
|
data_source
|
||||||
rescue => e
|
rescue
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@ class SIADE::RNAAdapter
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_params
|
def to_params
|
||||||
|
if data_source[:association][:id].nil?
|
||||||
|
return nil
|
||||||
|
end
|
||||||
params = data_source[:association].slice(*attr_to_fetch)
|
params = data_source[:association].slice(*attr_to_fetch)
|
||||||
params[:rna] = data_source[:association][:id]
|
params[:rna] = data_source[:association][:id]
|
||||||
params
|
params
|
||||||
|
|
Loading…
Reference in a new issue