From 169dd65ec753d1928fb110aa6abda50cc50cf355 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 1 Jul 2019 07:19:33 -0400 Subject: [PATCH] Bug 23233: Remove use of AllowItemsOnHoldCheckout from Koha::Item::has_pending_hold, it can cause false data to be returned MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit dc769fd06577e54695cee11a0de917d6fb4c8569) --- Koha/Item.pm | 2 +- t/db_dependent/Koha/Item.t | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 55ab9b90b8..820026fa01 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -365,7 +365,7 @@ This method checks the tmp_holdsqueue to see if this item has been selected for sub has_pending_hold { my ( $self ) = @_; my $pending_hold = $self->_result->tmp_holdsqueues; - return !C4::Context->preference('AllowItemsOnHoldCheckoutSIP') && $pending_hold->count ? 1: 0; + return $pending_hold->count ? 1: 0; } =head2 Internal methods diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index a4bb012756..9e3b7ae476 100644 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -64,7 +64,7 @@ subtest 'hidden_in_opac() tests' => sub { subtest 'has_pending_hold() tests' => sub { - plan tests => 3; + plan tests => 2; $schema->storage->txn_begin; @@ -73,12 +73,8 @@ subtest 'has_pending_hold() tests' => sub { my $itemnumber = $item->itemnumber; # disable AllowItemsOnHoldCheckout as it ignores pending holds - t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 ); $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)"); ok( $item->has_pending_hold, "Yes, we have a pending hold"); - t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 ); - ok( !$item->has_pending_hold, "We don't consider a pending hold if hold items can be checked out"); - t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 ); $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber"); ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue"); }; -- 2.39.5