Lp1969967: Move allow_phone_notifications to organizational unit settings
authorJason Stephenson <jason@sigio.com>
Tue, 26 Apr 2022 19:38:12 +0000 (15:38 -0400)
committerJason Stephenson <jason@sigio.com>
Wed, 27 Apr 2022 14:33:28 +0000 (10:33 -0400)
Move the allow_phone_notifications OPAC setting to the organizational
unit settings as 'opac.allow_phone_notifications':

1. Create the new organizational unit setting.

2. Modify the OPAC to look the setting up from the OU settings.

3. Add a note to the OPAC config.tt2 files to indicate that the
   setting has moved.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac.allow_phone_notifications-ous.sql [new file with mode: 0644]
Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2
Open-ILS/src/templates-bootstrap/opac/parts/config-fresh.tt2
Open-ILS/src/templates-bootstrap/opac/parts/config.tt2
Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2
Open-ILS/src/templates/kpac/getit.tt2
Open-ILS/src/templates/opac/myopac/prefs_notify.tt2
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/place_hold.tt2

index a0f937c..ba29cb6 100644 (file)
@@ -22176,3 +22176,22 @@ VALUES (
     )
 );
 
+INSERT INTO config.org_unit_setting_type (name, grp, label, description, datatype) VALUES
+(
+    'opac.allow_phone_notifications',
+    'opac',
+    oils_i18n_gettext(
+        'opac.allow_phone_notifications',
+        'Enable phone notification features.',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext(
+        'opac.allow_phone_notifications',
+        'Enabling this setting exposes the notify by phone options for hold pickup in the OPAC. If this setting is not enabled, the phone options will not be offered to the user.',
+        'coust',
+        'description'
+    ),
+    'bool'
+);
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac.allow_phone_notifications-ous.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac.allow_phone_notifications-ous.sql
new file mode 100644 (file)
index 0000000..5b55bff
--- /dev/null
@@ -0,0 +1,24 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type (name, grp, label, description, datatype) VALUES
+(
+    'opac.allow_phone_notifications',
+    'opac',
+    oils_i18n_gettext(
+        'opac.allow_phone_notifications',
+        'Enable phone notification features.',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext(
+        'opac.allow_phone_notifications',
+        'Enabling this setting exposes the notify by phone options for hold pickup in the OPAC. If this setting is not enabled, the phone options will not be offered to the user.',
+        'coust',
+        'description'
+    ),
+    'bool'
+);
+
+COMMIT;
index e7c8b80..59077c1 100755 (executable)
@@ -38,7 +38,7 @@
                         [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
                 </td>
             </tr>
-            [%- IF allow_phone_notifications == 'true';
+            [%- IF ctx.get_org_setting(ctx.search_ou, 'opac.allow_phone_notifications') == 1;
                 setting = 'opac.hold_notify';
             -%]
             <tr>
index 0cea9e4..17157e7 100755 (executable)
@@ -79,8 +79,10 @@ disable_email_change = 'false';
 # Some libraries do not do notifications by phone; if not true, then this
 # hides the user preference for phone notifications as well as the phone
 # notification portion of the hold dialogue
+#
+# The allow_phone_notificaitons setting has moved to the Library Settings in
+# the staff client.  It is no longer set here.
 ##############################################################################
-allow_phone_notifications = 'true';
 
 ##############################################################################
 # Format of parts selection on Place Holds screen
index 7409a4b..2e7ff97 100755 (executable)
@@ -80,8 +80,10 @@ disable_email_change = 'false';
 # Some libraries do not do notifications by phone; if not true, then this
 # hides the user preference for phone notifications as well as the phone
 # notification portion of the hold dialogue
+#
+# The allow_phone_notificaitons setting has moved to the Library Settings in
+# the staff client.  It is no longer set here.
 ##############################################################################
-allow_phone_notifications = 'true';
 
 ##############################################################################
 # Format of parts selection on Place Holds screen
index 7af5d42..c1a5446 100755 (executable)
@@ -250,7 +250,7 @@ function maybeToggleNumCopies(obj) {
                 <p>
 
                 </p>
-                [%- IF allow_phone_notifications == 'true' %]
+                [%- IF ctx.get_org_setting(ctx.search_ou, 'opac.allow_phone_notifications') == 1 %]
                 <div class="form-check m-2">
                     <input class="form-check-input" type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox" [% IF ctx.default_phone_notify %]checked="checked"[% END %]>
                     <label class="form-check-label" for="phone_notify_checkbox">
index 5ae1fef..996731d 100644 (file)
@@ -88,7 +88,7 @@
                                      '<input type="hidden" id="email_notify" name="email_notify" value="t"/>' : '' %]
                                  [%- END -%]
 
-                                 [%- IF allow_phone_notifications == 'true' -%]
+                                 [%- IF ctx.get_org_setting(ctx.search_ou, 'opac.allow_phone_notifications') == 1 -%]
                                      [% IF ctx.default_phone %]
                                             [% phone_value = ctx.default_phone %]
                                      [% ELSE %]
index 4d31a0d..b48182f 100644 (file)
@@ -87,7 +87,7 @@
                                 [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
                         </td>
                     </tr>
-                    [%- IF allow_phone_notifications == 'true';
+                    [%- IF ctx.get_org_setting(ctx.search_ou, 'opac.allow_phone_notifications') == 1;
                         setting = 'opac.hold_notify'; 
                     -%]
                     <tr>
index eda51ad..de27fbd 100644 (file)
@@ -79,8 +79,10 @@ disable_email_change = 'false';
 # Some libraries do not do notifications by phone; if not true, then this
 # hides the user preference for phone notifications as well as the phone
 # notification portion of the hold dialogue
+#
+# The allow_phone_notificaitons setting has moved to the Library Settings in
+# the staff client.  It is no longer set here.
 ##############################################################################
-allow_phone_notifications = 'true';
 
 ##############################################################################
 # Format of parts selection on Place Holds screen
index 809def3..5fe5bc2 100644 (file)
@@ -263,7 +263,7 @@ function maybeToggleNumCopies(obj) {
                     [% IF !ctx.user.email and !ctx.is_staff; l('No configured Email address. See "My Account" for setting your Email address.');
                      ELSE; l('Email Address:') %] <span name="email_address">[% ctx.user.email %]</span>[% END %]
                 </blockquote>
-                [%- IF allow_phone_notifications == 'true' %]
+                [%- IF ctx.get_org_setting(ctx.search_ou, 'opac.allow_phone_notifications') == 1 %]
                 <input class="hold-alert-method" type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox"
                     [% IF ctx.default_phone_notify %]checked="checked"[% END %]/>
                     <label for="phone_notify_checkbox">[% l('Yes, by Phone') %]</label><br/>