Koha/members/members-home.pl
Owen Leonard 98efac4c0a Fix for Bug 4945 - Patron search is limited by default to the currently logged-in library
I couldn't figure out how (or whether) GetBranchesLoop could be
convinced to return a list of branches without selecting one, so
I swapped GetBranchesLoop with GetBranches. This will preselect
a branch only if a branch has been submitted as part of a query.

This does NOT preselect the correct branch when IndependantBranches
is turned on.

I also added a template variable which is true if a query has
been submitted with a branch or a category so that the extra
form fields can be displayed, reminding the user that they
added limiters to their query.

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-01-11 15:35:09 +13:00

77 lines
2.4 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use warnings;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
use C4::Members;
use C4::Branch;
use C4::Category;
my $query = new CGI;
my $quicksearch = $query->param('quicksearch');
my $branch = $query->param('branchcode');
my ($template, $loggedinuser, $cookie);
my $template_name;
if($quicksearch){
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/member-quicksearch.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
} else {
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/member.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
}
my $branches = GetBranches;
my @branchloop;
foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
my $selected = 1 if $branches->{$_}->{branchcode} eq $branch;
my %row = ( value => $_,
selected => $selected,
branchname => $branches->{$_}->{branchname},
);
push @branchloop, \%row;
}
my @categories=C4::Category->all;
$template->param(
branchloop=>\@branchloop,
categories=>\@categories,
);
$template->param(
"AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
);
my @letters = map { {letter => $_} } ( 'A' .. 'Z');
$template->param( letters => \@letters );
output_html_with_http_headers $query, $cookie, $template->output;