Bug 12971 - Regression: Patron print summary doesn't show checkouts

A patron's print summary should contain a list of checked out items
as it did in 3.16.2 and earlier.

Please note, as of 3.16.2 reserves were no longer part of the print
summary and thus are not part of this bug fixing patch.

Test Plan:
1) Find a patron with checked out items
2) Choose Print -> Print summary
3) Note the lack of a list of checkouts
4) Apply this patch
5) Reload the page
5) Print the summary again
6) Note the list of checkouts

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, apart from the missing status information
that Owen already noted on the bug.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Kyle Hall 2014-11-17 12:31:05 -05:00 committed by Tomas Cohen Arazi
parent 6cd7c24c11
commit 255f02cad1
3 changed files with 194 additions and 111 deletions

View file

@ -115,7 +115,7 @@ function export_barcodes() {
}
var slip_re = /slip/;
function printx_window(print_type) {
var handler = print_type.match(slip_re) ? "printslip" : "moremember";
var handler = print_type.match(slip_re) ? "printslip" : "summary-print";
window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
return false;
}

View file

@ -1,121 +1,103 @@
[% USE Koha %]
[% USE Branches %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Summary for [% firstname %] [% surname %] ([% cardnumber %])</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
[% INCLUDE 'slip-print.inc' #printThenClose %]
<body id="pat_moremember-print" class="pat" onload="printThenClose();">
<title>Summary for [% firstname %] [% surname %] ([% cardnumber %])</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
[% INCLUDE 'slip-print.inc' #printThenClose %]
</head>
<body>
<body id="pat_moremember-print" class="pat" onload="printThenClose();">
<div id="main">
<h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">Account summary: [% firstname %] [% surname %] ([% cardnumber %])</a></h3>
<div id="main">
<ul>
<li>[% address %]<br />[% address2 %]</li>
<li>[% city %], [% zipcode %]</li>
<li>[% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]</li>
<li>[% IF ( email ) %][% email %][% ELSE %](no primary email on file)[% END %]</li>
[% IF ( emailpro ) %]
<li>[% emailpro %]</li>
[% END %]
<li>Registration date: [% dateenrolled | $KohaDates %]</li>
<li>Expiration date: [% dateexpiry | $KohaDates %]</li>
<li>Library: [% Branches.GetName( branchcode ) %]</li>
<li>Category: [% description %]</li>
</ul>
<h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">Account summary: [% firstname %] [% surname %] ([% cardnumber %])</a></h3>
[% IF ( issues ) %]
<table>
<caption>Items checked out</caption>
<tr>
<th>Title</th>
<th>Author</th>
<th>Call no</th>
<th>Item type</th>
<th>Date due</th>
<th>Barcode</th>
<th>Charge</th>
<th>Price</th>
<th>Status</th>
</tr>
<ul><li>[% address %]<br />[% address2 %]</li><li>[% city %], [% zipcode %]</li>
<li>[% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]</li>
<li>[% IF ( email ) %][% email %][% ELSE %](no primary email on file)[% END %]</li>
[% IF ( emailpro ) %]<li>[% emailpro %]</li>[% END %]
<li>Registration date: [% dateenrolled %]</li>
<li>Expiration date: [% dateexpiry %]</li>
<li>Library: [% branchname %]</li>
<li>Category: [% description %]</li>
</ul>
[% FOREACH issueloo IN issues %]
[% IF ( issueloo.red ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
<td>
[% issueloo.title |html %]
<a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber %]&amp;biblionumber=[% issueloo.biblionumber %]&amp;bi=[% issueloo.biblioitemnumber %]"></a>
</td>
<td>[% issueloo.author %]</td>
<td>[% issueloo.itemcallnumber %]</td>
<td>[% issueloo.itemtype_description %]</td>
<td>[% issueloo.date_due %]</td>
<td>[% issueloo.barcode %]</td>
<td>[% issueloo.charge %]</td>
<td>[% issueloo.replacementprice %]</td>
<td>[% IF ( issueloo.red ) %]Overdue![% ELSE %]&nbsp;[% END %]</td>
</tr>
[% END %]
[% IF ( issueloop ) %]
<table>
<caption>Items checked out</caption>
<tr>
<th>Title</th>
<th>Author</th>
<th>Call no</th>
<th>Item type</th>
<th>Date due</th>
<th>Barcode</th>
<th>Charge</th>
<th>Price</th>
<th>Status</th>
</tr>
[% FOREACH issueloo IN issueloop %]
[% IF ( issueloo.red ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
<td>
[% issueloo.title |html %]
<a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber %]&amp;biblionumber=[% issueloo.biblionumber %]&amp;bi=[% issueloo.biblioitemnumber %]">
</a>
</td>
<td>[% issueloo.author %]</td>
<td>[% issueloo.itemcallnumber %]</td>
<td>[% issueloo.itemtype_description %]</td>
<td>[% issueloo.date_due %]</td>
<td>[% issueloo.barcode %]</td>
<td>[% issueloo.charge %]</td>
<td>[% issueloo.replacementprice %]</td>
<td>[% IF ( issueloo.red ) %]Overdue![% ELSE %]&nbsp;[% END %]</td>
</tr>
[% END %]
<tr>
<td colspan="6" style="text-align: right; font-weight:bold;">Totals:</td>
<td>[% totaldue %]</td>
<td>[% totalprice %]</td>
<td colspan="3">&nbsp;</td>
</tr>
</table>
[% END %]
[% IF ( reserveloop ) %]
<table>
<caption>Items on Reserve</caption>
<tr>
<th>Title</th>
<th>Author</th>
<th>Format</th>
<th>Requested</th>
</tr>
[% FOREACH reserveloo IN reserveloop %]
<tr>
<td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% reserveloo.biblionumber %]">[% reserveloo.btitle %]</a></td>
<td>[% reserveloo.author %]</td>
<td>[% reserveloo.description %]</td>
<td>[% reserveloo.reservedate2 %]</td>
</tr>
[% END %]
</table>
[% END %]
[% IF ( accounts && ( totaldue != '0.00' ) ) %]
<table>
<caption>Account fines and payments</caption>
<tr>
<th>Description of charges</th>
<th>Date</th>
<th>Amount</th>
<th>Outstanding</th>
</tr>
[% FOREACH account IN accounts %]
[% NEXT IF account.amountoutstanding == '0.00' %]
<tr>
<td>
[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% END %]
[% account.description %]&nbsp;[% IF ( account.printtitle ) %] [% account.title |html %][% END %]
[% IF ( account.itemnumber ) %]</a>[% END %]
</td>
<td>[% account.date | $KohaDates %]</td>
<td>[% account.amount %]</td>
<td>[% account.amountoutstanding %]</td>
</tr>
<tr>
<td colspan="6" style="text-align: right; font-weight:bold;">Totals:</td>
<td>[% totaldue %]</td>
<td>[% totalprice %]</td>
<td colspan="3">&nbsp;</td>
</tr>
</table>
[% END %]
[% IF ( accounts && ( totaldue != '0.00' ) ) %]
<table>
<caption>Account fines and payments</caption>
<tr>
<th>Description of charges</th>
<th>Date</th>
<th>Amount</th>
<th>Outstanding</th>
</tr>
[% FOREACH account IN accounts %]
[% NEXT IF account.amountoutstanding == '0.00' %]
<tr>
<td>
[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% END %]
[% account.description %]&nbsp;[% IF ( account.printtitle ) %] [% account.title |html %][% END %]
[% IF ( account.itemnumber ) %]</a>[% END %]
</td>
<td>[% account.date | $KohaDates %]</td>
<td>[% account.amount %]</td>
<td>[% account.amountoutstanding %]</td>
</tr>
[% END %]
<tfoot>
<tr>
<td colspan="3">Total due</td>
<td colspan="2">[% totaldue %]</td>
</tr>
</tfoot>
</table>
[% END %]
<tfoot>
<tr>
<td colspan="3">Total due</td>
<td colspan="2">[% totaldue %]</td>
</tr>
</tfoot>
</table>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

101
members/summary-print.pl Executable file
View file

@ -0,0 +1,101 @@
#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Members;
use C4::Koha qw( getitemtypeinfo );
use C4::Circulation qw( GetIssuingCharges );
my $input = CGI->new;
my $borrowernumber = $input->param('borrowernumber');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "members/moremember-print.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { circulate => "circulate_remaining_permissions" },
debug => 1,
}
);
my $data = GetMember( 'borrowernumber' => $borrowernumber );
my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
foreach my $accountline (@$accts) {
$accountline->{amount} = sprintf '%.2f', $accountline->{amount};
$accountline->{amountoutstanding} = sprintf '%.2f',
$accountline->{amountoutstanding};
if ( $accountline->{accounttype} ne 'F'
&& $accountline->{accounttype} ne 'FU' )
{
$accountline->{printtitle} = 1;
}
}
my $roadtype =
C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} );
our $totalprice = 0;
$template->param(
%$data,
borrowernumber => $borrowernumber,
address => $data->{'streetnumber'} . " $roadtype " . $data->{'address'},
accounts => $accts,
totaldue => sprintf( "%.2f", $total ),
issues => build_issue_data( GetPendingIssues($borrowernumber) ),
totalprice => $totalprice,
);
output_html_with_http_headers $input, $cookie, $template->output;
sub build_issue_data {
my $issues = shift;
my $return;
my $today = DateTime->now( time_zone => C4::Context->tz );
$today->truncate( to => 'day' );
foreach my $issue ( @{$issues} ) {
my %row = %{$issue};
$totalprice += $issue->{replacementprice};
#find the charge for an item
my ( $charge, $itemtype ) =
GetIssuingCharges( $issue->{itemnumber}, $borrowernumber );
my $itemtypeinfo = getitemtypeinfo($itemtype);
$row{'itemtype_description'} = $itemtypeinfo->{description};
$row{'charge'} = sprintf( "%.2f", $charge );
push( @{$return}, \%row );
}
return $return;
}