From b3e3c91486935c37a26b41c3109cb6aeb54beada Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 1 May 2013 15:43:19 -0400 Subject: [PATCH] Bug 10169 [Incomplete] Software error if one of multiple titles selected for hold in the OPAC has no items Content-Type: text/plain; charset="utf-8" This patch contains changes suggested by Jared on IRC. This eliminates the ugly error but raises a new problem: The 'Place hold' screen is now blank except for a warning: "ERROR: No biblio record found for biblionumber 5638." The warning is triggered by the variable "bad_biblionumber," set here (opac-reserve.pl lines 362+): # Get relevant biblio data. my $biblioData = $biblioDataHash{$biblioNum}; if (! $biblioData) { $template->param(message=>1, bad_biblionumber=>$biblioNum); &get_out($query, $cookie, $template->output); } I assume this is proper error-handling in the case of placing a single hold, but has never been revised to accommodate multiple holds? Not sure where to go next with it. --- C4/Items.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index d9c31f9..cc9e66d 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1392,9 +1392,10 @@ sub GetItemsLocationInfo { sub GetHostItemsInfo { my ($record) = @_; my @returnitemsInfo; - - if (C4::Context->preference('marcflavour') eq 'MARC21' || - C4::Context->preference('marcflavour') eq 'NORMARC'){ + return unless $record; + if ( (C4::Context->preference('marcflavour') eq 'MARC21' || + C4::Context->preference('marcflavour') eq 'NORMARC') + && $record->field('773') ){ foreach my $hostfield ( $record->field('773') ) { my $hostbiblionumber = $hostfield->subfield("0"); my $linkeditemnumber = $hostfield->subfield("9"); @@ -1406,7 +1407,7 @@ sub GetHostItemsInfo { } } } - } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC'){ + } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC' && $record->field('461') ){ foreach my $hostfield ( $record->field('461') ) { my $hostbiblionumber = $hostfield->subfield("0"); my $linkeditemnumber = $hostfield->subfield("9"); -- 1.7.9.5