Bug 24470: Mark a batch as 'imported' if all the bib has been imported

When a staged MARC file is used to populate a basket in acquisitions,
the status of the batch is kept as "staged" until a user repeat the operation.
The "imported" status is added to the batch when new orders are added to
a basket "from a new file" (yes!...)

Test plan:
- Create a basket
- Add to basket From a New File
- Select a marc file and stage
- Add titles to your basket
Until all your records are imported the batch will have the status
"staged"
When all your records will be imported, the status of the batch will be
"imported"

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-12-09 15:22:35 +01:00
parent 6be845a785
commit 99cebb82dc
1 changed files with 7 additions and 0 deletions

View File

@ -390,6 +390,12 @@ if ($op eq ""){
}
$imported++;
}
# If all bibliographic records from the batch have been imported we modifying the status of the batch accordingly
SetImportBatchStatus( $import_batch_id, 'imported' )
if @{ GetImportRecordsRange( $import_batch_id, undef, undef, 'imported' )}
== @{ GetImportRecordsRange( $import_batch_id )};
# go to basket page
if ( $imported ) {
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'}."&amp;duplinbatch=$duplinbatch");
@ -450,6 +456,7 @@ sub import_batches_list {
};
} else {
# if there are no more line to includes, set the status to imported
# FIXME This should be removed in the future.
SetImportBatchStatus( $batch->{'import_batch_id'}, 'imported' );
}
}