From e974a4c999b31e206c3a671a44d194c876161385 Mon Sep 17 00:00:00 2001 From: Garry Collum Date: Tue, 2 Aug 2022 19:35:39 +0000 Subject: [PATCH] LP1902272-Bootstrap opac needs to prompt on notification preference update Adds the prompting of updating holds when default notification preferences are updated in the Bootstrap opac. To Test: 1. Place a few holds for a patron. 2. Login to the opac and change some default notification methods. 3. The opac does not prompt to update the holds. 4. Apply the patch. 5. The patron should now be prompted to update holds when default notification methods are changed. Signed-off-by: Garry Collum Signed-off-by: John Amundson Signed-off-by: Michele Morgan --- .../opac/myopac/prefs_notify.tt2 | 243 +++++++++++++-------- .../opac/myopac/prefs_notify_changed_holds.tt2 | 29 +++ 2 files changed, 182 insertions(+), 90 deletions(-) create mode 100644 Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify_changed_holds.tt2 diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2 index e7c8b80ce4..348bd45d6d 100755 --- a/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2 @@ -2,106 +2,169 @@ WRAPPER "opac/parts/myopac/base.tt2"; myopac_page = "prefs_notify"; parent="prefs"; - prefs_page = 'prefs_notify' %] + prefs_page = 'prefs_notify' +%]

[% l('Notification Preferences') %]

-
- [% setting = 'opac.hold_notify' %] - - - + [% IF ctx.affectedChgs %] + [% # get hash of sms cariers keyed by id: + temp = ctx.search_csc('active','t'); + tcos = { '0' => 'None' }; + FOR o IN temp; + id = o.id; + tcos.$id = o; + END; + %] - [% IF ctx.updated_user_settings %] - - [% END %] +

[% l('You have updated notification preferences. Those changes only affect future holds. Would you like to update existing holds to use the new information?') %]

+ +
-
- [% l('Account Successfully Updated') %] -
-
+ + [% SET blnk = l('Blank') %] + [% FOR c IN ctx.affectedChgs %] + + + + [% END %] + +
+ [% IF c.2 == 'sms_info' %] + + + [% ELSE %] + + + [% END %] + + + + [% IF c.2 == 'sms_info' %] + [% SET disp_name = l('SMS carrier/number') %] + + [% ELSIF c.2.match('_notify') %] + [% SET f_name = c.2.replace("_", " "); Y = l('YES'); N = l('NO') %] + + [% ELSE %] + [% SET f_name = c.2.replace("_", " ") %] + + [% END %] +
+ + [% l('Continue without updating') %] +
+ [% ELSE %] +
[% setting = 'opac.hold_notify' %] - - [%# WCAG insists that labels for checkboxes contain the input - or directly follow the input, which would not look right - with the rest of the table. As an alternative, we can - repeat the label as a title attr. - http://www.w3.org/TR/WCAG20-TECHS/H44.html %] - [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %] + - - - - - - [%- IF allow_phone_notifications == 'true'; - setting = 'opac.hold_notify'; - -%] - - [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %] - - - - - - [% setting = 'opac.default_phone' %] - - - - - - - [%- END %] - [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1; - setting = 'opac.hold_notify'; - -%] - - [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %] - - - - - - - [% l('Default Mobile Carrier') %] - [% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %] - - [% setting = 'opac.default_sms_notify' %] - - - - - [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %] - - - [% END %] - [% FOR optin IN ctx.opt_in_settings %] - - - - - - - [% END %] - - + + + + [% IF ctx.updated_user_settings %] + + [% END %] + + [% setting = 'opac.hold_notify' %] + + [%# WCAG insists that labels for checkboxes contain the input + or directly follow the input, which would not look right + with the rest of the table. As an alternative, we can + repeat the label as a title attr. + http://www.w3.org/TR/WCAG20-TECHS/H44.html %] + [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %] + + + + + [%- IF allow_phone_notifications == 'true'; + setting = 'opac.hold_notify'; + -%] + + [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %] + + + + [% setting = 'opac.default_phone' %] + + + + + [%- END %] + [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1; + setting = 'opac.hold_notify'; + -%] + + [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %] + + + + + + + + [% setting = 'opac.default_sms_notify' %] + + + + + + + + [% END %] + [% FOR optin IN ctx.opt_in_settings %] + + + + + [% END %] + +
+
+ [% l('Account Successfully Updated') %] +
+
+ +
+ +
+ +
+ +
[% l('Default Mobile Carrier') %][% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]
+ + [% IF ctx.user_setting_map.$setting; %] + [% l('Send Test Text Message') %]
+ [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %] + [% END %] +
+ +
+ [% END %] [% END %] diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify_changed_holds.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify_changed_holds.tt2 new file mode 100644 index 0000000000..0a33c3f2af --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify_changed_holds.tt2 @@ -0,0 +1,29 @@ +[% PROCESS "opac/parts/header.tt2"; + WRAPPER "opac/parts/myopac/prefs_base.tt2"; + myopac_page = "prefs"; + prefs_page = 'prefs_notify' %] + +

[% l('Affected Holds') %]

+
+ [% IF ctx.updated %] +

[% l('Hold Notification Information Updated.') %]

+ + [% ELSE %] +

[% l('No changes') %].

+ [% END %] + [% l('Continue.') %] + +[% END %] + + -- 2.11.0