Bug 22594

Summary: Validate SMS messaging numbers using the E.164 format
Product: Koha Reporter: Kyle M Hall <kyle>
Component: PatronsAssignee: Kyle M Hall <kyle>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: enhancement    
Priority: P5 - low CC: dcook, gmcharlt, jesse, josef.moravec, kyle.m.hall, lari.taskula, lisettepalouse+koha, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14620
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Adds validation to the SMS number field that conforms to international standards and adds a hint: "SMS number should be in the format 1234567890 or +11234567890" on both the OPAC and Intranet.
Version(s) released in:
19.05.00
Bug Depends on:    
Bug Blocks: 22862, 26285    
Attachments: Bug 22594 - Validate SMS messaging numbers using the E.164 format
Bug 22594 - Validate SMS messaging numbers using the E.164 format
Bug 22594: Validate SMS messaging numbers using the E.164 format
Bug 22594: Validate SMS messaging numbers using the E.164 format

Description Kyle M Hall 2019-03-27 13:50:59 UTC
Many SMS messaging services reject numbers that do not conform to the E.164 international public telecommunication numbering plan. On the OPAC we already 

We already tell patrons on the OPAC "Please enter numbers only. (123) 456-7890 would be entered as 1234567890." but we do not enforce this. We should be validating the patron's SMS number on both the staff side and the patron self-service for updating the SMS number.
Comment 1 Kyle M Hall 2019-03-27 13:56:13 UTC
Created attachment 87068 [details] [review]
Bug 22594 - Validate SMS messaging numbers using the E.164 format

Many SMS messaging services reject numbers that do not conform to the E.164 international public telecommunication
numbering plan.

We already tell patrons on the OPAC "Please enter numbers only. (123) 456-7890 would be entered as 1234567890."
but we do not enforce this. We should be validating the patron's SMS number on both the staff side and the patron
self-service for updating the SMS number.

Test plan:
1) Apply this patch
2) Enable SMS message ( you can set to Email to enable )
3) Test entering and updating SMS numbers on the OPAC and staff
   interfaces.
4) Note you can only enter a 1 to 14 digit number with an optional + sign
   at the beginning ( used to indicate the number includes a country calling code )
Comment 2 Kyle M Hall 2019-03-27 14:08:32 UTC
*** Bug 21623 has been marked as a duplicate of this bug. ***
Comment 3 Owen Leonard 2019-03-27 14:16:24 UTC
This looks like it's working well but I think the staff client deserves a friendly hint like the OPAC has. Nobody knows what "E.164 format" means. What about adding this:


<div class="hint">SMS number should be in the format 1234567890 or +1234567890</div>

...And changing the validator message to simply "Please enter a valid phone number."
Comment 4 Kyle M Hall 2019-03-27 14:50:32 UTC
Created attachment 87073 [details] [review]
Bug 22594 - Validate SMS messaging numbers using the E.164 format

Many SMS messaging services reject numbers that do not conform to the E.164 international public telecommunication
numbering plan.

We already tell patrons on the OPAC "Please enter numbers only. (123) 456-7890 would be entered as 1234567890."
but we do not enforce this. We should be validating the patron's SMS number on both the staff side and the patron
self-service for updating the SMS number.

Test plan:
1) Apply this patch
2) Enable SMS message ( you can set to Email to enable )
3) Test entering and updating SMS numbers on the OPAC and staff
   interfaces.
4) Note you can only enter a 1 to 14 digit number with an optional + sign
   at the beginning ( used to indicate the number includes a country calling code )
Comment 5 Liz Rea 2019-03-27 21:09:07 UTC
Created attachment 87122 [details] [review]
Bug 22594:  Validate SMS messaging numbers using the E.164 format

Many SMS messaging services reject numbers that do not conform to the E.164 international public telecommunication
numbering plan.

We already tell patrons on the OPAC "Please enter numbers only. (123) 456-7890 would be entered as 1234567890."
but we do not enforce this. We should be validating the patron's SMS number on both the staff side and the patron
self-service for updating the SMS number.

Test plan:
1) Apply this patch
2) Enable SMS message ( you can set to Email to enable )
3) Test entering and updating SMS numbers on the OPAC and staff
   interfaces.
4) Note you can only enter a 1 to 14 digit number with an optional + sign
   at the beginning ( used to indicate the number includes a country calling code )

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 6 Josef Moravec 2019-04-01 15:51:28 UTC
Created attachment 87287 [details] [review]
Bug 22594: Validate SMS messaging numbers using the E.164 format

Many SMS messaging services reject numbers that do not conform to the E.164 international public telecommunication
numbering plan.

We already tell patrons on the OPAC "Please enter numbers only. (123) 456-7890 would be entered as 1234567890."
but we do not enforce this. We should be validating the patron's SMS number on both the staff side and the patron
self-service for updating the SMS number.

Test plan:
1) Apply this patch
2) Enable SMS message ( you can set to Email to enable )
3) Test entering and updating SMS numbers on the OPAC and staff
   interfaces.
4) Note you can only enter a 1 to 14 digit number with an optional + sign
   at the beginning ( used to indicate the number includes a country calling code )

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Nick Clemens 2019-04-12 12:59:43 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-04-25 13:17:18 UTC
Enhancement will not be backported to 18.11.x series.
Comment 9 David Cook 2020-08-24 00:50:25 UTC
Unfortunately, this doesn't seem to closely follow E.164, and it actually breaks validation for any Australian phone number that doesn't have a country code (e.g. 02 5555 5555), since this patch doesn't let a phone number start with a 0.
Comment 10 David Cook 2020-08-24 07:00:12 UTC
(In reply to David Cook from comment #9)
> Unfortunately, this doesn't seem to closely follow E.164, and it actually
> breaks validation for any Australian phone number that doesn't have a
> country code (e.g. 02 5555 5555), since this patch doesn't let a phone
> number start with a 0.

Patch ready on Bug 26285.