LP1422927 Opac hold history pagination
authorGarry Collum <gcollum@gmail.com>
Thu, 25 Aug 2022 17:44:13 +0000 (17:44 +0000)
committerMichele Morgan <mmorgan@noblenet.org>
Thu, 5 Jan 2023 19:31:45 +0000 (14:31 -0500)
Fixes the hold history pagination in both the TPac and the Bootstrap opac.

To test:
1. Login as a patron and enable the hold history preference.  The default
number of items on each page is 15, so place at least 16 holds for this
patron.  (The limit can be overridden in the url with the &limit switch).
2. View the hold history and notice that all items are displaying on all
pages.
3. Apply the patch
4. The results are now paginated with 15 items per page.

Signed-off-by: Garry Collum <gcollum@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>

Open-ILS/src/templates-bootstrap/opac/myopac/hold_history.tt2
Open-ILS/src/templates/opac/myopac/hold_history.tt2

index ff0b543..fdd6947 100755 (executable)
             <big><strong>[% l('No holds found.') %]</strong></big>
         </div>
         [% ELSE %]
+        [% hold_items = ctx.holds;
+           hi = offset + limit - 1;
+           hi = hi > hold_items.max ? hold_items.max : hi;
+           hold_items = hold_items.slice(offset, hi);
+        %]
         <table id='acct_holds_hist_header' class='table table-hover table-bordered miniTable holdHistoryTable' title="[% l('History of items on hold') %]">
             <thead>
                 <tr>
@@ -59,7 +64,7 @@
                 </tr>
             </thead>
             <tbody>
-                [% FOR hold IN ctx.holds;
+                [% FOR hold IN hold_items;
                     attrs = {marc_xml => hold.marc_xml};
                     PROCESS get_marc_attrs args=attrs;
                     ahr = hold.hold.hold %]
index cf8af4c..8b4bfa2 100644 (file)
             <big><strong>[% l('No holds found.') %]</strong></big>
         </div>
         [% ELSE %]
+        [% hold_items = ctx.holds;
+           hi = offset + limit - 1;
+           hi = hi > hold_items.max ? hold_items.max : hi;
+           hold_items = hold_items.slice(offset, hi);
+        %]
         <table id='acct_holds_hist_header' class='table_no_border_space table_no_cell_pad' title="[% l('History of items on hold') %]">
             <thead>
                 <tr>
@@ -81,7 +86,7 @@
                 </tr>
             </thead>
             <tbody id='holds_temp_parent'>
-                [% FOR hold IN ctx.holds;
+                [% FOR hold IN hold_items;
                     attrs = {marc_xml => hold.marc_xml};
                     PROCESS get_marc_attrs args=attrs;
                     ahr = hold.hold.hold %]