Merge branch 'staging'

This commit is contained in:
Xavier J 2016-11-10 17:27:41 +01:00
commit 91743a7d06
2 changed files with 27 additions and 13 deletions

View file

@ -38,6 +38,15 @@ class Users::DescriptionController < UsersController
return render 'show'
end
unless params[:champs].nil?
champs_service_errors = ChampsService.save_formulaire @dossier.champs, params, mandatory
unless champs_service_errors.empty?
flash.now.alert = (champs_service_errors.inject('') { |acc, error| acc+= error[:message]+'<br>' }).html_safe
return render 'show'
end
end
if @procedure.cerfa_flag?
unless params[:cerfa_pdf].nil?
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
@ -48,15 +57,6 @@ class Users::DescriptionController < UsersController
end
end
unless params[:champs].nil?
champs_service_errors = ChampsService.save_formulaire @dossier.champs, params, mandatory
unless champs_service_errors.empty?
flash.now.alert = (champs_service_errors.inject('') { |acc, error| acc+= error[:message]+'<br>' }).html_safe
return render 'show'
end
end
unless (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?
flash.alert = errors_upload.html_safe
return render 'show'
@ -82,10 +82,24 @@ class Users::DescriptionController < UsersController
@dossier ||= Dossier.find(params[:dossier_id]) if invite
@dossier ||= current_user_dossier
if @dossier.procedure.cerfa_flag?
unless params[:cerfa_pdf].nil?
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
unless cerfa.save
flash.alert = cerfa.errors.full_messages.join('<br />').html_safe
end
end
end
if !((errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?)
flash.alert = errors_upload.html_safe
if flash.alert.nil?
flash.alert = errors_upload.html_safe
else
flash.alert = (flash.alert + '<br />' + errors_upload.html_safe).html_safe
end
else
flash.notice = 'Nouveaux fichiers envoyés'
flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
@dossier.next_step! 'user', 'update'
end

View file

@ -44,11 +44,11 @@ fr:
piece_justificative:
attributes:
content:
size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 3Mo."
size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 6Mo."
cerfa:
attributes:
content:
size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 3Mo."
size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 6Mo."
user:
attributes:
reset_password_token: