Merge pull request #7827 from E-L-T/7807-fix-etq-admin-ne-pas-activer-routage-sans-groupe

7807 fix améliore la validation sur le libellé de routage
This commit is contained in:
Eric Leroy-Terquem 2022-10-10 10:06:17 +02:00 committed by GitHub
commit 8f2d0168e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -191,10 +191,12 @@ module Administrateurs
end
def update_routing_criteria_name
procedure.update!(routing_criteria_name: routing_criteria_name)
redirect_to admin_procedure_groupe_instructeurs_path(procedure),
notice: "Le libellé est maintenant « #{procedure.routing_criteria_name} »."
if procedure.update(routing_criteria_name: routing_criteria_name)
flash[:notice] = "Le libellé est maintenant « #{procedure.routing_criteria_name} »."
else
flash[:alert] = "Le libellé du routage doit être rempli."
end
redirect_to admin_procedure_groupe_instructeurs_path(procedure)
end
def update_routing_enabled

View file

@ -323,6 +323,7 @@ class Procedure < ApplicationRecord
validates :api_entreprise_token, jwt_token: true, allow_blank: true
validates :api_particulier_token, format: { with: /\A[A-Za-z0-9\-_=.]{15,}\z/ }, allow_blank: true
validates :routing_criteria_name, presence: true, allow_blank: false
before_save :update_juridique_required
after_initialize :ensure_path_exists