Bugzilla – Attachment 123848 Details for
Bug 28864
The patron search results in the patron card creator doesn't seem to use PatronsPerPage syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-28864-Have-patron-search-use-PatronsPerPage-bett.patch (text/plain), 5.61 KB, created by
Michael Hafen
on 2021-08-13 22:51:10 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2021-08-13 22:51:10 UTC
Size:
5.61 KB
patch
obsolete
>From 0af0ee67bfeaf8edc1bc9ba15039c44a6e96c843 Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Fri, 13 Aug 2021 15:52:52 -0600 >Subject: [PATCH] Bug 28864: Have patron search use PatronsPerPage better. >Content-Type: text/plain; charset="utf-8" > >Add pageLength to members/member.tt >Add aLengthMenu and pageLength to > patroncards/add_user_search (common/patron_search.tt). > >Test plan: >1. Set the PatronsPerPage system preference to any integer other than 20. > >2. Go to the Patrons page and search for patrons. >3. Observe that the per page drop down defaults to 20. > >4. Go to Tools -> Patron card creator. >5. Start a new Card Batch. >6. Click the 'Add patron(s)' button to open the patron search window. >7. Do a search. >8. Observe that the per page drop down defaults to 20. >8b. If the PatronsPerPage was set to a value other than 10, 20, 50, or 100 > observe that that value is not in the per page drop down. >9. Close patron search window. > >10. Apply patch. >11. Click the 'Add patron(s)' button again to open the patron search window. >12. Do a search. >13. Observe that the per page drop down includes the value of PatronsPerPage > and that value is selected by default. > >14. Go back to the Patrons page and search for patrons. >15. Observe that the per page drop down defaults to the value of the > PatronsPerPage system preference. >--- > .../prog/en/modules/common/patron_search.tt | 19 ++++++++++- > .../prog/en/modules/members/member.tt | 32 +++++++------------ > 2 files changed, 30 insertions(+), 21 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >index d6a128f6c3..51fc2d5df2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >@@ -158,6 +158,21 @@ > search = 0; > [% END %] > >+ // 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; >+ } >+ } >+ > // Apply DataTables on the results table > dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, { > 'bServerSide': true, >@@ -250,7 +265,9 @@ > ], > 'bAutoWidth': false, > 'sPaginationType': 'full_numbers', >- "iDisplayLength": [% Koha.Preference('PatronsPerPage') | html %], >+ 'aLengthMenu': [aLengthMenu, aLengthMenuLabel], >+ 'iDisplayLength': patronsPerPage, >+ 'pageLength': patronsPerPage, > 'aaSorting': [[[% aaSorting || 0 | html %], 'asc']], > 'bFilter': false, > 'bProcessing': true, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index 58f87e2a5d..4110552fd9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -366,28 +366,19 @@ > [% END %] > > // Build the aLengthMenu >- var aLengthMenu = [ >- [% PatronsPerPage | html %], 10, 20, 50, 100, -1 >- ]; >- jQuery.unique(aLengthMenu); >- aLengthMenu.sort(function( a, b ){ >- // Put "All" at the end >- if ( a == -1 ) { >- return 1; >- } else if ( b == -1 ) { >- return -1; >+ var aLengthMenu = [10, 20, 50, 100, -1]; >+ var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; >+ var patronsPerPage = [% PatronsPerPage | html %]; >+ for ( var i = 0; i < aLengthMenu.length; i++ ) { >+ if ( aLengthMenu[i] == patronsPerPage ) { >+ break; > } >- return parseInt(a) < parseInt(b) ? -1 : 1;} >- ); >- var aLengthMenuLabel = []; >- $(aLengthMenu).each(function(){ >- if ( this == -1 ) { >- // Label for -1 is "All" >- aLengthMenuLabel.push(_("All")); >- } else { >- aLengthMenuLabel.push(this); >+ if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) { >+ aLengthMenu.splice(i, 0, patronsPerPage); >+ aLengthMenuLabel.splice(i, 0, patronsPerPage); >+ break; > } >- }); >+ } > > // Apply DataTables on the results table > var columns_settings = [% TablesSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) | $raw %]; >@@ -486,6 +477,7 @@ > "aLengthMenu": [aLengthMenu, aLengthMenuLabel], > 'sPaginationType': 'full_numbers', > "iDisplayLength": [% PatronsPerPage | html %], >+ "pageLength": [% PatronsPerPage | html %], > "bProcessing": true, > "initComplete": function(settings, json) { > Sticky = $("#searchheader"); >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28864
:
123848
|
124787
|
134004
|
138194
|
138195
|
138196
|
138197
|
138379
|
138388