From 56be7f44a26ee9d692ec1df4a79920a8eb772145 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Fri, 21 Jun 2024 16:02:57 +0000
Subject: [PATCH] Bug 37155: Remove use of unblessed patron
This removes the unblessing of the patron object and uses fields form the patron
To test:
Confirm tests still pass:
prove -v t/db_dependent/Holds.t t/db_dependent/Circulation.t t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t t/db_dependent/Reserves.t t/db_dependent/api/v1/holds.t
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
---
C4/Reserves.pm | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 28dac77d8d..39c1b349d6 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -485,10 +485,6 @@ sub CanItemBeReserved {
}
}
- # we retrieve borrowers and items informations #
- # item->{itype} will come for biblioitems if necessery
- my $borrower = $patron->unblessed;
-
# If an item is damaged and we don't allow holds on damaged items, we can stop right here
return _cache { status =>'damaged' }
if ( $item->damaged
@@ -526,14 +522,14 @@ sub CanItemBeReserved {
}
elsif ( $controlbranch eq "PatronLibrary" ) {
$branchfield = "borrowers.branchcode";
- $reserves_control_branch = $borrower->{branchcode};
+ $reserves_control_branch = $patron->branchcode;
}
# we retrieve rights
if (
my $reservesallowed = Koha::CirculationRules->get_effective_rule({
itemtype => $item->effective_itemtype,
- categorycode => $borrower->{categorycode},
+ categorycode => $patron->categorycode,
branchcode => $reserves_control_branch,
rule_name => 'reservesallowed',
})
@@ -546,7 +542,7 @@ sub CanItemBeReserved {
}
my $rights = Koha::CirculationRules->get_effective_rules({
- categorycode => $borrower->{'categorycode'},
+ categorycode => $patron->categorycode,
itemtype => $item->effective_itemtype,
branchcode => $reserves_control_branch,
rules => ['holds_per_record','holds_per_day']
@@ -655,7 +651,7 @@ sub CanItemBeReserved {
}
if ( $branchitemrule->{holdallowed} eq 'from_home_library'
- && $borrower->{branchcode} ne $item->homebranch )
+ && $patron->branchcode ne $item->homebranch )
{
return _cache { status => 'cannotReserveFromOtherBranches' };
}
@@ -684,7 +680,7 @@ sub CanItemBeReserved {
if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
return _cache { status => 'pickupNotInHoldGroup' };
}
- if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
+ if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $patron->branchcode})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
return _cache { status => 'pickupNotInHoldGroup' };
}
}
--
2.39.2