Bug 12485 - Show OPAC search history when opacuserlogin is OFF
[koha_fer] / circ / circulation.pl
index 216bfc3..91851d2 100755 (executable)
@@ -315,10 +315,12 @@ if ($barcode) {
                     C4::Search::new_record_from_zebra('biblioserver',$hit) );
 
                 # offer all barcodes individually
-                foreach my $barcode ( sort split(/\s*\|\s*/, $chosen->{barcode}) ) {
-                    my %chosen_single = %{$chosen};
-                    $chosen_single{barcode} = $barcode;
-                    push( @options, \%chosen_single );
+                if ( $chosen->{barcode} ) {
+                    foreach my $barcode ( sort split(/\s*\|\s*/, $chosen->{barcode}) ) {
+                        my %chosen_single = %{$chosen};
+                        $chosen_single{barcode} = $barcode;
+                        push( @options, \%chosen_single );
+                    }
                 }
             }
             $template->param( options => \@options );
@@ -485,7 +487,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'}
         );
@@ -660,7 +662,7 @@ $amountold =~ s/^.*\$//;    # remove upto the $, if any
 
 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
 
-if ( $borrower->{'category_type'} eq 'C') {
+if ( $borrowernumber && $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;
@@ -737,7 +739,7 @@ $template->param(
     relprevissues              => \@relprevissues,
     displayrelissues           => $displayrelissues,
     inprocess         => $inprocess,
-    is_child          => ($borrower->{'category_type'} eq 'C'),
+    is_child          => ($borrowernumber && $borrower->{'category_type'} eq 'C'),
     circview => 1,
     soundon           => C4::Context->preference("SoundOn"),
     fast_cataloging   => $fast_cataloging,