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 Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
use CGI qw ( -utf8 );
use C4::Auth;
+use C4::Branch qw( GetBranches );
+use C4::Category;
use C4::Output;
use C4::Members;
( $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 );
use CGI qw ( -utf8 );
use C4::Auth;
+use C4::Branch qw( GetBranches );
+use C4::Category;
use C4::Output;
use C4::Members;
( $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 );
search = 0;
[% END %]
- $("#searchmember_filter").on('keyup', function(){
- filter();
- });
// Apply DataTables on the results table
dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
'bServerSide': true,
aoData.push({
'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'
'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) {
<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>
use CGI qw ( -utf8 );
use C4::Auth;
+use C4::Branch qw( GetBranches );
+use C4::Category;
use C4::Output;
use C4::Members;
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 );
use CGI qw ( -utf8 );
use C4::Auth;
+use C4::Branch qw( GetBranches );
+use C4::Category;
use C4::Output;
use C4::Members;
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 );
use CGI qw ( -utf8 );
use C4::Auth;
+use C4::Branch qw( GetBranches );
+use C4::Category;
use C4::Output;
use C4::Members;
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 );