Bug 25898: Prohibit indirect object notation
[koha.git] / members / member.pl
blob970015b22e7e7a69908b98d5079bd5a0d2d34f18
1 #!/usr/bin/perl
4 #script to do a borrower enquiry/bring up borrower details etc
5 #written 20/12/99 by chris@katipo.co.nz
8 # Copyright 2000-2002 Katipo Communications
9 # Copyright 2013 BibLibre
11 # This file is part of Koha.
13 # Koha is free software; you can redistribute it and/or modify it
14 # under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 3 of the License, or
16 # (at your option) any later version.
18 # Koha is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with Koha; if not, see <http://www.gnu.org/licenses>.
26 use Modern::Perl;
27 use C4::Auth;
28 use C4::Output;
29 use CGI qw( -utf8 );
30 use Koha::DateUtils;
31 use Koha::List::Patron;
32 use Koha::Patrons;
34 my $input = CGI->new;
36 my ($template, $loggedinuser, $cookie)
37 = get_template_and_user({template_name => "members/member.tt",
38 query => $input,
39 type => "intranet",
40 flagsrequired => {borrowers => 'edit_borrowers'},
41 });
43 my $theme = $input->param('theme') || "default";
45 my $searchmember = $input->param('searchmember');
46 my $quicksearch = $input->param('quicksearch') // 0;
48 if ( $quicksearch and $searchmember ) {
49 my $branchcode;
50 if ( C4::Context::only_my_library ) {
51 my $userenv = C4::Context->userenv;
52 $branchcode = $userenv->{'branch'};
54 my $patron = Koha::Patrons->find( { cardnumber => $searchmember } );
55 if (
56 $patron
57 and ( ( $branchcode and $patron->branchcode eq $branchcode )
58 or ( not $branchcode ) )
61 print $input->redirect( "/cgi-bin/koha/members/moremember.pl?borrowernumber=" . $patron->borrowernumber );
62 exit;
66 my $searchfieldstype = $input->param('searchfieldstype') || 'standard';
68 $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' );
70 my $view = $input->request_method() eq "GET" ? "show_form" : "show_results";
72 $template->param(
73 patron_lists => [ GetPatronLists() ],
74 searchmember => $searchmember,
75 branchcode_filter => scalar $input->param('branchcode_filter'),
76 categorycode_filter => scalar $input->param('categorycode_filter'),
77 searchtype => scalar $input->param('searchtype') || 'contain',
78 searchfieldstype => $searchfieldstype,
79 PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
80 view => $view,
83 output_html_with_http_headers $input, $cookie, $template->output;