From 1b20e4efac59e9374abd2746eb0419938ca4fc4f Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Thu, 15 Nov 2018 11:43:30 -0500 Subject: [PATCH] LP1755625: Multiple emails in patron editor Even though the HTML5 "email" input type allows multiple addresses to be separated by commas there is nothing that can be done to signal to Angular.js that this is ok; it will only ever accept a single address. This patch forces the type of the input tag to plain text so Angular will rely on any supplied regex to verify the entry. The ui.patron.edit.au.email.regex (Regex for email field on patron registration) library setting can be used to control whether one or multiple email addresses will be permitted on the patron registration form. To allow multiple addresses, that setting can be: ^(?:(?:\b[^@,\s]+@[^@,\s]+\.[^@.,\s]+\b)(?:,\s?(?!$)|$))*$ To allow only a single address, use: ^(?:\b[^@,\s]+@[^@,\s]+\.[^@.,\s]+\b)$ To test ------- [1] In the web staff client, try to register a new patron, entering multiple email addresseses in the email field separated by commas. [2] Note that the email field displays as invalid and the record cannot be saved. [3] Apply the patch and repeat step #1, This time, the email field should accept multiple addresses. [4] Set the Regex for email field on patron registration library setting to the multiple-email form listed above. Reload the patron registration form and verify that it will continue to accept multiple email addresses but will not accept entry that doesn't look like an email address. [5] Set the library setting to the single-address value. Reload the patron registration form; this time it should accept a valid email address but not multiple ones. Signed-off-by: Jason Boyer Signed-off-by: Galen Charlton Signed-off-by: Cesar Velez --- Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index 3a502a74d8..3f95036ce6 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -113,7 +113,9 @@ MACRO draw_form_input(cls, field, path, type, disable) BLOCK; %]