[Koha-patches] [PATCH] [SIGNED-OFF] Bug 7016: CanBookBeReserved uses GetItemsInfo unnecessarily
Nicole C. Engard
nengard at bywatersolutions.com
Wed Oct 19 22:03:36 CEST 2011
From: Ian Walls <ian.walls at bywatersolutions.com>
CanBookBeReserved uses the very heavy-weight function GetItemsInfo to simply retrieve
the itemnumbers attached to a given biblio. The function get_itemnumbers_of() is much
lighter-weight and returns the required information; switching to it will reduce the overall
system resource cost of placing a hold.
Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
C4/Reserves.pm | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index f7a2e72..f12c23f 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -383,17 +383,15 @@ sub GetReservesFromBorrowernumber {
sub CanBookBeReserved{
my ($borrowernumber, $biblionumber) = @_;
- my @items = GetItemsInfo($biblionumber);
-
- #get items linked via host records
- my $marcrecord= GetMarcBiblio($biblionumber);
- my @hostitemInfos = GetHostItemsInfo($marcrecord);
- if (@hostitemInfos){
- push (@items, at hostitemInfos);
- }
+ my @items = get_itemnumbers_of($biblionumber);
+ #get items linked via host records
+ my @hostitems = get_hostitemnumbers_of($biblionumber);
+ if (@hostitems){
+ push (@items, at hostitems);
+ }
foreach my $item (@items){
- return 1 if CanItemBeReserved($borrowernumber, $item->{itemnumber});
+ return 1 if CanItemBeReserved($borrowernumber, $item);
}
return 0;
}
--
1.7.2.3
More information about the Koha-patches
mailing list