b5bd2b7586
This patch gives Koha the ability to merge authority records using the same interface used by bibliographic records, though slightly different methods for selecting which records to merge. The two ways to select records are as follows: 1) Records can be selected from authority search results by clicking the "Merge" link for two records. 2) Authority records can be merged from the reservoir by clicking the merge-related links in the Manage staged MARC batch screen. To test: 1) Apply patch. 2) Do a search for an authority record that will turn up multiple identical records (or at least two records that you don't mind merging). 3) Click the "Merge" link for the first record. 4) Click the "Merge" link for the second record. 5) Choose which fields from which record you want to appear in the resulting record. 6) Confirm that those are the fields that exist in the resulting record. 7) Stage an authority record (for example, an authority record you saved from your catalog. 8) Search for a record to merge with it using the "Search for a record to merge in a new window" link. 9) Merge these records, confirming that the resulting record (after going through the entire merging process) matches your expectations. 10) Set up a matching rule for authorities, and export an authority from your catalog that will match based on that rule. For MARC21, the following is a good choice for a rule: Matching rule code: AUTHPER Description: Personal name main entry Match threshold: 999 Record type: Authority record [Match point 1:] Search index: mainmainentry Score: 1000 Tag: 100 Subfields: a 11) Stage the record you just exported, choosing the matching rule you just created. 12) Merge the record using the "Merge" link, confirming that the resulting record (after going through the entire merging process) matches your expectations. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Testing notes on last patch in series. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
99 lines
2.8 KiB
Perl
Executable file
99 lines
2.8 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# Copyright 2013 C & P Bibliography Services
|
|
#
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with Koha; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
# Note that at present this test is almost identical to the one testing
|
|
# the encapsulating method in Koha::MetadataRecord.
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Test::More tests => 4;
|
|
|
|
BEGIN {
|
|
use_ok('Koha::Util::MARC');
|
|
}
|
|
|
|
my $marcrecord = MARC::Record->new;
|
|
|
|
$marcrecord->add_fields(
|
|
[ '001', '1234' ],
|
|
[ '150', ' ', ' ', a => 'Cooking' ],
|
|
[ '450', ' ', ' ', a => 'Cookery', z => 'Instructional manuals' ],
|
|
);
|
|
my $samplehash = [
|
|
{
|
|
'field' => [
|
|
{
|
|
'value' => '1234',
|
|
'tag' => '001',
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'field' => [
|
|
{
|
|
'subfield' => [
|
|
{
|
|
'value' => 'Cooking',
|
|
'subtag' => 'a'
|
|
}
|
|
],
|
|
'indicator2' => ' ',
|
|
'tag' => 150,
|
|
'indicator1' => ' ',
|
|
}
|
|
]
|
|
},
|
|
{
|
|
'field' => [
|
|
{
|
|
'subfield' => [
|
|
{
|
|
'value' => 'Cookery',
|
|
'subtag' => 'a'
|
|
},
|
|
{
|
|
'value' => 'Instructional manuals',
|
|
'subtag' => 'z'
|
|
}
|
|
],
|
|
'indicator2' => ' ',
|
|
'tag' => 450,
|
|
'indicator1' => ' ',
|
|
}
|
|
]
|
|
}
|
|
];
|
|
|
|
my $hash = Koha::Util::MARC::createMergeHash($marcrecord);
|
|
my %fieldkeys;
|
|
foreach my $field (@$hash) {
|
|
$fieldkeys{delete $field->{'field'}->[0]->{'key'}}++;
|
|
if (defined $field->{'field'}->[0]->{'subfield'}) {
|
|
foreach my $subfield (@{$field->{'field'}->[0]->{'subfield'}}) {
|
|
$fieldkeys{delete $subfield->{'subkey'}}++;
|
|
}
|
|
}
|
|
}
|
|
|
|
is_deeply($hash, $samplehash, 'Generated hash correctly');
|
|
my $dupkeys = grep { $_ > 1 } values %fieldkeys;
|
|
is($dupkeys, 0, 'No duplicate keys');
|
|
|
|
is(Koha::Util::MARC::getAuthorityAuthorizedHeading($marcrecord, 'marc21'), 'Cooking', 'Routine for retrieving authorized heading works');
|