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 <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-04-30 13:24:30 +02:00 committed by Martin Renvoize
parent 049aee2536
commit c95add2e17
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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++;