Lines 5-10
use JSON qw( encode_json decode_json );
Link Here
|
5 |
|
5 |
|
6 |
use C4::Biblio; |
6 |
use C4::Biblio; |
7 |
|
7 |
|
|
|
8 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
8 |
use Koha::DateUtils qw( dt_from_string ); |
9 |
use Koha::DateUtils qw( dt_from_string ); |
9 |
use Koha::SearchEngine; |
10 |
use Koha::SearchEngine; |
10 |
use Koha::SearchEngine::Indexer; |
11 |
use Koha::SearchEngine::Indexer; |
Lines 91-97
sub process {
Link Here
|
91 |
my $holds = $biblio->holds; |
92 |
my $holds = $biblio->holds; |
92 |
while ( my $hold = $holds->next ) { |
93 |
while ( my $hold = $holds->next ) { |
93 |
eval{ |
94 |
eval{ |
94 |
$hold->cancel; |
95 |
$hold->cancel({ skip_holds_queue => 1 }); |
95 |
}; |
96 |
}; |
96 |
if ( $@ ) { |
97 |
if ( $@ ) { |
97 |
push @messages, { |
98 |
push @messages, { |
Lines 110-116
sub process {
Link Here
|
110 |
# Delete items |
111 |
# Delete items |
111 |
my $items = Koha::Items->search({ biblionumber => $biblionumber }); |
112 |
my $items = Koha::Items->search({ biblionumber => $biblionumber }); |
112 |
while ( my $item = $items->next ) { |
113 |
while ( my $item = $items->next ) { |
113 |
my $deleted = $item->safe_delete({ skip_record_index => 1 }); |
114 |
my $deleted = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 }); |
114 |
unless ( $deleted ) { |
115 |
unless ( $deleted ) { |
115 |
push @messages, { |
116 |
push @messages, { |
116 |
type => 'error', |
117 |
type => 'error', |
Lines 127-133
sub process {
Link Here
|
127 |
|
128 |
|
128 |
# Finally, delete the biblio |
129 |
# Finally, delete the biblio |
129 |
my $error = eval { |
130 |
my $error = eval { |
130 |
C4::Biblio::DelBiblio( $biblionumber, { skip_record_index => 1 } ); |
131 |
C4::Biblio::DelBiblio( $biblionumber, { skip_record_index => 1, skip_holds_queue => 1 } ); |
131 |
}; |
132 |
}; |
132 |
if ( $error or $@ ) { |
133 |
if ( $error or $@ ) { |
133 |
push @messages, { |
134 |
push @messages, { |
Lines 158-163
sub process {
Link Here
|
158 |
if ( @deleted_biblionumbers ) { |
159 |
if ( @deleted_biblionumbers ) { |
159 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); |
160 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); |
160 |
$indexer->index_records( \@deleted_biblionumbers, "recordDelete", "biblioserver" ); |
161 |
$indexer->index_records( \@deleted_biblionumbers, "recordDelete", "biblioserver" ); |
|
|
162 |
|
163 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
164 |
{ |
165 |
biblio_ids => \@deleted_biblionumbers |
166 |
} |
167 |
); |
161 |
} |
168 |
} |
162 |
|
169 |
|
163 |
my $job_data = decode_json $self->data; |
170 |
my $job_data = decode_json $self->data; |
164 |
- |
|
|