Merge pull request #1509 from tchak/fix-siret-dossier

Fix create dossier with siret
This commit is contained in:
Paul Chavard 2018-02-28 17:25:59 +01:00 committed by GitHub
commit e05b7647cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -9,7 +9,7 @@ class SIADE::EtablissementAdapter
def success?
data_source
rescue => e
rescue
false
end

View file

@ -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