Bug 30026: SMSAlert regex fixed for international
authorFlorian Bontemps <florian.bontemps@biblibre.com>
Fri, 4 Feb 2022 15:40:33 +0000 (15:40 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 6 Jun 2022 16:54:00 +0000 (13:54 -0300)
commit3dc883a1cc493a1208b16782f9b43a318de43ce8
tree2b63a60c70f3b52f6c6e53c5a12ea86c7bfe08dc
parent4d16ca1069760f32df4c8bb8267fd24e21f812aa
Bug 30026: SMSAlert regex fixed for international

When registering a phone number for SMS alerts, the number goes through
a regex filter to make sure the number is valid. One of the formats used
in Europe is 00 AAA XXXXXXXXX (A = country indicator) and it is not
supported.

This patch adjusts the regex to either accept 00 AAA XXXXXXXXX or
+AAAXXXXXXXXX in this case. (Note : +AAA and 00AAA are mutually exclusive).

To test:
1) You need to have installed a SMSAlert plugin. Make sure the
   SMSSendDriver syspref is also set up with your SMS plugin of choice.
2) Pick a patron and edit its profile.
3) In the messaging preferences fieldset, under SMS number, enter any
   number with the format 00 AAA XXXXXXXXX (ie : 00111123456789).
   Try to save the modification : you should have an error message.
4) Try instead a number with the format +AAAXXXXXXXXX (ie :
   111123456789), that one should be accepted.
5) Save your modification then check that the number has been changed.
6) Apply patch.
7) Repeat step 3 to 5.
8) Observe the error is gone.
9) Try it once more with the format +00 AAA XXXXXXXXX (+00111123456789),
   that format should not be accepted: this is intentional.
10) Sign off.

    Thanks-to: Didier Gautheron <didier.gautheron@biblibre.com>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/js/members.js