From e398b6b7591d6c22084a2b527d3ab3955ea498d9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Apr 2020 13:24:30 +0200 Subject: [PATCH] Bug 25303: Call ->reset before iterate on the set In case we already started to iterate. This fixes a failing tests in t/db_dependent/Koha/Biblios.t --- Koha/Objects.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index b9697dc17b..eb77c0e0e6 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -182,6 +182,7 @@ sub delete { if ( Class::Inspector->function_exists( $self->object_class, 'delete' ) ) { my $objects_deleted; $self->_resultset->result_source->schema->txn_do( sub { + $self->reset; # If we iterated already over the set while ( my $o = $self->next ) { $o->delete; $objects_deleted++; -- 2.20.1