From 060b78e68f7c36e64dd7cd7f70b134d36b5dc5af Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Wed, 25 Jul 2012 14:11:08 +0200 Subject: [PATCH] Bug 8503: Software error in edit items with EasyAnalyticalRecords Signed-off-by: Jared Camins-Esakov Solves software error when editing items for record with invalid analytic. Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack (cherry picked from commit c4d6ad75182694515d611f3f08172ef3d3fcf7aa) Signed-off-by: Jared Camins-Esakov --- cataloguing/additem.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 8c0c305552..75379cbdca 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -562,13 +562,16 @@ if ( C4::Context->preference('EasyAnalyticalRecords') ) { $analyticfield = '461'; } foreach my $hostfield ($temp->field($analyticfield)){ - if ($hostfield->subfield('0')){ - my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1); - my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostfield->subfield('0')) ); - foreach my $hostitem ($hostrecord->field($itemfield)){ - if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ - push (@fields, $hostitem); - push (@hostitemnumbers, $hostfield->subfield('9')); + my $hostbiblionumber = $hostfield->subfield('0'); + if ($hostbiblionumber){ + my $hostrecord = GetMarcBiblio($hostbiblionumber, 1); + if ($hostrecord) { + my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); + foreach my $hostitem ($hostrecord->field($itemfield)){ + if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ + push (@fields, $hostitem); + push (@hostitemnumbers, $hostfield->subfield('9')); + } } } } -- 2.39.5