Bug 19350 - Holds without link in 773 trigger SQL::Abstract::puke

Test:
1. find bibio without items which has something in field 773
   (for us, it's article) but doesn't have 0 or 9 (host item entry)
2. click on hold in left menu
3. verify application error
4. apply patch and verify that it works

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
This commit is contained in:
Dobrica Pavlinusic 2017-09-20 16:01:16 +02:00 committed by Jonathan Druart
parent 9dca694b04
commit 5c873a408f

View file

@ -1341,7 +1341,12 @@ sub get_hostitemnumbers_of {
foreach my $hostfield ( $marcrecord->field($tag) ) {
my $hostbiblionumber = $hostfield->subfield($biblio_s);
next unless $hostbiblionumber; # have tag, don't have $biblio_s subfield
my $linkeditemnumber = $hostfield->subfield($item_s);
if ( ! $linkeditemnumber ) {
warn "ERROR biblionumber $biblionumber has 773^0, but doesn't have 9";
next;
}
my $is_from_biblio = Koha::Items->search({ itemnumber => $linkeditemnumber, biblionumber => $hostbiblionumber });
push @returnhostitemnumbers, $linkeditemnumber
if $is_from_biblio;