Bugzilla – Attachment 40747 Details for
Bug 14483
Warns when printing summary slip for patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14483: Silences warns triggered when printing summary slip for patron
Bug-14483-Silences-warns-triggered-when-printing-s.patch (text/plain), 4.00 KB, created by
Aleisha Amohia
on 2015-07-01 05:38:20 UTC
(
hide
)
Description:
Bug 14483: Silences warns triggered when printing summary slip for patron
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2015-07-01 05:38:20 UTC
Size:
4.00 KB
patch
obsolete
>From 377ce2e207c44c7447daffb78605c6ebab0f8a6e Mon Sep 17 00:00:00 2001 >From: Aleisha <aleishaamohia@hotmail.com> >Date: Wed, 1 Jul 2015 02:53:36 +0000 >Subject: [PATCH] Bug 14483: Silences warns triggered when printing summary > slip for patron > >Use of uninitialized value $roadtype > >To test: >1) Go to any patron's page, click Print --> Print summary >2) Notice warns in error log >3) Click cancel, apply patch, reload page >4) Click Print --> Print summary >5) Notice warns are gone and page still works correctly >--- > members/summary-print.pl | 106 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 106 insertions(+) > create mode 100755 members/summary-print.pl > >diff --git a/members/summary-print.pl b/members/summary-print.pl >new file mode 100755 >index 0000000..fa2efaa >--- /dev/null >+++ b/members/summary-print.pl >@@ -0,0 +1,106 @@ >+#!/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} ); >+$roadtype //= ''; >+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 ); >+ >+ $row{date_due} = $row{date_due_sql}; >+ >+ push( @{$return}, \%row ); >+ } >+ >+ @{$return} = sort { $a->{date_due} <=> $b->{date_due} } @{$return}; >+ >+ return $return; >+} >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14483
: 40747 |
40770