From 2fd6625abc2a3036979b77964ea274a4c65e945b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 26 Jul 2023 17:45:41 -0300 Subject: [PATCH] Bug 28966: (QA follow-up) tmp_holdsqueue no longer an iterator Signed-off-by: Tomas Cohen Arazi --- Koha/Item.pm | 5 ++--- t/db_dependent/Koha/Item.t | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 17791f2994e..96b5fa8b0f0 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -891,9 +891,8 @@ This method checks the tmp_holdsqueue to see if this item has been selected for =cut sub has_pending_hold { - my ( $self ) = @_; - my $pending_hold = $self->_result->tmp_holdsqueues; - return $pending_hold->count ? 1: 0; + my ($self) = @_; + return $self->_result->tmp_holdsqueue ? 1 : 0; } =head3 has_pending_recall { diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index f63d3677d11..819f897e0e5 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -364,6 +364,7 @@ subtest 'has_pending_hold() tests' => sub { $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)"); ok( $item->has_pending_hold, "Yes, we have a pending hold"); $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber"); + $item->discard_changes; ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue"); $schema->storage->txn_rollback; -- 2.41.0