From c95add2e17be7b48c3218a264b60c8372fe1d9a2 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 Signed-off-by: Martin Renvoize --- 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.39.5