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>.
27 use C4::Auth qw( get_template_and_user );
28 use C4::Output qw( output_html_with_http_headers );
30 use Koha::List::Patron qw( GetPatronLists );
32 use Koha::Patron::Attribute::Types;
36 my ($template, $loggedinuser, $cookie)
37 = get_template_and_user({template_name => "members/member.tt",
40 flagsrequired => {borrowers => 'edit_borrowers'},
43 my $theme = $input->param('theme') || "default";
45 my $searchmember = $input->param('searchmember');
46 my $quicksearch = $input->param('quicksearch') // 0;
47 my $circsearch = $input->param('circsearch') // 0;
49 if ( $quicksearch and $searchmember && !$circsearch ) {
51 if ( C4::Context::only_my_library ) {
52 my $userenv = C4::Context->userenv;
53 $branchcode = $userenv->{'branch'};
55 my $patron = Koha::Patrons->find( { cardnumber => $searchmember } );
58 and ( ( $branchcode and $patron->branchcode eq $branchcode )
59 or ( not $branchcode ) )
62 print $input->redirect( "/cgi-bin/koha/members/moremember.pl?borrowernumber=" . $patron->borrowernumber );
67 my $searchfieldstype = $input->param('searchfieldstype') || 'standard';
68 my $searchtype = $input->param('searchtype');
70 $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' );
72 my $defer_loading = $input->request_method() eq "GET" && !$circsearch ? 1 : 0;
75 patron_lists => [ GetPatronLists() ],
76 searchmember => $searchmember,
77 branchcode_filter => scalar $input->param('branchcode_filter'),
78 categorycode_filter => scalar $input->param('categorycode_filter'),
79 searchtype => $searchtype,
80 searchfieldstype => $searchfieldstype,
81 PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
82 do_not_defer_loading => !$defer_loading,
83 circsearch => $circsearch,
84 attribute_type_codes => ( C4::Context->preference('ExtendedPatronAttributes')
85 ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ]
89 output_html_with_http_headers $input, $cookie, $template->output;