Bugzilla – Attachment 88878 Details for
Bug 8000
Test mode for notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8000: (QA follow-up) Add email validation to system preferences
Bug-8000-QA-follow-up-Add-email-validation-to-syst.patch (text/plain), 3.05 KB, created by
Marcel de Rooy
on 2019-04-26 10:21:11 UTC
(
hide
)
Description:
Bug 8000: (QA follow-up) Add email validation to system preferences
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-04-26 10:21:11 UTC
Size:
3.05 KB
patch
obsolete
>From 96f1c3900a748808f3db65fe36c6998c377442c7 Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Tue, 5 Feb 2019 18:26:42 -0500 >Subject: [PATCH] Bug 8000: (QA follow-up) Add email validation to system > preferences >Content-Type: text/plain; charset=utf-8 > >This patch uses the JQuery validator plugin to add validation to preferences of class email in the system preferences page. A field containing an invalid value (even if not modified) should prevent saving. > >To test, confirm that when entering an invalid email address in the SendAllEmailsTo field, an error message appears and saving is prevented. >Correcting the value should hide the message and let you save as normal. > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/admin/preferences.tt | 1 + > .../intranet-tmpl/prog/js/pages/preferences.js | 24 ++++++++++++++++++++++ > 2 files changed, 25 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 54d27fee9a..764f1645d9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -211,6 +211,7 @@ > var MSG_LOADING = _( "Loading..." ); > var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values"); > var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:"); >+ var MSG_INVALID = _( "Error: presence of invalid data prevent saving. Please make the corrections and try again." ); > </script> > [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] > [% Asset.js("js/ajax.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 0fa0238133..d5db030e7b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -3,6 +3,11 @@ > > KOHA.Preferences = { > Save: function ( form ) { >+ if ( ! $(form).valid() ) { >+ humanMsg.displayAlert( MSG_INVALID ); >+ return; >+ } >+ > modified_prefs = $( form ).find( '.modified' ); > // $.serialize removes empty value, we need to keep them. > // If a multiple select has all its entries unselected >@@ -181,4 +186,23 @@ $( document ).ready( function () { > if ( alert_text.length ) alert(alert_text); > }); > >+ $(".prefs-tab form").each(function () { >+ $(this).validate({ >+ rules: { }, >+ errorPlacement: function(error, element) { >+ var placement = $(element).parent(); >+ if (placement) { >+ $(placement).append(error) >+ } else { >+ error.insertAfter(element); >+ } >+ } >+ }); >+ }); >+ >+ $(".preference-email").each(function() { >+ $(this).rules("add", { >+ email: true >+ }); >+ }); > } ); >-- >2.11.0
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 8000
:
21976
|
22315
|
24784
|
25917
|
25919
|
25920
|
25923
|
25924
|
25925
|
25926
|
25927
|
25928
|
25939
|
25950
|
25951
|
26446
|
37463
|
37464
|
37465
|
37466
|
37467
|
37468
|
37469
|
37472
|
37473
|
37474
|
37475
|
37476
|
37477
|
37478
|
37481
|
37482
|
37483
|
37484
|
37485
|
37486
|
37487
|
39985
|
39986
|
39987
|
39988
|
39989
|
39990
|
39991
|
39992
|
40215
|
40216
|
40217
|
40218
|
40219
|
40220
|
40221
|
40222
|
40223
|
40224
|
40225
|
40226
|
40227
|
40228
|
40229
|
40230
|
46354
|
46355
|
46356
|
46357
|
46358
|
46359
|
46360
|
46361
|
46362
|
49991
|
49992
|
49993
|
49998
|
49999
|
50000
|
55940
|
58434
|
62863
|
67155
|
70086
|
70087
|
70484
|
74110
|
74111
|
74848
|
80370
|
81487
|
81488
|
81589
|
81590
|
81591
|
84801
|
84802
|
84803
|
84804
|
84805
|
86861
|
86862
|
86863
|
86864
|
86865
|
88874
|
88875
|
88876
|
88877
| 88878 |
88879