Bugzilla – Attachment 82239 Details for
Bug 21813
In-page JavaScript causes error on patron entry page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21813: In-page JavaScript causes error on patron entry page
Bug-21813-In-page-JavaScript-causes-error-on-patro.patch (text/plain), 6.36 KB, created by
Owen Leonard
on 2018-11-12 18:58:38 UTC
(
hide
)
Description:
Bug 21813: In-page JavaScript causes error on patron entry page
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-11-12 18:58:38 UTC
Size:
6.36 KB
patch
obsolete
>From 251abf6e9861e09db148d5c9767751492ecb8b27 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 12 Nov 2018 17:35:25 +0000 >Subject: [PATCH] Bug 21813: In-page JavaScript causes error on patron entry > page > >This patch removes a block of JavaScript from memberentrygen.tt which >was being included in the page before jQuery is loaded. This causes a >JavaScript error. > >To test, apply the patch and clear your browser cache if necessary. > > - In Administration -> Patron categories, confirm that you have two > patron categories with different default messaging preferences > defined. > - Go to Patrons -> New patron > - Create a new patron using one of the categories with messaging > preferences. > - Confirm that when you switch the category selection to the other > patron category, the patron messaging preference checkboxes are > changed to the default for that category. > - Manually change one or more patron messaging preference checkboxes. > - Switch the patron category again and confirm that you are prompted > to confirm resetting the preferences to the default for that > category. > - Perform the same set of tests when editing a patron. > - Confirm that there are no other JavaScript errors in the console. > - Test again with EnhancedMessagingPreferences disabled. >--- > .../prog/en/modules/members/memberentrygen.tt | 46 ---------------------- > .../prog/js/messaging-preference-form.js | 37 +++++++++++++++++ > 2 files changed, 37 insertions(+), 46 deletions(-) > >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 143af0a..d9df7e8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1083,52 +1083,6 @@ > [% IF ( step_5 ) %][% IF ( EnhancedMessagingPreferences ) %] > <fieldset class="rows" id="memberentry_messaging_prefs"> > <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend> >- [% IF ( opadd ) %] >- <!-- handle changing prefs if creating new patron and changing >- the patron category >- --> >- <script type="text/javascript">//<![CDATA[ >- $(document).ready(function(){ >- var message_prefs_dirty = false; >- $('#memberentry_messaging_prefs > *').change(function() { >- message_prefs_dirty = true; >- }); >- $('#categorycode_entry').change(function() { >- var categorycode = $(this).val(); >- if (message_prefs_dirty) { >- if (!confirm(_("Change messaging preferences to default for this category?"))) { >- return; >- } >- } >- $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, >- function(data) { >- $.each(data.messaging_preferences, function(i, item) { >- var attrid = item.message_attribute_id; >- var transports = ['email', 'rss', 'sms']; >- $.each(transports, function(j, transport) { >- if (item['transports_' + transport] == 1) { >- $('#' + transport + attrid).prop('checked', true); >- } else { >- $('#' + transport + attrid).prop('checked', false); >- } >- }); >- if (item.digest && item.digest != ' ') { >- $('#digest' + attrid).prop('checked', true); >- } else { >- $('#digest' + attrid).prop('checked', false); >- } >- if (item.takes_days == '1') { >- $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); >- } >- }); >- message_prefs_dirty = false; >- } >- ); >- }); >- }); >- //]]> >- </script> >- [% END %] > <input type="hidden" name="setting_messaging_prefs" value="1" /> > [% INCLUDE 'messaging-preference-form.inc' %] > [% IF ( SMSSendDriver ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >index 67a580b..7df1820 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >@@ -17,4 +17,41 @@ $(document).ready(function(){ > } > }); > $("#info_digests").tooltip(); >+ >+ var message_prefs_dirty = false; >+ $('#memberentry_messaging_prefs > *').change(function() { >+ message_prefs_dirty = true; >+ }); >+ $('#categorycode_entry').change(function() { >+ var categorycode = $(this).val(); >+ if (message_prefs_dirty) { >+ if (!confirm(_("Change messaging preferences to default for this category?"))) { >+ return; >+ } >+ } >+ $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, >+ function(data) { >+ $.each(data.messaging_preferences, function(i, item) { >+ var attrid = item.message_attribute_id; >+ var transports = ['email', 'rss', 'sms']; >+ $.each(transports, function(j, transport) { >+ if (item['transports_' + transport] == 1) { >+ $('#' + transport + attrid).prop('checked', true); >+ } else { >+ $('#' + transport + attrid).prop('checked', false); >+ } >+ }); >+ if (item.digest && item.digest != ' ') { >+ $('#digest' + attrid).prop('checked', true); >+ } else { >+ $('#digest' + attrid).prop('checked', false); >+ } >+ if (item.takes_days == '1') { >+ $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); >+ } >+ }); >+ message_prefs_dirty = false; >+ } >+ ); >+ }); > }); >-- >2.1.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 21813
:
82239
|
83632
|
83663
|
83695
|
83703