Bug 27943: Add support for 7XX equal terms on authorities marc21 display

Currently when a MARC21 authority has 7XX field they do not display on
authority search result page. 7XX is equal term of 1XX based on LC rules.
Applying this patch will enable that feature, which is important for non latin
catalogues.

Test plan:
1) Add a new authority with 1XX and 7XX fields.
2) Try to search that authority and check if 7XX values are displayed
3) Apply this patch
4) Try to search that authority and you will see that 7XX values are displayed
   like "1XX = 7XX"

Sponsored-by: Keratsini-Drapetsona Municipal Library, Greece
Mentored-by: Andreas Roussos
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Works for me!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
George Veranis 2021-07-02 16:41:24 +02:00 committed by Tomas Cohen Arazi
parent 60ed1898a0
commit a8b075a4d3
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
3 changed files with 91 additions and 0 deletions

View File

@ -936,6 +936,8 @@ sub BuildSummary {
my @seefrom;
my @seealso;
my @otherscript;
my @equalterm;
if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
# construct UNIMARC summary, that is quite different from MARC21 one
# accepted form
@ -989,6 +991,8 @@ sub BuildSummary {
use C4::Heading::MARC21;
my $handler = C4::Heading::MARC21->new();
my $subfields_to_report;
my $subfields_to_subdivision="";
my $delimiter = " -- ";
foreach my $field ($record->field('1..')) {
my $tag = $field->tag();
next if "152" eq $tag;
@ -1065,6 +1069,80 @@ sub BuildSummary {
foreach my $field ($record->field('6..')) {
push @notes, { note => $field->as_string(), field => $field->tag() };
}
foreach my $field ($record->field('7..'))
{
my $tag = $field->tag();
if ($tag eq '700') {
$subfields_to_report = 'abcdefghjklmnopqrst';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '710') {
$subfields_to_report = 'abcdefghklmnoprst';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '711') {
$subfields_to_report = 'acdefghklnpqst';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '730') {
$subfields_to_report = 'adfghklmnoprst';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '748') {
$subfields_to_report = 'ab';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '750') {
$subfields_to_report = 'ab';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '751') {
$subfields_to_report = 'a';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '755') {
$subfields_to_report = 'abvxyz';
$subfields_to_subdivision='vxyz';
$delimiter=" -- ";
} elsif ($tag eq '780') {
$subfields_to_report = 'vxyz';
$delimiter=" ";
} elsif ($tag eq '781') {
$subfields_to_report = 'vxyz';
$delimiter=" ";
} elsif ($tag eq '782') {
$subfields_to_report = 'vxyz';
$delimiter=" ";
} elsif ($tag eq '785') {
$subfields_to_report = 'vxyz';
$delimiter=" ";
}
my $heading = $field->as_string($subfields_to_report);
my $subheading = $field->as_string($subfields_to_subdivision,$delimiter);
if(length $subheading > 0 )
{
$heading.=$delimiter.$subheading;
}
if ($subfields_to_report) {
push @equalterm, {
heading => $heading,
hemain => ( $field->subfield( substr($subfields_to_report, 0, 1) ) // undef ),
field => $tag,
};
} else {
push @equalterm, {
heading => $field->as_string(),
hemain => ( $field->subfield( 'a' ) // undef ),
field => $tag,
};
}
}
foreach my $field ($record->field('880')) {
my $linkage = $field->subfield('6');
my $category = substr $linkage, 0, 1;
@ -1092,6 +1170,7 @@ sub BuildSummary {
$summary{seefrom} = \@seefrom;
$summary{seealso} = \@seealso;
$summary{otherscript} = \@otherscript;
$summary{equalterm} = \@equalterm;
return \%summary;
}

View File

@ -69,6 +69,12 @@
</span>
[% UNLESS loop.last %] | [% END %]
[% END %]
[% IF summary.equalterm.size %]
[% FOREACH term IN summary.equalterm %]
<span class="label">=</span>
<span class="authorized">[% term.heading %]</span>
[% END %]
[% END %]
</div>
[% IF ( marcflavour == 'UNIMARC' ) %]
[% IF summary.notes %]

View File

@ -61,6 +61,12 @@
<span class="authorizedheading">[% authorize.heading | html %]</span>
[% UNLESS loop.last %] | [% END %]
[% END %]
[% IF summary.equalterm.size %]
[% FOREACH term IN summary.equalterm %]
<span class="label">=</span>
<span class="authorized">[% term.heading %]</span>
[% END %]
[% END %]
</div>
[% IF ( marcflavour == 'UNIMARC' ) %]
[% IF summary.notes %]