Bug 24348: Pass marc record to _passes_required_checks
Test plan:
* Add record matching rule:
Matching rule code: test
Description: 001 and 003
Match threshold: 1000
Record type: Bibliografic record
Match points:
Search index: Control-number
Score: 1000
Tag: 001
Subfields:
Offset:
Length:
Normalization rule: none
Required match checks:
Source (incoming) record check field
Tag: 003
Subfields:
Offset:
Length:
Normalization rule: none
Target (database) record check field
Tag: 003
Subfields:
Offset:
Length:
Normalization rule: none
* Note the match rule identity number.
* Stage a marc-file for import, for instance this one ftp://ftp.libris.kb.se/pub/export2/X/marc/X.20200104.marc
sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/stage_file.pl --match 4 --file 'X.20200104.marc' --format ISO2709 --comment 'test'" kohadev
* Note the batch number and commit the file using the batch number:
sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/commit_file.pl --batch-number 1" kohadev
* Again, stage the same marc-file for import:
sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/stage_file.pl --match 4 --file 'X.20200104.marc' --format ISO2709 --comment 'test'" kohadev
* Note the number of records matched.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 9e58ee3a0d)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
bd2d76f68b
commit
47797cb4f9
|
|
@ -727,7 +727,7 @@ sub get_matches {
|
|||
# get rid of any that don't meet the required checks
|
||||
$matches = {
|
||||
map {
|
||||
_passes_required_checks( $source_record, $_, $self->{'required_checks'} )
|
||||
_passes_required_checks( $source_record, $matches->{$_}->{'record'}, $self->{'required_checks'} )
|
||||
? ( $_ => $matches->{$_} )
|
||||
: ()
|
||||
} keys %$matches
|
||||
|
|
@ -791,8 +791,7 @@ sub dump {
|
|||
}
|
||||
|
||||
sub _passes_required_checks {
|
||||
my ($source_record, $target_blob, $matchchecks) = @_;
|
||||
my $target_record = MARC::Record->new_from_usmarc($target_blob); # FIXME -- need to avoid parsing record twice
|
||||
my ($source_record, $target_record, $matchchecks) = @_;
|
||||
|
||||
# no checks supplied == automatic pass
|
||||
return 1 if $#{ $matchchecks } == -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue