Bugzilla – Attachment 186565 Details for
Bug 40792
Do not fill hold requests when issuing non-holdable items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40792: Do not fill holds with non-reservable items.
Bug-40792-Do-not-fill-holds-with-non-reservable-it.patch (text/plain), 2.92 KB, created by
Andreas Jonsson
on 2025-09-18 14:09:39 UTC
(
hide
)
Description:
Bug 40792: Do not fill holds with non-reservable items.
Filename:
MIME Type:
Creator:
Andreas Jonsson
Created:
2025-09-18 14:09:39 UTC
Size:
2.92 KB
patch
obsolete
>From 31a86589046ce62b85b8016fffc19207264be4d4 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 11 Sep 2025 11:58:26 +0200 >Subject: [PATCH] Bug 40792: Do not fill holds with non-reservable items. > >Verify that the item issued is reservable before filling the patron's >hold. > >1. Go to circulation and fine rules and add a rule for an itemtype > that can be issued, for instance "Maps" in koha-testing-docker, > with 0 in the column "Holds per record (count)". >2. Go to any biblio where there are items that may be reserved. > Create an item with the above created item type and give it a barcode, > e.g., 'tempbarcode'. >3. Place a hold for any patron (for instance 23529000120056 in > koha-testing-docker). >4. Issue the item 'tempbarcode' to the patron with the hold. >5. Make sure the hold remains. >6. Create a new hold to another borrower (for instance > 23529000197047), and make sure this new hold has priority 2. >7. Return the item 'tempbarcode' and issue it to the second patron. >8. Make sure both holds remain. >--- > C4/Reserves.pm | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 84957f1179..0cc122eefc 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2182,8 +2182,11 @@ sub MoveReserve { > my ( $restype, $res, undef ) = CheckReserves( $item, $lookahead ); > > if ( $res && $res->{borrowernumber} == $patron->borrowernumber ) { >- my $hold = Koha::Holds->find( $res->{reserve_id} ); >- $hold->fill( { item_id => $item->id } ); >+ my $result = CanItemBeReserved( $patron, $item, $res->{branchcode} ); >+ if ( $result->{status} eq 'OK' ) { >+ my $hold = Koha::Holds->find( $res->{reserve_id} ); >+ $hold->fill( { item_id => $item->id } ); >+ } > } else { > > # The item is reserved by someone else. >@@ -2207,14 +2210,21 @@ sub MoveReserve { > if ($hold) { > > # The item is reserved by the current patron >- $hold->fill( { item_id => $item->id } ); >+ my $result = CanItemBeReserved( $patron, $item, $hold->branchcode ); >+ if ( $result->{status} eq 'OK' ) { >+ >+ # Only fill hold with actually reservable items >+ $hold->fill( { item_id => $item->id } ); >+ } > } > >- $hold = Koha::Holds->find( $res->{reserve_id} ); >- if ( $cancelreserve eq 'revert' ) { >- $hold->revert_found(); >- } elsif ( $cancelreserve eq 'cancel' || $cancelreserve ) { # cancel reserves on this item >- $hold->cancel; >+ if ($res) { >+ $hold = Koha::Holds->find( $res->{reserve_id} ); >+ if ( $cancelreserve eq 'revert' ) { >+ $hold->revert_found(); >+ } elsif ( $cancelreserve eq 'cancel' || $cancelreserve ) { # cancel reserves on this item >+ $hold->cancel; >+ } > } > } > } >-- >2.39.5
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 40792
:
186376
| 186565