From 098002de65bcdafcd3220e12804be2e7630fe3fe Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 24 Jun 2021 14:37:37 +0000 Subject: [PATCH] Bug 28628: Make heading search form match related indexed heading Test plan (UNIMARC exemple): - create a biblio with the following data in tag 700: - $a Vidard - $b Mathieu - $d 1971-... - save. => a new authority is created with the following heading "Vidard Mathieu 1971-.." - create an other biblio with the same value in tag 700. => again a new authority is created with the same heading. - apply this patch and repeat the test plan - The 2nd 700 tag should map to the same authority. --- C4/Biblio.pm | 2 +- C4/Heading/UNIMARC.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 68ff863..5b10db7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -611,7 +611,7 @@ sub LinkBibHeadingsToAuthorities { # be included in the authority record. Strip those before creation next unless @auth_subfields; # Don't try to create a record if we have no fields; my $last_sub = pop @auth_subfields; - $last_sub =~ s/[\s]*[,.:=;!%\/][\s]*$//; + $last_sub =~ s/[\s]*[-,.:=;!%\/][\s]*$//; push @auth_subfields, $last_sub; my $authfield = MARC::Field->new( $authority_type->auth_tag_to_report, '', '', @auth_subfields ); $marcrecordauth->insert_fields_ordered($authfield); diff --git a/C4/Heading/UNIMARC.pm b/C4/Heading/UNIMARC.pm index f1b5287..c00ab14 100644 --- a/C4/Heading/UNIMARC.pm +++ b/C4/Heading/UNIMARC.pm @@ -160,7 +160,7 @@ sub _get_search_heading { my $code = $subfields[$i]->[0]; my $code_re = quotemeta $code; my $value = $subfields[$i]->[1]; - $value =~ s/[-,.:=;!%\/]*$//; + $value =~ s/[\s]*[-,.:=;!%\/][\s]*$//; next unless $subfields =~ qr/$code_re/; if ($first) { $first = 0; -- 2.7.4