add SIRETService

This commit is contained in:
Paul Chavard 2018-02-22 16:53:29 +01:00
parent da14cceadc
commit 896518f3d5
8 changed files with 68 additions and 64 deletions

View file

@ -4,6 +4,9 @@ class Etablissement < ActiveRecord::Base
has_many :exercices, dependent: :destroy
accepts_nested_attributes_for :exercices
accepts_nested_attributes_for :entreprise
validates_uniqueness_of :dossier_id
def geo_adresse
@ -14,4 +17,14 @@ class Etablissement < ActiveRecord::Base
# squeeze needed because of space in excess in the data
"#{numero_voie} #{type_voie} #{nom_voie}, #{complement_adresse}, #{code_postal} #{localite}".squeeze(' ')
end
attr_accessor :entreprise_mandataires_sociaux
def mandataire_social?(france_connect_information)
if france_connect_information.present?
entreprise_mandataires_sociaux&.find do |mandataire|
france_connect_information.mandataire_social?(mandataire)
end
end
end
end