1 package Koha::BackgroundJob::MARCImportRevertBatch;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use base 'Koha::BackgroundJob';
23 use C4::ImportBatch qw(
29 Koha::BackgroundJob::MARCImportRevertBatch - Revert a batch
31 This is a subclass of Koha::BackgroundJob.
39 Define the job type of this job: marc_import_revert_batch
44 return 'marc_import_revert_batch';
54 my ( $self, $args ) = @_;
58 my $import_batch_id = $args->{import_batch_id};
63 $num_deleted, $num_errors, $num_reverted,
64 $num_items_deleted, $num_ignored
69 $num_deleted, $num_errors, $num_reverted,
70 $num_items_deleted, $num_ignored
71 ) = BatchRevertRecords( $import_batch_id, 50,
72 sub { my $job_progress = shift; $self->progress( $job_progress )->store } );
76 die "Something terrible has happened!"
77 if ( $_ =~ /Rollback failed/ ); # Rollback failed
81 num_deleted => $num_deleted,
82 num_items_deleted => $num_items_deleted,
83 num_errors => $num_errors,
84 num_reverted => $num_reverted,
85 num_ignored => $num_ignored,
88 my $data = $self->decoded_data;
89 $data->{messages} = \@messages;
90 $data->{report} = $report;
102 my ( $self, $args) = @_;
104 $self->SUPER::enqueue({
105 job_size => 0, # unknown for now