Bug 9788: Improvements when calling GetReservesFromItemnumber
[koha.git] / members / members-home.pl
blob1d8f1e5e9afedf864619021b344af7a1138f1f84
1 #!/usr/bin/perl
3 # Parts Copyright Biblibre 2010
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it under the
7 # terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
9 # version.
11 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with Koha; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 use strict;
20 use warnings;
22 use CGI;
23 use C4::Auth;
24 use C4::Output;
25 use C4::Context;
26 use C4::Members;
27 use C4::Branch;
28 use C4::Category;
29 use Koha::Borrower::Modifications;
31 my $query = new CGI;
32 my $branch = $query->param('branchcode');
33 my $template_name;
35 $branch = q{} unless defined $branch;
37 my ($template, $loggedinuser, $cookie)
38 = get_template_and_user({template_name => "members/member.tmpl",
39 query => $query,
40 type => "intranet",
41 authnotrequired => 0,
42 flagsrequired => {borrowers => 1},
43 debug => 1,
44 });
46 my $branches = GetBranches;
47 my @branchloop;
48 foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) {
49 push @branchloop, {
50 value => $_,
51 selected => ($branches->{$_}->{branchcode} eq $branch),
52 branchname => $branches->{$_}->{branchname},
56 my @categories;
57 my $no_categories;
58 my $no_add = 0;
59 if(scalar(@branchloop) < 1){
60 $no_add = 1;
61 $template->param(no_branches => 1);
63 else {
64 $template->param(branchloop=>\@branchloop);
67 @categories=C4::Category->all;
68 if(scalar(@categories) < 1){
69 $no_categories = 1;
72 if($no_categories && C4::Context->preference("AddPatronLists")=~/code/){
73 $no_add = 1;
74 $template->param(no_categories => 1);
76 else {
77 $template->param(categories=>\@categories);
81 my $pending_borrower_modifications =
82 Koha::Borrower::Modifications->GetPendingModificationsCount( $branch );
84 $template->param(
85 "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
86 no_add => $no_add,
87 pending_borrower_modifications => $pending_borrower_modifications,
89 $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' );
91 output_html_with_http_headers $query, $cookie, $template->output;