Bug 21296: suspend hold ignores system preference on intranet
authorOwen Leonard <oleonard@myacpl.org>
Wed, 20 Nov 2019 20:04:10 +0000 (20:04 +0000)
committerHayley Mapley <hayleymapley@catalyst.net.nz>
Mon, 16 Mar 2020 00:08:06 +0000 (13:08 +1300)
This patch modifies the DataTable configuration for the table of holds
which displays under the "Holds" tab on the patron's checkout and
details pages. A variable is now defined in the JavaScript with the
value of the "SuspendHoldsIntranet" system preference. This variable is
passed to the DataTable configuration to determine whether the column is
visible or not.

One of the changes made in this patch moves a <script> block so that it
appears before some of the JS includes on the page. This helps keep the
string-defining JS together in one block.

To test, apply the patch and set the "SuspendHoldsIntranet" system
preference to "Allow."

 - Open the checkout page for a patron with one or more holds.
 - Under the "Holds" tab, the table of holds should have a "Suspend"
   column with controls for suspending or resuming holds.
 - Check that the same is true on the patron detail page.
 - Set the "SuspendHoldsIntranet" system preference to "Don't allow."
 - Test the checkout and detail pages again and confirm that the
   "Suspend" column does not appear.

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 541dfa7ddeec9fc72dd764165087dcfb601ddf07)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cc87e68e0d1b90eed67ca2f614ca0f6a93b57054)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/js/holds.js

index f8b9b85..bf14dab 100644 (file)
@@ -964,11 +964,7 @@ No patron matched <span class="ex">[% message | html %]</span>
     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
     [% INCLUDE 'timepicker.inc' %]
     [% Asset.js("lib/jquery/plugins/jquery.dataTables.rowGrouping.js") | $raw %]
-    [% Asset.js("js/pages/circulation.js") | $raw %]
-    [% Asset.js("js/checkouts.js") | $raw %]
-    [% Asset.js("js/holds.js") | $raw %]
-    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
-    <script type="text/javascript">
+    <script>
         /* Set some variable needed in circulation.js */
         var MSG_DT_LOADING_RECORDS = _("Loading... you may continue scanning.");
         var interface = "[% interface | html %]";
@@ -986,8 +982,15 @@ No patron matched <span class="ex">[% message | html %]</span>
 
         var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
         var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone.");
-
-        columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) | $raw %]
+        var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %];
+    </script>
+    [% Asset.js("js/pages/circulation.js") | $raw %]
+    [% Asset.js("js/checkouts.js") | $raw %]
+    [% Asset.js("js/holds.js") | $raw %]
+    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
+    <script>
+        columns_settings_issues_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) | $raw %]
+        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
 
         [% IF borrowernumber and patron %]
             if($.cookie("holdfor") != [% patron.borrowernumber | html %]){
index 31cae1d..5048f2a 100644 (file)
     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
     [% INCLUDE 'timepicker.inc' %]
     [% Asset.js("lib/jquery/plugins/jquery.dataTables.rowGrouping.js") | $raw %]
-    [% Asset.js("js/pages/circulation.js") | $raw %]
-    [% Asset.js("js/checkouts.js") | $raw %]
-    [% Asset.js("js/holds.js") | $raw %]
-    [% INCLUDE 'str/members-menu.inc' %]
-    [% Asset.js("js/members-menu.js") | $raw %]
-    [% Asset.js("js/messaging-preference-form.js") | $raw %]
     <script>
         /* Set some variable needed in circulation.js */
         var interface = "[% interface | html %]";
 
         var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
         var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone.");
+        var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %];
+    </script>
+    [% Asset.js("js/pages/circulation.js") | $raw %]
+    [% Asset.js("js/checkouts.js") | $raw %]
+    [% Asset.js("js/holds.js") | $raw %]
+    [% INCLUDE 'str/members-menu.inc' %]
+    [% Asset.js("js/members-menu.js") | $raw %]
+    [% Asset.js("js/messaging-preference-form.js") | $raw %]
+    <script>
 
         columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
 
index 433f18d..788c550 100644 (file)
@@ -146,6 +146,7 @@ $(document).ready(function() {
                     },
                     {
                         "bSortable": false,
+                        "visible": SuspendHoldsIntranet,
                         "mDataProp": function( oObj ) {
                             holds[oObj.reserve_id] = oObj; //Store holds for later use