View | Details | Raw Unified | Return to bug 30467
Collapse All | Expand All

(-)a/Koha/BackgroundJob/BatchDeleteItem.pm (-3 / +13 lines)
Lines 135-150 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
                if ( @biblionumbers ) {
139
                    for my $biblionumber ( uniq @biblionumbers ) {
140
                    for my $biblionumber ( uniq @biblionumbers ) {
140
                        my $items_count =
141
                        my $items_count =
141
                          Koha::Biblios->find($biblionumber)->items->count;
142
                          Koha::Biblios->find($biblionumber)->items->count;
142
                        if ( $items_count == 0 ) {
143
                        if ( $delete_biblios && $items_count == 0 ) {
143
                            my $error = C4::Biblio::DelBiblio( $biblionumber,
144
                            my $error = C4::Biblio::DelBiblio( $biblionumber,
144
                                { skip_record_index => 1 } );
145
                                { skip_record_index => 1 } );
145
                            unless ($error) {
146
                            unless ($error) {
146
                                push @deleted_biblionumbers, $biblionumber;
147
                                push @deleted_biblionumbers, $biblionumber;
147
                            }
148
                            }
149
                        } else {
150
                            push @updated_biblionumbers, $biblionumber;
148
                        }
151
                        }
149
                    }
152
                    }
150
153
Lines 156-161 sub process { Link Here
156
                            'recordDelete', "biblioserver", undef );
159
                            'recordDelete', "biblioserver", undef );
157
                    }
160
                    }
158
                }
161
                }
162
                
163
                if (@updated_biblionumbers) {
164
                    my $indexer = Koha::SearchEngine::Indexer->new(
165
                        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
166
167
                    $indexer->index_records( \@deleted_biblionumbers,
168
                        'specialUpdate', "biblioserver", undef );
169
                }
159
            }
170
            }
160
        );
171
        );
161
    }
172
    }
162
- 

Return to bug 30467