Nick Clemens
1bf99e3e5c
This patch sets thesaurus as undefined when linking any field except 6XX
This fixes the case where authrotiy records don't have the thesaurus defined
Consequently - this means that Koha does not support multiple thesaurus records
for authorities outside of subjects
i.e. Using the default linker, and having both an LCSH and Sears record for 'Shakespeare,William'
A 100 entry will find two results and the heading won't be linked. Previously we always linked to the LCSH
To test:
1 - Import the attached auths and biblio (from bug 33159 comment 24)
2 - Set system preferences:
RequireChoosingExistingAuthority - don't require
AutoCreateAuthorities - don't generate
CatalogModuleRelink - Do
LinkerKeepStale - Don't
LinkerModule - default
LinkerRelink - do
3 - Edit the imported bib
4 - Save it
5 - Headings are not linked except 600
6 - Apply patch
7 - Restart all
8 - Edit and save record
9 - Headings are successfully linked
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d73f567366
)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
36 lines
1.5 KiB
Perl
Executable file
36 lines
1.5 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
#
|
|
# This Koha test module is a stub!
|
|
# Add more tests here!!!
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Test::More tests => 10;
|
|
use C4::Context;
|
|
|
|
BEGIN {
|
|
use_ok('C4::Heading', qw( field new_from_field display_form search_form ));
|
|
}
|
|
|
|
SKIP: {
|
|
skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
|
|
my $field = MARC::Field->new( '650', ' ', '2', a => 'Uncles', x => 'Fiction' );
|
|
my $heading = C4::Heading->new_from_field($field);
|
|
is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
|
|
is($heading->search_form(), 'Uncles generalsubdiv Fiction', 'Search form generation');
|
|
is($heading->{thesaurus}, 'mesh', 'Thesaurus generation');
|
|
|
|
$field = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
|
|
$heading = C4::Heading->new_from_field($field);
|
|
is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
|
|
is($heading->search_form(), 'The dark is rising', 'Search form generation');
|
|
ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields');
|
|
|
|
$field = MARC::Field->new( '100', '1', '', a => 'Yankovic, Al', d => '1959-' );
|
|
$heading = C4::Heading->new_from_field($field);
|
|
is($heading->display_form(), 'Yankovic, Al 1959-', 'Display form generation');
|
|
is($heading->search_form(), 'Yankovic, Al 1959', 'Search form generation');
|
|
ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields');
|
|
|
|
}
|