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

(-)a/Koha/Objects.pm (-8 / +9 lines)
Lines 167-183 sub search_related { Link Here
167
=cut
167
=cut
168
168
169
sub delete {
169
sub delete {
170
    my ($self) = @_;
170
    my ( $self, $params ) = @_;
171
171
172
    if ( Class::Inspector->function_exists( $self->object_class, 'delete' ) ) {
172
    if ( Class::Inspector->function_exists( $self->object_class, 'delete' ) ) {
173
        my $objects_deleted;
173
        my $objects_deleted;
174
        $self->_resultset->result_source->schema->txn_do( sub {
174
        $self->_resultset->result_source->schema->txn_do(
175
            $self->reset; # If we iterated already over the set
175
            sub {
176
            while ( my $o = $self->next ) {
176
                $self->reset;    # If we iterated already over the set
177
                $o->delete;
177
                while ( my $o = $self->next ) {
178
                $objects_deleted++;
178
                    $o->delete($params);
179
                    $objects_deleted++;
180
                }
179
            }
181
            }
180
        });
182
        );
181
        return $objects_deleted;
183
        return $objects_deleted;
182
    }
184
    }
183
185
184
- 

Return to bug 36873