From dc769fd06577e54695cee11a0de917d6fb4c8569 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 --- 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 cfdef805be..b557c95abb 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -382,7 +382,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; } =head3 as_marc_field diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index b9ff871097..d647a24e40 100644 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -66,7 +66,7 @@ subtest 'hidden_in_opac() tests' => sub { subtest 'has_pending_hold() tests' => sub { - plan tests => 3; + plan tests => 2; $schema->storage->txn_begin; @@ -75,12 +75,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