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,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]

View file

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

View file

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