Lines 135-160
sub process {
Link Here
|
135 |
} |
135 |
} |
136 |
|
136 |
|
137 |
# If there are no items left, delete the biblio |
137 |
# If there are no items left, delete the biblio |
138 |
if ( $delete_biblios && @biblionumbers ) { |
138 |
my @updated_biblionumbers; |
139 |
for my $biblionumber ( uniq @biblionumbers ) { |
139 |
for my $biblionumber ( uniq @biblionumbers ) { |
140 |
my $items_count = |
140 |
my $items_count = |
141 |
Koha::Biblios->find($biblionumber)->items->count; |
141 |
Koha::Biblios->find($biblionumber)->items->count; |
142 |
if ( $items_count == 0 ) { |
142 |
if ( $delete_biblios && $items_count == 0 ) { |
143 |
my $error = C4::Biblio::DelBiblio( $biblionumber, |
143 |
my $error = C4::Biblio::DelBiblio( $biblionumber, |
144 |
{ skip_record_index => 1 } ); |
144 |
{ skip_record_index => 1 } ); |
145 |
unless ($error) { |
145 |
unless ($error) { |
146 |
push @deleted_biblionumbers, $biblionumber; |
146 |
push @deleted_biblionumbers, $biblionumber; |
147 |
} |
|
|
148 |
} |
147 |
} |
|
|
148 |
} else { |
149 |
push @updated_biblionumbers, $biblionumber; |
149 |
} |
150 |
} |
|
|
151 |
} |
150 |
|
152 |
|
151 |
if (@deleted_biblionumbers) { |
153 |
if (@deleted_biblionumbers) { |
152 |
my $indexer = Koha::SearchEngine::Indexer->new( |
154 |
my $indexer = Koha::SearchEngine::Indexer->new( |
153 |
{ index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
155 |
{ index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
154 |
|
156 |
|
155 |
$indexer->index_records( \@deleted_biblionumbers, |
157 |
$indexer->index_records( \@deleted_biblionumbers, |
156 |
'recordDelete', "biblioserver", undef ); |
158 |
'recordDelete', "biblioserver", undef ); |
157 |
} |
159 |
} |
|
|
160 |
|
161 |
if (@updated_biblionumbers) { |
162 |
my $indexer = Koha::SearchEngine::Indexer->new( |
163 |
{ index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
164 |
|
165 |
$indexer->index_records( \@deleted_biblionumbers, |
166 |
'specialUpdate', "biblioserver", undef ); |
158 |
} |
167 |
} |
159 |
} |
168 |
} |
160 |
); |
169 |
); |
161 |
- |
|
|