Bugzilla – Attachment 135426 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: Add return_all_items parameter to CanBookBeReserved
Bug-30860-Add-returnallitems-parameter-to-CanBookB.patch (text/plain), 2.07 KB, created by
Nick Clemens (kidclamp)
on 2022-05-27 13:19:55 UTC
(
hide
)
Description:
Bug 30860: Add return_all_items parameter to CanBookBeReserved
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-05-27 13:19:55 UTC
Size:
2.07 KB
patch
obsolete
>From 6a0d28767f1c11be839407f5b776bd4fb25cf2d3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 27 May 2022 12:19:56 +0000 >Subject: [PATCH] Bug 30860: Add return_all_items parameter to > CanBookBeReserved > >--- > C4/Reserves.pm | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5193a5454c..1f318bbe91 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -329,7 +329,9 @@ sub AddReserve { > $canReserve = &CanBookBeReserved($borrowernumber, $biblionumber, $branchcode, $params) > if ($canReserve eq 'OK') { #We can reserve this Item! } > >- $params are passed directly through to CanItemBeReserved >+ Accepts param 'return_all_items' which will process all items and return results of >+ CanItemBeReserved >+ All other $params are passed directly through to CanItemBeReserved > > See CanItemBeReserved() for possible return values. > >@@ -337,6 +339,7 @@ See CanItemBeReserved() for possible return values. > > sub CanBookBeReserved{ > my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; >+ my $return_all_items = $params->{return_all_items} // 0; > > # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) > if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') >@@ -360,11 +363,18 @@ sub CanBookBeReserved{ > > my $canReserve = { status => '' }; > my $patron = Koha::Patrons->find( $borrowernumber ); >+ my %items; >+ my $can_book_be_reserved = 0; > while ( my $item = $items->next ) { > $canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); >- return { status => 'OK' } if $canReserve->{status} eq 'OK'; >+ $can_book_be_reserved = 1 if $canReserve->{status} eq 'OK'; >+ return { status => 'OK' } if !$return_all_items && $can_book_be_reserved; >+ $items{$item->itemnumber} = $canReserve; > } >- return $canReserve; >+ return { >+ status => $can_book_be_reserved ? 'OK' : $canReserve->{status}, >+ %items >+ }; > } > > =head2 CanItemBeReserved >-- >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