Bug 32878: Make it impossible to renew the item if it has active item level hold

introduced in:
73c3c5d2f1
Bug 31112: (QA follow-up) Reduce database queries

started from:
8ba1a9a534
Bug 31112: Remove unnecessary if-clause

Currently, you can renew the item even if someone already made an item level
hold on that item. This patch changes that, making it not possible to do so.

To reproduce:
1. Checkout an item, and make another item level hold on that specific item.
2. Renew it using the "Renew" checkbox, it should get renewed without any problems.
3. Apply the patch.
4. Checkbox should be gone and replaced with "On Hold" link that leads to the hold that doesn't allow you to renew the item again.
5. "Renew all" button should not work either.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 32c15887d8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Petro Vashchuk 2023-02-03 16:22:30 +02:00 committed by Martin Renvoize
parent ea289271d2
commit eb2d72b7e7
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 4 additions and 0 deletions

View File

@ -2962,6 +2962,10 @@ sub CanBookBeRenewed {
}
}
# There is an item level hold on this item, no other item can fill the hold
return ( 0, "on_reserve" )
if ( $item->current_holds->count );
my $fillable_holds = Koha::Holds->search(
{
biblionumber => $item->biblionumber,