[Koha-patches] [PATCH] bug_11182: get rid of some warnings

Srdjan srdjan at catalyst.net.nz
Fri Nov 1 08:25:52 CET 2013


To testi - circulation:
* For a child patron, check that "Upgrade to adult" link on the "More"
  drop-down is clickable
* Set sys pref FineNotifyAtCheckin to yes (Notify), and check in an
  overdue item that attracts fine. Fine amount should be displayed.
---
 circ/circulation.pl | 6 +++---
 circ/returns.pl     | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/circ/circulation.pl b/circ/circulation.pl
index 9769731..3f287ed 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -482,7 +482,7 @@ sub build_issue_data {
         ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges(
             $it->{'itemnumber'}, $it->{'borrowernumber'}
         );
-        $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
+        $it->{'charge'} = sprintf("%.2f", $it->{'charge'}) if defined $it->{'charge'};
         my ($can_renew, $can_renew_error) = CanBookBeRenewed( 
             $it->{'borrowernumber'},$it->{'itemnumber'}
         );
@@ -650,7 +650,7 @@ $amountold =~ s/^.*\$//;    # remove upto the $, if any
 
 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
 
-if ( $borrower->{'category_type'} eq 'C') {
+if ( $borrower->{'category_type'} && $borrower->{'category_type'} eq 'C') {
     my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
     my $cnt = scalar(@$catcodes);
     $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
@@ -748,7 +748,7 @@ $template->param(
     inprocess         => $inprocess,
     memberofinstution => $member_of_institution,
     CGIorganisations  => $CGIorganisations,
-    is_child          => ($borrower->{'category_type'} eq 'C'),
+    is_child          => ($borrower->{'category_type'} && $borrower->{'category_type'} eq 'C'),
     circview => 1,
     soundon           => C4::Context->preference("SoundOn"),
     fast_cataloging   => $fast_cataloging,
diff --git a/circ/returns.pl b/circ/returns.pl
index 93f36f2..1ab23ba 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -75,7 +75,8 @@ my ( $template, $librarian, $cookie ) = get_template_and_user(
 my $branches = GetBranches();
 my $printers = GetPrinters();
 
-my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : "";
+my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : undef;
+$printer ||= "";
 my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
 
 my $userenv_branch = C4::Context->userenv->{'branch'} || '';
@@ -266,7 +267,7 @@ if ($barcode) {
 
         if ( C4::Context->preference("FineNotifyAtCheckin") ) {
             my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrower->{'borrowernumber'} );
-            if ($fines > 0) {
+            if ($fines && $fines > 0) {
                 $template->param( fines => sprintf("%.2f",$fines) );
                 $template->param( fineborrowernumber => $borrower->{'borrowernumber'} );
             }
-- 
1.8.1.2


More information about the Koha-patches mailing list