Bug 28864: Have patron card creator use PatronsPerPage

Add pageLength to members/member.tt
Add aLengthMenu and pageLength to
 patroncards/add_user_search (common/patron_search.tt).
Add aLengthMenu, pageLength, and iDisplayLength to patroncards/edit-batch

Test plan:
1.  Set the PatronsPerPage system preference to any integer other than 20.

2.  Go to Tools -> Patron card creator.
3.  Start a new Card Batch.
4.  Click the 'Add patron(s)' button to open the patron search window.
5.  Do a search.
6.  Add more than 20 patrons to the batch.
7.  Close patron search window.
8.  Click the 'Add patron(s)' button to add the selected patrons to the batch.
9.  Observe that the table of patrons is has 20 as the default per page setting.

10. Apply patch.
11. Reload the batch.
12. Observe that the per page drop down includes the value of PatronsPerPage
     and that value is selected by default.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5ca665f6aa)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Michael Hafen 2021-08-13 15:52:52 -06:00 committed by Lucas Gass
parent 4d330f3697
commit a1b1b82945

View file

@ -250,6 +250,21 @@
};
$(document).ready(function() {
// Prepare DataTables settings
var aLengthMenu = [10, 20, 50, 100, -1];
var aLengthMenuLabel = [10, 20, 50, 100, _("All")];
var patronsPerPage = [% Koha.Preference('PatronsPerPage') | html %];
for ( var i = 0; i < aLengthMenu.length; i++ ) {
if ( aLengthMenu[i] == patronsPerPage ) {
break;
}
if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) {
aLengthMenu.splice(i, 0, patronsPerPage);
aLengthMenuLabel.splice(i, 0, patronsPerPage);
break;
}
}
[% IF table_loop %]
$("#description").show();
[% ELSE %]
@ -261,6 +276,8 @@
],
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full",
"aLengthMenu": [aLengthMenu, aLengthMenuLabel],
"pageLength": patronsPerPage,
"autoWidth": false
}));
$("#additems").click(function(){