Bugzilla – Attachment 185687 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 checkout
Bug-38924-Hook-quota-check-and-allocation-into-che.patch (text/plain), 3.76 KB, created by
Victor Grousset/tuxayo
on 2025-08-21 22:53:36 UTC
(
hide
)
Description:
Bug 38924: Hook quota check and allocation into checkout
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2025-08-21 22:53:36 UTC
Size:
3.76 KB
patch
obsolete
>From ed63a853ab5b56d36999f922bbe5d4db65e70f1b Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacobomara901@gmail.com> >Date: Fri, 31 Jan 2025 15:07:43 +0000 >Subject: [PATCH] Bug 38924: Hook quota check and allocation into checkout > >--- > C4/Circulation.pm | 35 ++++++++++++++++++- > .../prog/en/modules/circ/circulation.tt | 13 +++++++ > 2 files changed, 47 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 514eb3ae97..1973f8cd76 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -65,7 +65,11 @@ use Koha::Exceptions::Checkout; > use Koha::Plugins; > use Koha::Recalls; > use Koha::Library::Hours; >-use Carp qw( carp ); >+use Koha::Patron::Quotas; >+use Koha::Patron::Quota; >+use Koha::Patron::Quota::Usage; >+ >+use Carp qw( carp ); > use List::MoreUtils qw( any ); > use Scalar::Util qw( looks_like_number blessed ); > use Date::Calc qw( Date_to_Days ); >@@ -1365,6 +1369,26 @@ sub CanBookBeIssued { > } > } > >+ # CHECK FOR QUOTAS >+ if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { >+ unless ( $quota->has_available_quota ) { >+ if ( C4::Context->preference("AllowQuotaOverride") ) { >+ $needsconfirmation{QUOTA_EXCEEDED} = { >+ available => $quota->available_quota, >+ total => $quota->allocation, >+ used => $quota->used, >+ }; >+ } >+ else { >+ $issuingimpossible{QUOTA_EXCEEDED} = { >+ available => $quota->available_quota, >+ total => $quota->allocation, >+ used => $quota->used, >+ }; >+ } >+ } >+ } >+ > return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); > } > >@@ -1953,6 +1977,15 @@ sub AddIssue { > Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( > { biblio_ids => [ $item_object->biblionumber ] } ) > if C4::Context->preference('RealTimeHoldsQueue'); >+ >+ # 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, >+ }); >+ } > } > } > return $issue; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 1ca767f729..a1a2b491a6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -156,6 +156,15 @@ > </li> > [% END %] > >+ [%IF ( QUOTA_EXCEEDED ) %] >+ <li class="needsconfirm age_restriction"> >+ Quota Exceeded [% QUOTA_EXCEEDED | html %]. >+ [% IF CAN_user_circulate_force_checkout %] >+ Check out anyway? >+ [% END %] >+ </li> >+ [% END %] >+ > [% IF ( DEBT ) %] > <li class="needsconfirm debt">The patron has a debt of [% DEBT | $Price %].</li> > [% END %] >@@ -653,6 +662,10 @@ > <li>Age restriction [% AGE_RESTRICTION | html %].</li> > [% END %] > >+ [%IF ( QUOTA_EXCEEDED ) %] >+ <li>Quota Exceeded [% QUOTA_EXCEEDED | html %].</li> >+ [% END %] >+ > [% IF ( EXPIRED ) %] > <li>Patron's card is expired</li> > [% END %] >-- >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