Merge pull request #10590 from colinux/cojo-with-dash

ETQ usager, je peux saisir le numéro d'accréditation COJO avec le suffixe `-01`
This commit is contained in:
Colin Darie 2024-07-09 11:08:53 +00:00 committed by GitHub
commit 6b5aa697cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -50,7 +50,7 @@ class Champs::COJOChamp < Champ
def update_external_id
if accreditation_number_changed? || accreditation_birthdate_changed?
if accreditation_number.present? && accreditation_birthdate.present? && /\A\d+\z/.match?(accreditation_number)
if accreditation_number.present? && accreditation_birthdate.present? && /\A[\d-]+\z/.match?(accreditation_number)
self.external_id = { accreditation_number:, accreditation_birthdate: }.to_json
else
self.external_id = nil