Bugzilla – Attachment 84805 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), 2.92 KB, created by
Maryse Simard
on 2019-02-05 23:53:15 UTC
(
hide
)
Description:
Bug 8000: (QA follow-up) Add email validation to system preferences
Filename:
MIME Type:
Creator:
Maryse Simard
Created:
2019-02-05 23:53:15 UTC
Size:
2.92 KB
patch
obsolete
>From 24b73176eec956a1eea8e78ea34743502bf41235 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 > >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. >--- > .../prog/en/modules/admin/preferences.tt | 1 + > .../intranet-tmpl/prog/js/pages/preferences.js | 25 ++++++++++++++++++++++ > 2 files changed, 26 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 4d24de3..2c87f64 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -197,6 +197,7 @@ > var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" ); > var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" ); > var MSG_LOADING = _( "Loading..." ); >+ 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 f7ed5e1..8b593ec 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -2,6 +2,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 >@@ -143,4 +148,24 @@ $( document ).ready( function () { > if ( search_jumped ) { > document.location.hash = "jumped"; > } >+ >+ $(".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.7.4
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