From e726250f576e4be9135e9d6ac099b97f9781dd09 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 31 Jan 2014 13:00:18 -0300 Subject: [PATCH] Bug 11182: (QA followup) warning if itemBarcodeFallbackSearch set To reproduce: - On top of the previous patches, if you enable the itemBarcodeFallbackSearch syspref and do a search for a term that returns at least one result, there will be warnings for each result without items attached. To test: - In the checkout form enter a term that should return results (some of them without items attached) => There are warnings on the logs regarding a split of undef variable - Apply the patch - Repeat the first step => No warings --- circ/circulation.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 2ee91b9..396515a 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -312,10 +312,12 @@ if ($barcode) { MARC::Record->new_from_usmarc($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 ); -- 1.8.3.2