commit
696f3cd8f9
26 changed files with 186 additions and 62 deletions
|
@ -16,7 +16,10 @@ class Admin::InstructeursController < AdminController
|
||||||
array: true
|
array: true
|
||||||
|
|
||||||
not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids)
|
not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids)
|
||||||
not_assign_scope = not_assign_scope.where("email LIKE ?", "%#{params[:filter]}%") if params[:filter]
|
|
||||||
|
if params[:filter]
|
||||||
|
not_assign_scope = not_assign_scope.where("email LIKE ?", "%#{params[:filter]}%")
|
||||||
|
end
|
||||||
|
|
||||||
@instructeurs_not_assign = smart_listing_create :instructeurs_not_assign,
|
@instructeurs_not_assign = smart_listing_create :instructeurs_not_assign,
|
||||||
not_assign_scope,
|
not_assign_scope,
|
||||||
|
|
|
@ -55,7 +55,9 @@ class Admin::ProceduresController < AdminController
|
||||||
def destroy
|
def destroy
|
||||||
procedure = current_administrateur.procedures.find(params[:id])
|
procedure = current_administrateur.procedures.find(params[:id])
|
||||||
|
|
||||||
return render json: {}, status: 401 if procedure.publiee_ou_archivee?
|
if procedure.publiee_ou_archivee?
|
||||||
|
return render json: {}, status: 401
|
||||||
|
end
|
||||||
|
|
||||||
procedure.destroy
|
procedure.destroy
|
||||||
|
|
||||||
|
@ -72,7 +74,11 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@procedure = Procedure.new(procedure_params)
|
@procedure = Procedure.new(procedure_params)
|
||||||
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid?
|
|
||||||
|
if @procedure.valid?
|
||||||
|
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params)
|
||||||
|
end
|
||||||
|
|
||||||
@path = params.require(:procedure).permit(:path)[:path]
|
@path = params.require(:procedure).permit(:path)[:path]
|
||||||
@available = !ProcedurePath.exists?(path: @path)
|
@available = !ProcedurePath.exists?(path: @path)
|
||||||
@mine = ProcedurePath.mine?(current_administrateur, @path)
|
@mine = ProcedurePath.mine?(current_administrateur, @path)
|
||||||
|
|
|
@ -5,7 +5,10 @@ class Administrations::SessionsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
sign_out :administration if administration_signed_in?
|
if administration_signed_in?
|
||||||
|
sign_out :administration
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
class CommentairesController < ApplicationController
|
class CommentairesController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@commentaire = Commentaire.new
|
@commentaire = Commentaire.new
|
||||||
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id]
|
|
||||||
|
if params[:champ_id]
|
||||||
|
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id])
|
||||||
|
end
|
||||||
|
|
||||||
dossier_id = params['dossier_id']
|
dossier_id = params['dossier_id']
|
||||||
@commentaire.email = current_user.email
|
@commentaire.email = current_user.email
|
||||||
|
|
|
@ -36,9 +36,17 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def connect_france_connect_particulier(user)
|
def connect_france_connect_particulier(user)
|
||||||
sign_out :user if user_signed_in?
|
if user_signed_in?
|
||||||
sign_out :gestionnaire if gestionnaire_signed_in?
|
sign_out :user
|
||||||
sign_out :administrateur if administrateur_signed_in?
|
end
|
||||||
|
|
||||||
|
if gestionnaire_signed_in?
|
||||||
|
sign_out :gestionnaire
|
||||||
|
end
|
||||||
|
|
||||||
|
if administrateur_signed_in?
|
||||||
|
sign_out :administrateur
|
||||||
|
end
|
||||||
|
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,20 @@ class Gestionnaires::PasswordsController < Devise::PasswordsController
|
||||||
def try_to_authenticate_user
|
def try_to_authenticate_user
|
||||||
if gestionnaire_signed_in?
|
if gestionnaire_signed_in?
|
||||||
user = User.find_by(email: current_gestionnaire.email)
|
user = User.find_by(email: current_gestionnaire.email)
|
||||||
sign_in user if user
|
|
||||||
|
if user
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_to_authenticate_administrateur
|
def try_to_authenticate_administrateur
|
||||||
if gestionnaire_signed_in?
|
if gestionnaire_signed_in?
|
||||||
administrateur = Administrateur.find_by(email: current_gestionnaire.email)
|
administrateur = Administrateur.find_by(email: current_gestionnaire.email)
|
||||||
sign_in administrateur if administrateur
|
|
||||||
|
if administrateur
|
||||||
|
sign_in administrateur
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -131,7 +131,10 @@ module NewGestionnaire
|
||||||
|
|
||||||
def position
|
def position
|
||||||
etablissement = dossier.etablissement
|
etablissement = dossier.etablissement
|
||||||
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) if etablissement.present?
|
|
||||||
|
if etablissement.present?
|
||||||
|
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse)
|
||||||
|
end
|
||||||
|
|
||||||
lon = "2.428462"
|
lon = "2.428462"
|
||||||
lat = "46.538192"
|
lat = "46.538192"
|
||||||
|
|
|
@ -2,9 +2,20 @@ class Sessions::SessionsController < Devise::SessionsController
|
||||||
before_action :before_sign_in, only: [:create]
|
before_action :before_sign_in, only: [:create]
|
||||||
|
|
||||||
def before_sign_in
|
def before_sign_in
|
||||||
sign_out :user if user_signed_in?
|
if user_signed_in?
|
||||||
sign_out :gestionnaire if gestionnaire_signed_in?
|
sign_out :user
|
||||||
sign_out :administrateur if administrateur_signed_in?
|
end
|
||||||
sign_out :administration if administration_signed_in?
|
|
||||||
|
if gestionnaire_signed_in?
|
||||||
|
sign_out :gestionnaire
|
||||||
|
end
|
||||||
|
|
||||||
|
if administrateur_signed_in?
|
||||||
|
sign_out :administrateur
|
||||||
|
end
|
||||||
|
|
||||||
|
if administration_signed_in?
|
||||||
|
sign_out :administration
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,7 +35,9 @@ class Users::CarteController < UsersController
|
||||||
etablissement = nil
|
etablissement = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) if etablissement.present?
|
if etablissement.present?
|
||||||
|
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse)
|
||||||
|
end
|
||||||
|
|
||||||
lon = '2.428462'
|
lon = '2.428462'
|
||||||
lat = '46.538192'
|
lat = '46.538192'
|
||||||
|
|
|
@ -2,7 +2,10 @@ class Users::DescriptionController < UsersController
|
||||||
def pieces_justificatives
|
def pieces_justificatives
|
||||||
invite = current_user.invite? params[:dossier_id]
|
invite = current_user.invite? params[:dossier_id]
|
||||||
|
|
||||||
@dossier ||= Dossier.find(params[:dossier_id]) if invite
|
if invite
|
||||||
|
@dossier ||= Dossier.find(params[:dossier_id])
|
||||||
|
end
|
||||||
|
|
||||||
@dossier ||= current_user_dossier
|
@dossier ||= current_user_dossier
|
||||||
|
|
||||||
if (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).present?
|
if (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).present?
|
||||||
|
@ -13,10 +16,14 @@ class Users::DescriptionController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
|
if flash.alert.nil?
|
||||||
|
flash.notice = 'Nouveaux fichiers envoyés'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return redirect_to users_dossiers_invite_path(id: current_user.invites.find_by(dossier_id: @dossier.id).id) if invite
|
if invite
|
||||||
|
return redirect_to users_dossiers_invite_path(id: current_user.invites.find_by(dossier_id: @dossier.id).id)
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to users_dossier_recapitulatif_path
|
redirect_to users_dossier_recapitulatif_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,10 +2,13 @@ class Users::Dossiers::AddSiretController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@facade = DossierFacades.new params[:dossier_id], current_user.email
|
@facade = DossierFacades.new params[:dossier_id], current_user.email
|
||||||
|
|
||||||
raise ActiveRecord::RecordNotFound if !@facade.procedure.individual_with_siret?
|
if !@facade.procedure.individual_with_siret?
|
||||||
|
raise ActiveRecord::RecordNotFound
|
||||||
@siret = current_user.siret if current_user.siret.present?
|
end
|
||||||
|
|
||||||
|
if current_user.siret.present?
|
||||||
|
@siret = current_user.siret
|
||||||
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
flash.alert = t('errors.messages.dossier_not_found')
|
||||||
redirect_to url_for dossiers_path
|
redirect_to url_for dossiers_path
|
||||||
|
|
|
@ -54,7 +54,9 @@ class Users::DossiersController < UsersController
|
||||||
dossier = Dossier.create!(procedure: procedure, user: current_user, state: Dossier.states.fetch(:brouillon))
|
dossier = Dossier.create!(procedure: procedure, user: current_user, state: Dossier.states.fetch(:brouillon))
|
||||||
siret = params[:siret] || current_user.siret
|
siret = params[:siret] || current_user.siret
|
||||||
|
|
||||||
update_current_user_siret! siret if siret.present?
|
if siret.present?
|
||||||
|
update_current_user_siret! siret
|
||||||
|
end
|
||||||
|
|
||||||
if dossier.procedure.for_individual
|
if dossier.procedure.for_individual
|
||||||
redirect_to identite_dossier_path(dossier)
|
redirect_to identite_dossier_path(dossier)
|
||||||
|
@ -67,7 +69,9 @@ class Users::DossiersController < UsersController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@facade = facade
|
@facade = facade
|
||||||
@siret = current_user.siret if current_user.siret.present?
|
if current_user.siret.present?
|
||||||
|
@siret = current_user.siret
|
||||||
|
end
|
||||||
|
|
||||||
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
|
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
|
||||||
individual = @facade.dossier.individual
|
individual = @facade.dossier.individual
|
||||||
|
@ -165,7 +169,9 @@ class Users::DossiersController < UsersController
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_siret
|
def check_siret
|
||||||
errors_valid_siret if !Siret.new(siret: siret).valid?
|
if !Siret.new(siret: siret).valid?
|
||||||
|
errors_valid_siret
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def errors_valid_siret
|
def errors_valid_siret
|
||||||
|
|
|
@ -36,14 +36,20 @@ class Users::PasswordsController < Devise::PasswordsController
|
||||||
def try_to_authenticate_gestionnaire
|
def try_to_authenticate_gestionnaire
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
gestionnaire = Gestionnaire.find_by(email: current_user.email)
|
gestionnaire = Gestionnaire.find_by(email: current_user.email)
|
||||||
sign_in gestionnaire if gestionnaire
|
|
||||||
|
if gestionnaire
|
||||||
|
sign_in gestionnaire
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_to_authenticate_administrateur
|
def try_to_authenticate_administrateur
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
administrateur = Administrateur.find_by(email: current_user.email)
|
administrateur = Administrateur.find_by(email: current_user.email)
|
||||||
sign_in administrateur if administrateur
|
|
||||||
|
if administrateur
|
||||||
|
sign_in administrateur
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,10 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
# Allow pre-filling the user email from a query parameter
|
# Allow pre-filling the user email from a query parameter
|
||||||
build_resource({ email: sign_up_params[:email] })
|
build_resource({ email: sign_up_params[:email] })
|
||||||
|
|
||||||
yield resource if block_given?
|
if block_given?
|
||||||
|
yield resource
|
||||||
|
end
|
||||||
|
|
||||||
respond_with resource
|
respond_with resource
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,13 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
|
|
||||||
# DELETE /resource/sign_out
|
# DELETE /resource/sign_out
|
||||||
def destroy
|
def destroy
|
||||||
sign_out :gestionnaire if gestionnaire_signed_in?
|
if gestionnaire_signed_in?
|
||||||
sign_out :administrateur if administrateur_signed_in?
|
sign_out :gestionnaire
|
||||||
|
end
|
||||||
|
|
||||||
|
if administrateur_signed_in?
|
||||||
|
sign_out :administrateur
|
||||||
|
end
|
||||||
|
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
connected_with_france_connect = current_user.loged_in_with_france_connect
|
connected_with_france_connect = current_user.loged_in_with_france_connect
|
||||||
|
@ -72,7 +77,9 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_return_to_procedure_id
|
def user_return_to_procedure_id
|
||||||
return nil if session["user_return_to"].nil?
|
if session["user_return_to"].nil?
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
NumberService.to_number session["user_return_to"].split("?procedure_id=").second
|
NumberService.to_number session["user_return_to"].split("?procedure_id=").second
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,8 @@ class ChampDecorator < Draper::Decorator
|
||||||
end
|
end
|
||||||
|
|
||||||
def description_with_links
|
def description_with_links
|
||||||
description.gsub(URI.regexp, '<a target="_blank" href="\0">\0</a>') if description
|
if description
|
||||||
|
description.gsub(URI.regexp, '<a target="_blank" href="\0">\0</a>')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
class TypeDePieceJustificativeDecorator < Draper::Decorator
|
class TypeDePieceJustificativeDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
def button_up(params)
|
def button_up(params)
|
||||||
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post if display_up_button?(params[:index])
|
if display_up_button?(params[:index])
|
||||||
|
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def button_down(params)
|
def button_down(params)
|
||||||
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post if display_down_button?(params[:index])
|
if display_down_button?(params[:index])
|
||||||
|
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -10,9 +10,15 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
range = options.delete(:in) || options.delete(:within)
|
range = options.delete(:in) || options.delete(:within)
|
||||||
|
|
||||||
if range.present?
|
if range.present?
|
||||||
raise ArgumentError, ":in and :within must be a Range" if !range.is_a?(Range)
|
if !range.is_a?(Range)
|
||||||
|
raise ArgumentError, ":in and :within must be a Range"
|
||||||
|
end
|
||||||
|
|
||||||
options[:minimum], options[:maximum] = range.begin, range.end
|
options[:minimum], options[:maximum] = range.begin, range.end
|
||||||
options[:maximum] -= 1 if range.exclude_end?
|
|
||||||
|
if range.exclude_end?
|
||||||
|
options[:maximum] -= 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
|
@ -35,12 +41,18 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_each(record, attribute, value)
|
def validate_each(record, attribute, value)
|
||||||
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") if !value.kind_of? CarrierWave::Uploader::Base
|
if !value.kind_of? CarrierWave::Uploader::Base
|
||||||
|
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected")
|
||||||
|
end
|
||||||
|
|
||||||
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
|
if value.kind_of?(String)
|
||||||
|
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value)
|
||||||
|
end
|
||||||
|
|
||||||
CHECKS.each do |key, validity_check|
|
CHECKS.each do |key, validity_check|
|
||||||
next if !check_value = options[key]
|
if !check_value = options[key]
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
check_value =
|
check_value =
|
||||||
case check_value
|
case check_value
|
||||||
|
@ -50,16 +62,22 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
record.send(check_value)
|
record.send(check_value)
|
||||||
end
|
end
|
||||||
|
|
||||||
value ||= [] if key == :maximum
|
if key == :maximum
|
||||||
|
value ||= []
|
||||||
|
end
|
||||||
|
|
||||||
value_size = value.size
|
value_size = value.size
|
||||||
next if value_size.send(validity_check, check_value)
|
if value_size.send(validity_check, check_value)
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
errors_options = options.except(*RESERVED_OPTIONS)
|
errors_options = options.except(*RESERVED_OPTIONS)
|
||||||
errors_options[:file_size] = help.number_to_human_size check_value
|
errors_options[:file_size] = help.number_to_human_size check_value
|
||||||
|
|
||||||
default_message = options[MESSAGES[key]]
|
default_message = options[MESSAGES[key]]
|
||||||
errors_options[:message] ||= default_message if default_message
|
if default_message
|
||||||
|
errors_options[:message] ||= default_message
|
||||||
|
end
|
||||||
|
|
||||||
record.errors.add(attribute, MESSAGES[key], errors_options)
|
record.errors.add(attribute, MESSAGES[key], errors_options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,9 @@ class Gestionnaire < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow(dossier)
|
def follow(dossier)
|
||||||
return if follow?(dossier)
|
if follow?(dossier)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
followed_dossiers << dossier
|
followed_dossiers << dossier
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,10 +6,15 @@ class ModuleAPICarto < ApplicationRecord
|
||||||
validates :cadastre, presence: true, allow_blank: true, allow_nil: false
|
validates :cadastre, presence: true, allow_blank: true, allow_nil: false
|
||||||
|
|
||||||
def classes
|
def classes
|
||||||
modules = ''
|
modules = ''
|
||||||
|
|
||||||
modules += 'qp ' if quartiers_prioritaires?
|
if quartiers_prioritaires?
|
||||||
modules += 'cadastre ' if cadastre?
|
modules += 'qp '
|
||||||
|
end
|
||||||
|
|
||||||
|
if cadastre?
|
||||||
|
modules += 'cadastre '
|
||||||
|
end
|
||||||
|
|
||||||
modules
|
modules
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,8 @@ class Siret
|
||||||
before_validation :remove_whitespace
|
before_validation :remove_whitespace
|
||||||
|
|
||||||
def remove_whitespace
|
def remove_whitespace
|
||||||
siret.delete!(' ') if siret.present?
|
if siret.present?
|
||||||
|
siret.delete!(' ')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
class ClamavService
|
class ClamavService
|
||||||
def self.safe_file?(file_path)
|
def self.safe_file?(file_path)
|
||||||
if Rails.env == 'development'
|
if Rails.env == 'development'
|
||||||
return CLAMAV[:response] if CLAMAV[:mock?]
|
if CLAMAV[:mock?]
|
||||||
|
return CLAMAV[:response]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.chmod 0666, file_path
|
FileUtils.chmod 0666, file_path
|
||||||
|
@ -9,7 +11,10 @@ class ClamavService
|
||||||
client = ClamAV::Client.new
|
client = ClamAV::Client.new
|
||||||
response = client.execute(ClamAV::Commands::ScanCommand.new(file_path))
|
response = client.execute(ClamAV::Commands::ScanCommand.new(file_path))
|
||||||
|
|
||||||
return false if response.first.class == ClamAV::VirusResponse
|
if response.first.class == ClamAV::VirusResponse
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class NumberService
|
class NumberService
|
||||||
def self.to_number(string)
|
def self.to_number(string)
|
||||||
string.to_s if Float(string) rescue nil
|
string.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,6 +48,8 @@ class PieceJustificativeUploader < BaseUploader
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_original_filename(file)
|
def set_original_filename(file)
|
||||||
model.original_filename ||= file.original_filename if file.respond_to?(:original_filename)
|
if file.respond_to?(:original_filename)
|
||||||
|
model.original_filename ||= file.original_filename
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,12 @@ class ProcedurePathFormatValidator < ActiveModel::Validator
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(record)
|
def validate(record)
|
||||||
return false if record.path.blank?
|
if record.path.blank?
|
||||||
record.errors[:path] << "Path invalide" if !path_regex.match(record.path)
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if !path_regex.match(record.path)
|
||||||
|
record.errors[:path] << "Path invalide"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,15 +18,17 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
|
||||||
add_reference :france_connect_informations, :user, references: :users
|
add_reference :france_connect_informations, :user, references: :users
|
||||||
|
|
||||||
User.all.each do |user|
|
User.all.each do |user|
|
||||||
FranceConnectInformation.create({
|
if user.france_connect_particulier_id.present?
|
||||||
gender: user.gender,
|
FranceConnectInformation.create({
|
||||||
given_name: user.given_name,
|
gender: user.gender,
|
||||||
family_name: user.family_name,
|
given_name: user.given_name,
|
||||||
birthdate: user.birthdate,
|
family_name: user.family_name,
|
||||||
birthplace: user.birthplace,
|
birthdate: user.birthdate,
|
||||||
france_connect_particulier_id: user.france_connect_particulier_id,
|
birthplace: user.birthplace,
|
||||||
user_id: user.id
|
france_connect_particulier_id: user.france_connect_particulier_id,
|
||||||
}) if user.france_connect_particulier_id.present?
|
user_id: user.id
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_column :users, :gender
|
remove_column :users, :gender
|
||||||
|
|
Loading…
Reference in a new issue