Merge pull request #1509 from tchak/fix-siret-dossier
Fix create dossier with siret
This commit is contained in:
commit
e05b7647cf
3 changed files with 12 additions and 3 deletions
|
@ -107,11 +107,17 @@ 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?
|
||||||
|
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)
|
@facade.dossier.mandataire_social!(current_user.france_connect_information)
|
||||||
else
|
else
|
||||||
return errors_valid_siret
|
return errors_valid_siret
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return errors_valid_siret
|
||||||
|
end
|
||||||
|
|
||||||
@facade = facade params[:dossier_id]
|
@facade = facade params[:dossier_id]
|
||||||
|
|
||||||
|
|
|
@ -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