From 8986310a60e9174558c24ef6c346bb5fb239332a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Jan 2020 15:51:22 +0100 Subject: [PATCH] Bug 24468: Remove unused C4::Reserves::_get_itype subroutine Since bug 21206, C4::Reserves::_get_itype is not longer used and should be removed. commit 31c29fd31f557306233e6a2936148a5bb10b89a1 Bug 21206: Replace C4::Items::GetItem UPDATE: In the meanwhile another occurrence was added to Reserves.t, but easy to replace Test plan: % git grep _get_itype must not return any occurrences. If one needs it, Koha::Item->effective_itemtype must be used instead. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- C4/Reserves.pm | 27 --------------------------- t/db_dependent/Reserves.t | 3 +-- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 2099a91aa5..3074254e57 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1289,33 +1289,6 @@ sub IsAvailableForItemLevelRequest { } } -sub _get_itype { - my $item = shift; - - my $itype; - if (C4::Context->preference('item-level_itypes')) { - # We can't trust GetItem to honour the syspref, so safest to do it ourselves - # When GetItem is fixed, we can remove this - $itype = $item->{itype}; - } - else { - # XXX This is a bit dodgy. It relies on biblio itemtype column having different name. - # So if we already have a biblioitems join when calling this function, - # we don't need to access the database again - $itype = $item->{itemtype}; - } - unless ($itype) { - my $dbh = C4::Context->dbh; - my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? "; - my $sth = $dbh->prepare($query); - $sth->execute($item->{biblioitemnumber}); - if (my $data = $sth->fetchrow_hashref()){ - $itype = $data->{itemtype}; - } - } - return $itype; -} - =head2 AlterPriority AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority ); diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 8a9677aa5c..c75a69ad95 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -621,13 +621,12 @@ my $limit = Koha::Item::Transfer::Limit->new( is( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron, $pickup_branch), 0, "Item level request not available due to transfer limit" ); t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '0' ); -my $itype = C4::Reserves::_get_itype($item); my $categorycode = $borrower->{categorycode}; my $holdingbranch = $item->{holdingbranch}; Koha::CirculationRules->set_rules( { categorycode => $categorycode, - itemtype => $itype, + itemtype => $item->effective_itemtype, branchcode => $holdingbranch, rules => { onshelfholds => 1, -- 2.39.5