Merge pull request #10158 from demarches-simplifiees/fix-closing-reason-form

Correctif : ETQ admin je ne peux pas fermer une démarche en redirigeant sans choisir la nouvelle démarche
This commit is contained in:
Eric Leroy-Terquem 2024-03-20 13:28:40 +00:00 committed by GitHub
commit 73d6609eb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 52 additions and 12 deletions

View file

@ -226,7 +226,7 @@ class Procedure < ApplicationRecord
enum closing_reason: {
internal_procedure: 'internal_procedure',
other: 'other'
}
}, _prefix: true
scope :for_api_v2, -> {
includes(:draft_revision, :published_revision, administrateurs: :user)
@ -265,8 +265,7 @@ class Procedure < ApplicationRecord
validate :check_juridique, on: [:create, :publication]
# TO DO add validation after data backfill
# validates :replaced_by_id, presence: true, if: -> { closing_reason == self.closing_reasons.fetch(:internal_procedure) }
validates :replaced_by_procedure_id, presence: true, if: :closing_reason_internal_procedure?
validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,200}\z/ }, uniqueness: { scope: [:path, :closed_at, :hidden_at, :unpublished_at], case_sensitive: false }
validates :duree_conservation_dossiers_dans_ds, allow_nil: false,