From f29bf94129ef9df4222290b3874d6b9d7bcc9fab Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 15 Sep 2022 13:47:07 +0000 Subject: [PATCH] Bug 31569: Remove GetImportRecordsRange from list step This patch removes the use of GetImportRecordsRange from the step of listing import batches to choose. It was only used for a count so is a simple replacement To test: 1 - Stage a number of files for import 2 - Import one of the files from tools 3 - Add to basket form a staged file 4 - Confirm staged baskets are listed, and imported basket is not Signed-off-by: Andrew Fuerste-Henry --- acqui/addorderiso2709.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 712c63fc24..a235ca162a 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -30,7 +30,7 @@ use Encode; use C4::Context; use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); -use C4::ImportBatch qw( GetImportRecordsRange GetImportRecordMarc GetImportRecordMatches SetImportRecordStatus SetMatchedBiblionumber SetImportBatchStatus GetImportBatch GetImportBatchRangeDesc GetNumberOfNonZ3950ImportBatches GetImportBatchOverlayAction GetImportBatchNoMatchAction GetImportBatchItemAction ); +use C4::ImportBatch qw( GetImportRecordMarc GetImportRecordMatches SetImportRecordStatus SetMatchedBiblionumber SetImportBatchStatus GetImportBatch GetImportBatchRangeDesc GetNumberOfNonZ3950ImportBatches GetImportBatchOverlayAction GetImportBatchNoMatchAction GetImportBatchItemAction ); use C4::Matcher; use C4::Search qw( FindDuplicate ); use C4::Biblio qw( @@ -417,8 +417,11 @@ sub import_batches_list { foreach my $batch (@$batches) { if ( $batch->{'import_status'} =~ /^staged$|^reverted$/ && $batch->{'record_type'} eq 'biblio') { # check if there is at least 1 line still staged - my $stagedList=GetImportRecordsRange($batch->{'import_batch_id'}, undef, 1, $batch->{import_status}, { order_by_direction => 'ASC' }); - if (scalar @$stagedList) { + my $import_records_count = Koha::Import::Records->search({ + import_batch_id => $batch->{'import_batch_id'}, + status => $batch->{import_status} + })->count; + if ( $import_records_count ) { push @list, { import_batch_id => $batch->{'import_batch_id'}, num_records => $batch->{'num_records'}, -- 2.30.2