@@ -, +, @@ Fix regressions --- 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(-) --- a/acqui/add_user_search.pl +++ a/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 ); --- a/admin/add_user_search.pl +++ a/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 ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ a/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() {
-

Search for patron

- - - +
+
+

Search for patron

+
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
+
+ +
+
+ [% IF patrons_with_acq_perm_only %]
Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results
[% END %] +
+ Browse by last name: + [% FOREACH letter IN alphabet.split(' ') %] + [% letter %] + [% END %] +
+
+
--- a/members/guarantor_search.pl +++ a/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 ); --- a/patroncards/add_user_search.pl +++ a/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 ); --- a/serials/add_user_search.pl +++ a/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 ); --