From 2648c25224a9acc4de0a2daf38f84ed876f02a8f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 9 Dec 2020 15:22:35 +0100 Subject: [PATCH] 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 Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart (cherry picked from commit 99cebb82dc6fd1aa3f7466f03a267cac9deedc6c) Signed-off-by: Fridolin Somers (cherry picked from commit 5f126b129128ecbf7a65eda4b5b62f355c7349d8) Signed-off-by: Andrew Fuerste-Henry --- acqui/addorderiso2709.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index acc386192c..8e3d117d5d 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -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'}."&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' ); } } -- 2.39.5