2015-08-10 11:05:06 +02:00
|
|
|
class DossiersController < ApplicationController
|
2015-09-23 19:20:03 +02:00
|
|
|
# def show
|
|
|
|
# @dossier = Dossier.find(params[:id])
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# @etablissement = @dossier.etablissement
|
|
|
|
# @entreprise = @dossier.entreprise.decorate
|
|
|
|
# rescue ActiveRecord::RecordNotFound
|
|
|
|
# flash.alert = t('errors.messages.dossier_not_found')
|
|
|
|
# redirect_to url_for(controller: :siret)
|
|
|
|
# end
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def create
|
|
|
|
# procedure = Procedure.find(params['procedure_id'])
|
|
|
|
# @etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(siret).to_params)
|
|
|
|
# @entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(siren).to_params)
|
|
|
|
# @dossier = Dossier.create
|
|
|
|
# @dossier.draft!
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# @dossier.procedure = procedure
|
|
|
|
# @dossier.save
|
2015-09-21 17:59:03 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# @entreprise.dossier = @dossier
|
|
|
|
# @entreprise.save
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# @etablissement.dossier = @dossier
|
|
|
|
# @etablissement.entreprise = @entreprise
|
|
|
|
# @etablissement.save
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
2015-08-17 15:53:35 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# rescue RestClient::ResourceNotFound
|
|
|
|
# flash.alert = t('errors.messages.invalid_siret')
|
|
|
|
# redirect_to url_for(controller: :siret, procedure_id: params['procedure_id'])
|
|
|
|
# rescue ActiveRecord::RecordNotFound
|
|
|
|
# flash.alert = t('errors.messages.dossier_not_found')
|
|
|
|
# redirect_to url_for(controller: :siret)
|
|
|
|
# end
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def update
|
|
|
|
# @dossier = Dossier.find(params[:id])
|
|
|
|
# if checked_autorisation_donnees?
|
|
|
|
# @dossier.update_attributes(update_params)
|
|
|
|
# redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
|
|
|
# else
|
|
|
|
# @etablissement = @dossier.etablissement
|
|
|
|
# @entreprise = @dossier.entreprise.decorate
|
|
|
|
# flash.now.alert = 'Les conditions sont obligatoires.'
|
|
|
|
# render 'show'
|
|
|
|
# end
|
|
|
|
# end
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# private
|
2015-08-11 15:22:07 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def update_params
|
|
|
|
# params.require(:dossier).permit(:autorisation_donnees)
|
|
|
|
# end
|
2015-08-13 15:55:19 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def dossier_id_is_present?
|
|
|
|
# @dossier_id != ''
|
|
|
|
# end
|
2015-08-11 15:22:07 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def checked_autorisation_donnees?
|
|
|
|
# update_params[:autorisation_donnees] == '1'
|
|
|
|
# end
|
2015-08-11 15:22:07 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def siret
|
|
|
|
# params[:siret]
|
|
|
|
# end
|
2015-08-11 15:22:07 +02:00
|
|
|
|
2015-09-23 19:20:03 +02:00
|
|
|
# def siren
|
|
|
|
# siret[0..8]
|
|
|
|
# end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|