From d5565a723d415210062a023d0da0b358f4a8d3a1 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 25 Feb 2026 15:16:27 +0000 Subject: [PATCH] Bug 41931: While creating EasyAnalitics empty subfields are (often) created. In C4::Biblio::PrepHostMarcField a whole set of subfields is addes to the field 773 regardless if a respective value exists or not. This often creates empty subfields and generates warnings. Test plan: ========== 1. Set EasyAnalyticalRecords to Show. 2. Go to biblio #1, copy the barcode. 3. Go to biblio #2, chose Edit > Link to host record > enter the barcode. 4. Examine the biblio #2: a) a new "virtual" item from biblio #1 is being displayed; b) a 773 field has been inserted, but with empty subfields $d & $x. 5. There should be warnings in plack-intranet-error.log like: [WARN] Use of uninitialized value in join or string at /usr/share/perl5/MARC/Field.pm line 696. 6. Apply the patch ; restart_all. 7. Go to biblio #3 (!), chose Edit > Link to host record > enter the barcode. 8. Examine the biblio #3: a) a new "virtual" item from biblio #1 is being displayed; b) a 773 field has been inserted, with no empty subfields. 9. No new warnings. Sponsored-by: Ignatianum University in Cracow Signed-off-by: Roman Dolny --- C4/Biblio.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 1f1f897e54..f203ca75ab 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2049,19 +2049,19 @@ sub PrepHostMarcField { my $issn = $hostrecord->subfield( '022', 'a' ); my $isbn = $hostrecord->subfield( '020', 'a' ); - $hostmarcfield = MARC::Field->new( - 773, '0', '', + my @subfields = ( '0' => $hostbiblionumber, '9' => $hostitemnumber, - 'a' => $mainentry, - 'b' => $ed, - 'd' => $qualinfo, - 'o' => $barcode, - 't' => $title, - 'w' => $recctrlno, - 'x' => $issn, - 'z' => $isbn ); + push @subfields, 'a', $mainentry if $mainentry; + push @subfields, 'b', $ed if $ed; + push @subfields, 'd', $qualinfo if $qualinfo; + push @subfields, 'o', $barcode if $barcode; + push @subfields, 't', $title if $title; + push @subfields, 'w', $recctrlno if $recctrlno; + push @subfields, 'x', $issn if $issn; + push @subfields, 'z', $isbn if $isbn; + $hostmarcfield = MARC::Field->new( 773, '0', ' ', @subfields ); } elsif ( $marcflavour eq "UNIMARC" ) { $hostmarcfield = MARC::Field->new( 461, '', '', -- 2.39.5