Merge branch 'develop' into staging

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

View file

@ -38,6 +38,15 @@ class Users::DescriptionController < UsersController
return render 'show' return render 'show'
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
if @procedure.cerfa_flag? if @procedure.cerfa_flag?
unless params[:cerfa_pdf].nil? unless params[:cerfa_pdf].nil?
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user) cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
@ -48,15 +57,6 @@ class Users::DescriptionController < UsersController
end end
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? unless (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?
flash.alert = errors_upload.html_safe flash.alert = errors_upload.html_safe
return render 'show' return render 'show'
@ -82,10 +82,24 @@ class Users::DescriptionController < UsersController
@dossier ||= Dossier.find(params[:dossier_id]) if invite @dossier ||= Dossier.find(params[:dossier_id]) if invite
@dossier ||= current_user_dossier @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?) 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 else
flash.notice = 'Nouveaux fichiers envoyés' flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
@dossier.next_step! 'user', 'update' @dossier.next_step! 'user', 'update'
end end

View file

@ -44,11 +44,11 @@ fr:
piece_justificative: piece_justificative:
attributes: attributes:
content: 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: cerfa:
attributes: attributes:
content: 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: user:
attributes: attributes:
reset_password_token: reset_password_token: