From 255f02cad1822965685adac729a19b17769652ea Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 17 Nov 2014 12:31:05 -0500 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer 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 --- .../prog/en/includes/members-toolbar.inc | 2 +- .../en/modules/members/moremember-print.tt | 196 ++++++++---------- members/summary-print.pl | 101 +++++++++ 3 files changed, 191 insertions(+), 108 deletions(-) create mode 100755 members/summary-print.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 870f254737..828c564955 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -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 %]&print=" + print_type, "printwindow"); return false; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt index 4c7107245f..e60a8e13ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -1,121 +1,103 @@ [% USE Koha %] +[% USE Branches %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] -Summary for [% firstname %] [% surname %] ([% cardnumber %]) - - - -[% INCLUDE 'slip-print.inc' #printThenClose %] - - + Summary for [% firstname %] [% surname %] ([% cardnumber %]) + + + + [% INCLUDE 'slip-print.inc' #printThenClose %] - + +
+

Account summary: [% firstname %] [% surname %] ([% cardnumber %])

-
+
    +
  • [% address %]
    [% address2 %]
  • +
  • [% city %], [% zipcode %]
  • +
  • [% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]
  • +
  • [% IF ( email ) %][% email %][% ELSE %](no primary email on file)[% END %]
  • + [% IF ( emailpro ) %] +
  • [% emailpro %]
  • + [% END %] +
  • Registration date: [% dateenrolled | $KohaDates %]
  • +
  • Expiration date: [% dateexpiry | $KohaDates %]
  • +
  • Library: [% Branches.GetName( branchcode ) %]
  • +
  • Category: [% description %]
  • +
-

Account summary: [% firstname %] [% surname %] ([% cardnumber %])

+ [% IF ( issues ) %] + + + + + + + + + + + + + -
  • [% address %]
    [% address2 %]
  • [% city %], [% zipcode %]
  • -
  • [% IF ( phone ) %][% phone %][% ELSE %](no phone number on file)[% END %]
  • -
  • [% IF ( email ) %][% email %][% ELSE %](no primary email on file)[% END %]
  • -[% IF ( emailpro ) %]
  • [% emailpro %]
  • [% END %] -
  • Registration date: [% dateenrolled %]
  • -
  • Expiration date: [% dateexpiry %]
  • -
  • Library: [% branchname %]
  • -
  • Category: [% description %]
  • -
+ [% FOREACH issueloo IN issues %] + [% IF ( issueloo.red ) %][% ELSE %][% END %] + + + + + + + + + + + [% END %] -[% IF ( issueloop ) %] -
Items checked out
TitleAuthorCall noItem typeDate dueBarcodeChargePriceStatus
+ [% issueloo.title |html %] + + [% issueloo.author %][% issueloo.itemcallnumber %][% issueloo.itemtype_description %][% issueloo.date_due %][% issueloo.barcode %][% issueloo.charge %][% issueloo.replacementprice %][% IF ( issueloo.red ) %]Overdue![% ELSE %] [% END %]
- - - - - - - - - - - - + + + + + + +
Items checked out
TitleAuthorCall noItem typeDate dueBarcodeChargePriceStatus
Totals:[% totaldue %][% totalprice %] 
+ [% END %] - [% FOREACH issueloo IN issueloop %] - [% IF ( issueloo.red ) %][% ELSE %][% END %] - - [% issueloo.title |html %] - - - - [% issueloo.author %] - [% issueloo.itemcallnumber %] - [% issueloo.itemtype_description %] - [% issueloo.date_due %] - [% issueloo.barcode %] - [% issueloo.charge %] - [% issueloo.replacementprice %] - [% IF ( issueloo.red ) %]Overdue![% ELSE %] [% END %] - - [% END %] - - Totals: - [% totaldue %] - [% totalprice %] -   - - - [% END %] - -[% IF ( reserveloop ) %] - - - - - - - - + [% IF ( accounts && ( totaldue != '0.00' ) ) %] +
Items on Reserve
TitleAuthorFormatRequested
+ + + + + + + -[% FOREACH reserveloo IN reserveloop %] - - - - - - - [% END %] -
Account fines and payments
Description of chargesDateAmountOutstanding
[% reserveloo.btitle %][% reserveloo.author %][% reserveloo.description %][% reserveloo.reservedate2 %]
-[% END %] + [% FOREACH account IN accounts %] + [% NEXT IF account.amountoutstanding == '0.00' %] + + + [% IF ( account.itemnumber ) %][% END %] + [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] + [% IF ( account.itemnumber ) %][% END %] + + [% account.date | $KohaDates %] + [% account.amount %] + [% account.amountoutstanding %] + + [% END %] -[% IF ( accounts && ( totaldue != '0.00' ) ) %] - - - - - - - - - [% FOREACH account IN accounts %] - [% NEXT IF account.amountoutstanding == '0.00' %] - - - - - - + + + + + + +
Account fines and payments
Description of chargesDateAmountOutstanding
- [% IF ( account.itemnumber ) %][% END %] - [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] - [% IF ( account.itemnumber ) %][% END %] - [% account.date | $KohaDates %][% account.amount %][% account.amountoutstanding %]
Total due[% totaldue %]
[% END %] - - - Total due - [% totaldue %] - - - -[% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/members/summary-print.pl b/members/summary-print.pl new file mode 100755 index 0000000000..ea227dd6f0 --- /dev/null +++ b/members/summary-print.pl @@ -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; +} -- 2.39.5