Bug 18482 False duplicates detected on adding a batch from a stage file

When adding a batch from a stage file with defaut matching on
title/author, if a duplicate is detected, all following records
treated in the batch are discarded from import even if they are not duplicates

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Olivier Crouzet 2017-04-22 18:20:48 +02:00 committed by Kyle M Hall
parent 2a2b973911
commit 2ca5866866
1 changed files with 4 additions and 3 deletions

View File

@ -147,6 +147,7 @@ if ($op eq ""){
my $biblio_count = 0;
for my $biblio (@$biblios){
$biblio_count++;
my $duplifound = 0;
# Check if this import_record_id was selected
next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected;
my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
@ -164,15 +165,15 @@ if ($op eq ""){
unless ( $biblionumber ) {
if ($matcher_id) {
if ( $matcher_id eq '_TITLE_AUTHOR_' ) {
$duplinbatch = $import_batch_id if FindDuplicate($marcrecord);
$duplifound = 1 if FindDuplicate($marcrecord);
}
else {
my $matcher = C4::Matcher->fetch($matcher_id);
my @matches = $matcher->get_matches( $marcrecord, my $max_matches = 1 );
$duplinbatch = $import_batch_id if @matches;
$duplifound = 1 if @matches;
}
next if $duplinbatch;
$duplinbatch = $import_batch_id and next if $duplifound;
}
# add the biblio