4 # script to display borrowers reading record
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 use List::MoreUtils qw/any/;
34 use C4::Dates qw/format_date/;
40 my $borrowernumber = undef;
41 my $cardnumber = undef;
43 if ($input->param('cardnumber')) {
44 $cardnumber = $input->param('cardnumber');
45 $data = GetMember(cardnumber => $cardnumber);
46 $borrowernumber = $data->{'borrowernumber'}; # we must define this as it is used to retrieve other data about the patron
48 if ($input->param('borrowernumber')) {
49 $borrowernumber = $input->param('borrowernumber');
50 $data = GetMember(borrowernumber => $borrowernumber);
53 my $order=$input->param('order') || '';
56 $order2="date_due desc";
58 my $limit=$input->param('limit');
60 my $borrowernumber = $input->param('borrowernumber');
61 my $limit = $input->param('limit');
62 my $order = $input->param('order') || '';
64 $order = "issuestimestamp desc" if not any { $order =~ $_ } ('issuestimestamp', 'title', 'author', 'returndate');
67 my $data=GetMember('borrowernumber'=>$borrowernumber);
69 >>>>>>> (MT #2920) fix reading record scripts:members/readingrec.pl
72 if ($limit eq 'full'){
79 my ( $issues ) = GetAllIssues($borrowernumber,$order,$limit);
81 my ($template, $loggedinuser, $cookie)
82 = get_template_and_user({template_name => "members/readingrec.tmpl",
86 flagsrequired => {borrowers => 1},
92 foreach my $issue (@{$issues}){
94 $line{issuestimestamp} = format_date($issue->{'issuestimestamp'});
95 $line{biblionumber} = $issue->{'biblionumber'};
96 $line{title} = $issue->{'title'};
97 $line{author} = $issue->{'author'};
98 $line{classification} = $issue->{'classification'} || $issue->{'itemcallnumber'};
99 $line{date_due} = format_date($issue->{'date_due'});
100 $line{returndate} = format_date($issue->{'returndate'});
101 $line{issuedate} = format_date($issue->{'issuedate'});
102 $line{issuingbranch} = GetBranchName($issues->[$i]->{'issuingbranch'});
103 $line{renewals} = $issue->{'renewals'};
104 $line{barcode} = $issue->{'barcode'};
105 $line{volumeddesc} = $issue->{'volumeddesc'};
106 push(@loop_reading,\%line);
109 if ( $data->{'category_type'} eq 'C') {
110 my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
111 my $cnt = scalar(@$catcodes);
112 $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
113 $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
116 $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
121 my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
122 $template->param( picture => 1 ) if $picture;
125 readingrecordview => 1,
126 biblionumber => $data->{'biblionumber'},
127 title => $data->{'title'},
128 initials => $data->{'initials'},
129 surname => $data->{'surname'},
130 borrowernumber => $borrowernumber,
132 firstname => $data->{'firstname'},
133 cardnumber => $data->{'cardnumber'},
134 categorycode => $data->{'categorycode'},
135 category_type => $data->{'category_type'},
136 # category_description => $data->{'description'},
137 categoryname => $data->{'description'},
138 address => $data->{'address'},
139 address2 => $data->{'address2'},
140 city => $data->{'city'},
141 zipcode => $data->{'zipcode'},
142 country => $data->{'country'},
143 phone => $data->{'phone'},
144 email => $data->{'email'},
145 branchcode => $data->{'branchcode'},
146 is_child => ($data->{'category_type'} eq 'C'),
147 branchname => GetBranchName($data->{'branchcode'}),
148 showfulllink => (scalar @loop_reading > 50),
149 loop_reading => \@loop_reading);
150 output_html_with_http_headers $input, $cookie, $template->output;