Bug 15208: Followup to reorder words
[koha.git] / members / member.pl
blob1cc5ac560690888f54ef97e956a46196e87b04b1
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 C4::Branch;
31 use C4::Category;
32 use C4::Members qw( GetMember );
33 use Koha::DateUtils;
34 use Koha::List::Patron;
36 my $input = new CGI;
38 my ($template, $loggedinuser, $cookie)
39 = get_template_and_user({template_name => "members/member.tt",
40 query => $input,
41 type => "intranet",
42 authnotrequired => 0,
43 flagsrequired => {borrowers => 1},
44 });
46 my $theme = $input->param('theme') || "default";
48 my $searchmember = $input->param('searchmember');
49 my $quicksearch = $input->param('quicksearch') // 0;
51 if ( $quicksearch and $searchmember ) {
52 my $branchcode;
53 if ( C4::Branch::onlymine ) {
54 my $userenv = C4::Context->userenv;
55 $branchcode = $userenv->{'branch'};
57 my $member = GetMember(
58 cardnumber => $searchmember,
59 ( $branchcode ? ( branchcode => $branchcode ) : () ),
61 if( $member ){
62 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=" . $member->{borrowernumber});
63 exit;
67 my $searchfieldstype = $input->param('searchfieldstype') || 'standard';
69 if ( $searchfieldstype eq "dateofbirth" ) {
70 $searchmember = output_pref({dt => dt_from_string($searchmember), dateformat => 'iso', dateonly => 1});
73 $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' );
75 my $view = $input->request_method() eq "GET" ? "show_form" : "show_results";
77 $template->param(
78 patron_lists => [ GetPatronLists() ],
79 searchmember => $searchmember,
80 branchcode_filter => $input->param('branchcode_filter'),
81 categorycode_filter => $input->param('categorycode_filter'),
82 searchtype => $input->param('searchtype') || 'start_with',
83 searchfieldstype => $searchfieldstype,
84 PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
85 view => $view,
88 output_html_with_http_headers $input, $cookie, $template->output;