Bugzilla – Attachment 185688 Details for
Bug 38924
Introduce an organization level loan 'Quota' system for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38924: Hook quota check and allocation into renewals
Bug-38924-Hook-quota-check-and-allocation-into-ren.patch (text/plain), 1.52 KB, created by
Victor Grousset/tuxayo
on 2025-08-21 22:53:39 UTC
(
hide
)
Description:
Bug 38924: Hook quota check and allocation into renewals
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2025-08-21 22:53:39 UTC
Size:
1.52 KB
patch
obsolete
>From 55eac9dfc1922da1a66b7eb1e1da7a3b7a6c72f3 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacobomara901@gmail.com> >Date: Tue, 4 Feb 2025 16:55:38 +0000 >Subject: [PATCH] Bug 38924: Hook quota check and allocation into renewals > >This adds the checks for quotas and allocates a usage for a renewal of a >book, should a quota exist for this patron >--- > C4/Circulation.pm | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 1973f8cd76..0fde83f555 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3335,7 +3335,13 @@ sub CanBookBeRenewed { > { > return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber ); > } >+ } > >+ # CHECK FOR QUOTAS >+ if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { >+ unless ( $quota->has_available_quota ) { >+ return ( 0, "QUOTA_EXCEEDED" ); >+ } > } > > if ( $auto_renew eq 'auto_too_soon' ) { >@@ -3450,6 +3456,15 @@ sub AddRenewal { > > my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) ); > >+ # Check quotas and record usage if needed >+ if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { >+ # Update patron's used quota value >+ $quota->add_usage({ >+ patron_id => $patron->patron_id, >+ issue_id => $issue->issue_id, >+ }); >+ } >+ > my $schema = Koha::Database->schema; > $schema->txn_do( > sub { >-- >2.50.1
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 38924
:
178582
|
178583
|
178584
|
178585
|
178586
|
178587
|
178588
|
178589
|
178590
|
178591
|
178592
|
178593
|
178594
|
178595
|
178596
|
178597
|
178598
|
178599
|
178600
|
178601
|
178602
|
178603
|
178604
|
178605
|
178606
|
178607
|
178608
|
185631
|
185632
|
185633
|
185634
|
185635
|
185636
|
185637
|
185638
|
185639
|
185640
|
185641
|
185642
|
185643
|
185644
|
185645
|
185646
|
185647
|
185648
|
185649
|
185650
|
185651
|
185652
|
185653
|
185654
|
185655
|
185656
|
185657
|
185675
|
185676
|
185677
|
185678
|
185679
|
185680
|
185681
|
185682
|
185683
|
185684
|
185685
|
185686
|
185687
| 185688 |
185689
|
185690
|
185691
|
185692
|
185693
|
185694
|
185695
|
185696
|
185697
|
185698
|
185699
|
185700
|
185701
|
185702