Bugzilla – Attachment 87073 Details for
Bug 22594
Validate SMS messaging numbers using the E.164 format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22594 - Validate SMS messaging numbers using the E.164 format
Bug-22594---Validate-SMS-messaging-numbers-using-t.patch (text/plain), 4.97 KB, created by
Kyle M Hall (khall)
on 2019-03-27 14:50:32 UTC
(
hide
)
Description:
Bug 22594 - Validate SMS messaging numbers using the E.164 format
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-03-27 14:50:32 UTC
Size:
4.97 KB
patch
obsolete
>From aa9bb2551e8191de3fc89e7dcf5759160e7d9497 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 27 Mar 2019 08:35:27 -0400 >Subject: [PATCH] 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 ) >--- > .../prog/en/includes/validator-strings.inc | 3 ++- > .../prog/en/modules/members/memberentrygen.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/members.js | 12 ++++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-messaging.tt | 2 +- > 4 files changed, 16 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc >index 2ca4430ad7..6368e7b32e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/validator-strings.inc >@@ -16,7 +16,8 @@ $(document).ready(function(){ > rangelength: $.validator.format(_("Please enter a value between {0} and {1} characters long.")), > range: $.validator.format(_("Please enter a value between {0} and {1}.")), > max: $.validator.format(_("Please enter a value less than or equal to {0}.")), >- min: $.validator.format(_("Please enter a value greater than or equal to {0}.")) >+ min: $.validator.format(_("Please enter a value greater than or equal to {0}.")), >+ phone: $.validator.format(_("Please enter a valid phone number.")) > }); > }); > //]]> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 99a0e8e877..54b5beb129 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1096,6 +1096,7 @@ > [% IF ( SMSSendDriver ) %] > <p><label for="SMSnumber">SMS number:</label> > <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" /> >+ <span class="hint">SMS number should be in the format 1234567890 or +11234567890</span> > </p> > [% UNLESS nosms_provider_id %] > <p> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index e586e60d23..cfd3a830d4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -309,6 +309,15 @@ $(document).ready(function(){ > write_age(); > } > >+ $.validator.addMethod( >+ "phone", >+ function(value, element, phone) { >+ var e164 = "^\\+?[1-9]\\d{1,14}$"; >+ var re = new RegExp(e164); >+ return this.optional(element) || re.test(value); >+ }, >+ jQuery.validator.messages.phone); >+ > $("#entryform").validate({ > rules: { > email: { >@@ -326,6 +335,9 @@ $(document).ready(function(){ > }, > password2: { > password_match: true >+ }, >+ SMSnumber: { >+ phone: true, > } > }, > submitHandler: function(form) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >index 7a190c68ae..9f4e6f7908 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -133,7 +133,7 @@ > [% IF ( SMSSendDriver ) %] > <ol><li><label>Notice:</label>Some charges for text messages may be incurred when using this service. Please check with your mobile service provider if you have questions.</li></ol> > <ol><li> >- <label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" /> >+ <label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" pattern="^\+?[1-9]\d{1,14}$" /> > <i>Please enter numbers only. <b>(123) 456-7890</b> would be entered as <b>1234567890</b>.</i> > </li></ol> > [% END %] >-- >2.20.1 (Apple Git-117)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22594
:
87068
|
87073
|
87122
|
87287