Bugzilla – Attachment 144508 Details for
Bug 30860
Performance: Add option for CanBookBeReserved to return all item values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30860: Return all items from CanBookBeReserved on request.pl
Bug-30860-Return-all-items-from-CanBookBeReserved-.patch (text/plain), 3.21 KB, created by
ByWater Sandboxes
on 2022-12-08 20:07:58 UTC
(
hide
)
Description:
Bug 30860: Return all items from CanBookBeReserved on request.pl
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2022-12-08 20:07:58 UTC
Size:
3.21 KB
patch
obsolete
>From b1b17a6f14930afa3badc385329503dee9cdc1c0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 27 May 2022 12:52:28 +0000 >Subject: [PATCH] Bug 30860: Return all items from CanBookBeReserved on > request.pl > >This patch requests all item values from CanBookBeReserved on request.pl > >Before this we either: >- Looped every item to find out that book could not be reserved >- Looped until we found an item that could be reserved, then looped all items to get statuses > >In the worst case we avoid double processing a single item, in the best case we avoid double >processing all items (if only last on record is holdable) > >To test: >1 - Find a record in staff client with several items >2 - Set AllowHoldsOnDamagedItems to 'Dont allow' >3 - Add a damaged item to record >4 - Set a hold rule to only allow holds form homebranch and ensure record has items from other branches >5 - Setup things to prevent more items from being held >6 - Attempt hold for patron >7 - Note item statuses >8 - Apply patch >9 - Confirm statuses are as they were before > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > reserve/request.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/reserve/request.pl b/reserve/request.pl >index e5faf1426a..f918ddc139 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -33,7 +33,7 @@ use List::MoreUtils qw( uniq ); > use Date::Calc qw( Date_to_Days ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Auth qw( get_template_and_user ); >-use C4::Reserves qw( RevertWaitingStatus AlterPriority ToggleLowestPriority ToggleSuspend CanBookBeReserved GetMaxPatronHoldsForRecord ItemsAnyAvailableAndNotRestricted CanItemBeReserved IsAvailableForItemLevelRequest ); >+use C4::Reserves qw( RevertWaitingStatus AlterPriority ToggleLowestPriority ToggleSuspend CanBookBeReserved GetMaxPatronHoldsForRecord ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest ); > use C4::Items qw( get_hostitemnumbers_of ); > use C4::Koha qw( getitemtypeimagelocation ); > use C4::Serials qw( CountSubscriptionFromBiblionumber ); >@@ -308,9 +308,10 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > $biblioloopiter{object} = $biblio; > >+ my $canReserve; > if ( $patron ) { > { # CanBookBeReserved >- my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); >+ $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber, undef,{ return_all_items => 1 }); > if ( $canReserve->{status} eq 'OK' ) { > > #All is OK and we can continue >@@ -486,7 +487,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; > >- my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status}; >+ my $can_item_be_reserved = $canReserve->{$item_object->itemnumber}->{status}; > $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); > $item->{not_holdable} ||= 'notforloan' if ( $item->{notforloanitype} || $item->{notforloan} > 0 ); > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30860
:
135426
|
135427
|
135428
|
135429
|
144480
|
144481
|
144482
|
144483
|
144506
|
144507
|
144508
|
144509
|
145577
|
145578
|
145579
|
145580
|
145581
|
145582
|
145583
|
145584
|
147695
|
148562
|
148812
|
149124
|
149377