Lines 5-11
use Modern::Perl;
Link Here
|
5 |
use C4::Biblio; |
5 |
use C4::Biblio; |
6 |
|
6 |
|
7 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
7 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
8 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
9 |
use Koha::SearchEngine; |
8 |
use Koha::SearchEngine; |
10 |
use Koha::SearchEngine::Indexer; |
9 |
use Koha::SearchEngine::Indexer; |
11 |
|
10 |
|
Lines 47-57
sub process {
Link Here
|
47 |
# FIXME If the job has already been started, but started again (worker has been restart for instance) |
46 |
# FIXME If the job has already been started, but started again (worker has been restart for instance) |
48 |
# Then we will start from scratch and so double delete the same records |
47 |
# Then we will start from scratch and so double delete the same records |
49 |
|
48 |
|
50 |
my $job_progress = 0; |
49 |
$self->start; |
51 |
$self->started_on(dt_from_string) |
|
|
52 |
->progress($job_progress) |
53 |
->status('started') |
54 |
->store; |
55 |
|
50 |
|
56 |
my $mmtid = $args->{mmtid}; |
51 |
my $mmtid = $args->{mmtid}; |
57 |
my @record_ids = @{ $args->{record_ids} }; |
52 |
my @record_ids = @{ $args->{record_ids} }; |
Lines 83-89
sub process {
Link Here
|
83 |
biblionumber => $biblionumber, |
78 |
biblionumber => $biblionumber, |
84 |
}; |
79 |
}; |
85 |
$schema->storage->txn_rollback; |
80 |
$schema->storage->txn_rollback; |
86 |
$self->progress( ++$job_progress )->store; |
81 |
|
|
|
82 |
$self->step; |
87 |
next; |
83 |
next; |
88 |
} |
84 |
} |
89 |
|
85 |
|
Lines 102-108
sub process {
Link Here
|
102 |
error => "$@", |
98 |
error => "$@", |
103 |
}; |
99 |
}; |
104 |
$schema->storage->txn_rollback; |
100 |
$schema->storage->txn_rollback; |
105 |
$self->progress( ++$job_progress )->store; |
101 |
|
|
|
102 |
$self->step; |
106 |
next RECORD_IDS; |
103 |
next RECORD_IDS; |
107 |
} |
104 |
} |
108 |
} |
105 |
} |
Lines 120-126
sub process {
Link Here
|
120 |
error => @{$deleted->messages}[0]->message, |
117 |
error => @{$deleted->messages}[0]->message, |
121 |
}; |
118 |
}; |
122 |
$schema->storage->txn_rollback; |
119 |
$schema->storage->txn_rollback; |
123 |
$self->progress( ++$job_progress )->store; |
120 |
|
|
|
121 |
$self->step; |
124 |
next RECORD_IDS; |
122 |
next RECORD_IDS; |
125 |
} |
123 |
} |
126 |
} |
124 |
} |
Lines 137-143
sub process {
Link Here
|
137 |
error => ($@ ? $@ : $error), |
135 |
error => ($@ ? $@ : $error), |
138 |
}; |
136 |
}; |
139 |
$schema->storage->txn_rollback; |
137 |
$schema->storage->txn_rollback; |
140 |
$self->progress( ++$job_progress )->store; |
138 |
|
|
|
139 |
$self->step; |
141 |
next; |
140 |
next; |
142 |
} |
141 |
} |
143 |
|
142 |
|
Lines 148-154
sub process {
Link Here
|
148 |
}; |
147 |
}; |
149 |
$report->{total_success}++; |
148 |
$report->{total_success}++; |
150 |
$schema->storage->txn_commit; |
149 |
$schema->storage->txn_commit; |
151 |
$self->progress( ++$job_progress )->store; |
150 |
|
|
|
151 |
$self->step; |
152 |
} |
152 |
} |
153 |
|
153 |
|
154 |
my @deleted_biblionumbers = |
154 |
my @deleted_biblionumbers = |
Lines 166-180
sub process {
Link Here
|
166 |
) if C4::Context->preference('RealTimeHoldsQueue'); |
166 |
) if C4::Context->preference('RealTimeHoldsQueue'); |
167 |
} |
167 |
} |
168 |
|
168 |
|
169 |
my $json = $self->json; |
169 |
my $data = $self->decoded_data; |
170 |
my $job_data = $json->decode($self->data); |
170 |
$data->{messages} = \@messages; |
171 |
$job_data->{messages} = \@messages; |
171 |
$data->{report} = $report; |
172 |
$job_data->{report} = $report; |
|
|
173 |
|
172 |
|
174 |
$self->ended_on(dt_from_string) |
173 |
$self->finish( $data ); |
175 |
->data($json->encode($job_data)); |
|
|
176 |
$self->status('finished') if $self->status ne 'cancelled'; |
177 |
$self->store; |
178 |
} |
174 |
} |
179 |
|
175 |
|
180 |
=head3 enqueue |
176 |
=head3 enqueue |