Bugzilla – Attachment 37187 Details for
Bug 13891
Make all patron searches use DataTables server-side processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[Signed-off] Bug 13891: DataTables server-side processing - Fix regressions
Signed-off-Bug-13891-DataTables-server-side-proces.patch (text/plain), 12.16 KB, created by
Marc Véron
on 2015-03-24 15:59:02 UTC
(
hide
)
Description:
[Signed-off] Bug 13891: DataTables server-side processing - Fix regressions
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-03-24 15:59:02 UTC
Size:
12.16 KB
patch
obsolete
>From 459e5574148d4f2325c8052ee516eefdfe3ef839 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 23 Mar 2015 10:43:11 +0100 >Subject: [PATCH] [Signed-off] Bug 13891: DataTables server-side processing - > Fix regressions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch fixes the regressions introduced by the previous patches. >If you have tested all in once, you didn't see them. > >It introduces library, category and "first letter" filters. > >Test plan: >1/ On all pages impacted by previous patches + new order empty (link patron to >an order) + guarantor search >2/ Add / Select patron to the list >3/ Use the filters >4/ Confirm there is no regression > >Tested together with other patches. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > acqui/add_user_search.pl | 8 ++ > admin/add_user_search.pl | 8 ++ > .../prog/en/modules/common/patron_search.tt | 88 ++++++++++++++------ > members/guarantor_search.pl | 8 ++ > patroncards/add_user_search.pl | 16 +++- > serials/add_user_search.pl | 8 ++ > 6 files changed, 108 insertions(+), 28 deletions(-) > >diff --git a/acqui/add_user_search.pl b/acqui/add_user_search.pl >index e86b0e4..7b8b969 100755 >--- a/acqui/add_user_search.pl >+++ b/acqui/add_user_search.pl >@@ -21,6 +21,8 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; >+use C4::Branch qw( GetBranches ); >+use C4::Category; > use C4::Output; > use C4::Members; > >@@ -49,11 +51,17 @@ my $search_patrons_with_acq_perm_only = > ( $referer =~ m|acqui/basket.pl| ) > ? 1 : 0; > >+my $onlymine = C4::Branch::onlymine; >+my $branches = C4::Branch::GetBranches( $onlymine ); >+ > $template->param( > patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only, > view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", > columns => ['cardnumber', 'name', 'branch', 'category', 'action'], > json_template => 'acqui/tables/members_results.tt', > selection_type => 'add', >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => [ C4::Category->all ], >+ branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ], > ); > output_html_with_http_headers( $input, $cookie, $template->output ); >diff --git a/admin/add_user_search.pl b/admin/add_user_search.pl >index 33fb6ac..bafc9e1 100755 >--- a/admin/add_user_search.pl >+++ b/admin/add_user_search.pl >@@ -21,6 +21,8 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; >+use C4::Branch qw( GetBranches ); >+use C4::Category; > use C4::Output; > use C4::Members; > >@@ -50,11 +52,17 @@ my $search_patrons_with_acq_perm_only = > ( $referer =~ m|admin/aqbudgets.pl| ) > ? 1 : 0; > >+my $onlymine = C4::Branch::onlymine; >+my $branches = C4::Branch::GetBranches( $onlymine ); >+ > $template->param( > patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only, > view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", > columns => ['cardnumber', 'name', 'branch', 'category', 'action'], > json_template => 'acqui/tables/members_results.tt', > selection_type => $selection_type, >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => [ C4::Category->all ], >+ branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ], > ); > output_html_with_http_headers( $input, $cookie, $template->output ); >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 e182688..b65d3f8 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 >@@ -18,9 +18,6 @@ $(document).ready(function(){ > search = 0; > [% END %] > >- $("#searchmember_filter").on('keyup', function(){ >- filter(); >- }); > // Apply DataTables on the results table > dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, { > 'bServerSide': true, >@@ -33,6 +30,15 @@ $(document).ready(function(){ > 'name': 'searchmember', > 'value': $("#searchmember_filter").val() > },{ >+ 'name': 'firstletter', >+ 'value': $("#firstletter_filter").val() >+ },{ >+ 'name': 'categorycode', >+ 'value': $("#categorycode_filter").val() >+ },{ >+ 'name': 'branchcode', >+ 'value': $("#branchcode_filter").val() >+ },{ > 'name': 'name_sorton', > 'value': 'borrowers.surname borrowers.firstname' > },{ >@@ -87,31 +93,27 @@ $(document).ready(function(){ > 'bFilter': false, > 'bProcessing': true, > })); >- dtMemberResults.fnAddFilters("filter", 750); >-}); > >-var delay = (function(){ >- var timer = 0; >- return function(callback, ms){ >- clearTimeout (timer); >- timer = setTimeout(callback, ms); >- }; >-})(); >+ $("#searchform").on('submit', filter); >+}); > > function filter() { > search = 1; >- >+ $("#firstletter_filter").val(''); > $("#searchresults").show(); >- >- if ( $("#searchmember_filter").val().length > 0 ) { >- delay(function(){ >- dtMemberResults.fnDraw(); >- }, 1000); >- } >- >+ dtMemberResults.fnDraw(); > return false; > } > >+// User has clicked on a letter >+function filterByFirstLetterSurname(letter) { >+ $("#firstletter_filter").val(letter); >+ search = 1; >+ $("#searchresults").show(); >+ dtMemberResults.fnDraw(); >+} >+ >+ > // modify parent window owner element > [% IF selection_type == 'add' %] > function add_user(borrowernumber, borrowername) { >@@ -152,18 +154,56 @@ function filter() { > <div id="bd"> > <div class="yui-g"> > >- <h3>Search for patron</h3> >- >- <label for="searchmember_filter">Search:</label> >- <input type="text" id="searchmember_filter" value="[% searchmember %]"/> >+ <form id="searchform"> >+ <fieldset class="brief"> >+ <h3>Search for patron</h3> >+ <ol> >+ <li> >+ <label for="searchmember_filter">Search:</label> >+ <input type="text" id="searchmember_filter" value="[% searchmember %]"/> >+ </li> >+ <li> >+ <label for="categorycode_filter">Category:</label> >+ <select id="categorycode_filter"> >+ <option value="">Any</option> >+ [% FOREACH category IN categories %] >+ <option value="[% category.categorycode %]">[% category.description %]</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="branchcode_filter">Library:</label> >+ <select id="branchcode_filter"> >+ [% IF branches.size != 1 %] >+ <option value="">Any</option> >+ [% END %] >+ [% FOREACH branch IN branches %] >+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ <fieldset class="action"> >+ <input type="submit" value="Search" /> >+ </fieldset> >+ </fieldset> >+ <form> > > [% IF patrons_with_acq_perm_only %] > <div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div> > [% END %] > >+ <div class="browse"> >+ Browse by last name: >+ [% FOREACH letter IN alphabet.split(' ') %] >+ <a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a> >+ [% END %] >+ </div> >+ > <div id="info" class="dialog message"></div> > <div id="error" class="dialog alert"></div> > >+ <input type="hidden" id="firstletter_filter" value="" /> > <div id="searchresults"> > <table id="memberresultst"> > <thead> >diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl >index 6e4e6ab..ac9d1ce 100755 >--- a/members/guarantor_search.pl >+++ b/members/guarantor_search.pl >@@ -21,6 +21,8 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; >+use C4::Branch qw( GetBranches ); >+use C4::Category; > use C4::Output; > use C4::Members; > >@@ -42,10 +44,16 @@ my $op = $input->param('op') || ''; > > my $referer = $input->referer(); > >+my $onlymine = C4::Branch::onlymine; >+my $branches = C4::Branch::GetBranches( $onlymine ); >+ > $template->param( > view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", > columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ], > json_template => 'members/tables/guarantor_search.tt', > selection_type => 'select', >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => [ C4::Category->all ], >+ branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ], > ); > output_html_with_http_headers( $input, $cookie, $template->output ); >diff --git a/patroncards/add_user_search.pl b/patroncards/add_user_search.pl >index 2953dcf..bc86076 100755 >--- a/patroncards/add_user_search.pl >+++ b/patroncards/add_user_search.pl >@@ -21,6 +21,8 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; >+use C4::Branch qw( GetBranches ); >+use C4::Category; > use C4::Output; > use C4::Members; > >@@ -42,10 +44,16 @@ my $op = $input->param('op') || ''; > > my $referer = $input->referer(); > >+my $onlymine = C4::Branch::onlymine; >+my $branches = C4::Branch::GetBranches( $onlymine ); >+ > $template->param( >- view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", >- columns => ['cardnumber', 'name', 'category', 'branch', 'dateexpiry', 'borrowernotes', 'action'], >- json_template => 'patroncards/tables/members_results.tt', >- selection_type => 'add', >+ view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", >+ columns => ['cardnumber', 'name', 'category', 'branch', 'dateexpiry', 'borrowernotes', 'action'], >+ json_template => 'patroncards/tables/members_results.tt', >+ selection_type => 'add', >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => [ C4::Category->all ], >+ branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ], > ); > output_html_with_http_headers( $input, $cookie, $template->output ); >diff --git a/serials/add_user_search.pl b/serials/add_user_search.pl >index 50d63bd..8fc15af 100755 >--- a/serials/add_user_search.pl >+++ b/serials/add_user_search.pl >@@ -21,6 +21,8 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; >+use C4::Branch qw( GetBranches ); >+use C4::Category; > use C4::Output; > use C4::Members; > >@@ -42,10 +44,16 @@ my $op = $input->param('op') || ''; > > my $referer = $input->referer(); > >+my $onlymine = C4::Branch::onlymine; >+my $branches = C4::Branch::GetBranches( $onlymine ); >+ > $template->param( > view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", > columns => ['cardnumber', 'name', 'branch', 'action'], > json_template => 'serials/tables/members_results.tt', > selection_type => 'add', >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => [ C4::Category->all ], >+ branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ], > ); > output_html_with_http_headers( $input, $cookie, $template->output ); >-- >1.7.10.4
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 13891
:
37104
|
37105
|
37106
|
37107
|
37180
|
37184
|
37185
|
37186
|
37187
|
37334
|
37335
|
37336
|
37337