From 45a5ca407e3fd639023251d5c706b31a9a38cd2e Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Tue, 6 Jan 2026 21:06:05 +0000 Subject: [PATCH] Bug 41535: Fix UNIMARC fields used for bundles Test plan : 1 - Without patch : Set EasyAnalyticalRecords to 1 2 - Create a Parent record with 1 item with a barcode. 3 - Edit the record to make it a collection (edit record and set the 7th character as "c" in the 000/leader). 4 - Create another record (call it "Child") with 1 item with a barcode as well. 5 - On the Parent record holdings table, click on "manage bundles" 6 - Add the child item with "Add Marc Link" enabled (using child-item's barcode). 7 - Check MARC view on the Parent Record, child items data should be in a 462 field. 8 - Check MARC view on the Child record, host record data should be in a 461 field. 9 - Apply patch and restart_all 10 - Edit Parent and Child records and remove the links in 461/462. 11 - repeat step 6 12 - in Parent record the child item data should now be in 464 13 - in Child record the parent item data should now be in 462 --- Koha/Biblio.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 32d62048ef1..549a56513a2 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -750,7 +750,7 @@ sub _host_itemnumbers { my $marcflavour = C4::Context->preference("marcflavour"); my $analyticfield = '773'; if ( $marcflavour eq 'UNIMARC' ) { - $analyticfield = '461'; + $analyticfield = '462'; } my $marc_record = $self->metadata->record; my @itemnumbers; @@ -2131,8 +2131,8 @@ sub generate_marc_host_field { } } - # Construct 461 link field - $link_field = MARC::Field->new( 461, '0', ' ', @sfd ); + # Construct 462 link field + $link_field = MARC::Field->new( 462, '0', ' ', @sfd ); } return $link_field; @@ -2157,7 +2157,7 @@ sub unlink_marc_host { } my $record = $self->metadata->record; - my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '773' : '461'; + my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '773' : '462'; my @fields = $record->field($field_number); foreach my $field (@fields) { @@ -2223,7 +2223,7 @@ sub link_marc_bundled_item { } my $record = $self->metadata->record; - my $tag = C4::Context->preference('marcflavour') eq 'UNIMARC' ? '462' : '774'; + my $tag = C4::Context->preference('marcflavour') eq 'UNIMARC' ? '464' : '774'; # Remove fields that references the same itemnumber # to avoid duplicates @@ -2262,7 +2262,7 @@ sub unlink_marc_bundled_item { } my $record = $self->metadata->record; - my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '774' : '462'; + my $field_number = C4::Context->preference('marcflavour') eq 'MARC21' ? '774' : '464'; my @fields = $record->field($field_number); foreach my $field (@fields) { -- 2.39.5