View | Details | Raw Unified | Return to bug 38924
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +34 lines)
Lines 66-72 use Koha::Exceptions::Checkout; Link Here
66
use Koha::Plugins;
66
use Koha::Plugins;
67
use Koha::Recalls;
67
use Koha::Recalls;
68
use Koha::Library::Hours;
68
use Koha::Library::Hours;
69
use Carp            qw( carp );
69
use Koha::Patron::Quotas;
70
use Koha::Patron::Quota;
71
use Koha::Patron::Quota::Usage;
72
73
use Carp qw( carp );
70
use List::MoreUtils qw( any );
74
use List::MoreUtils qw( any );
71
use Scalar::Util    qw( looks_like_number blessed );
75
use Scalar::Util    qw( looks_like_number blessed );
72
use Date::Calc      qw( Date_to_Days );
76
use Date::Calc      qw( Date_to_Days );
Lines 1371-1376 sub CanBookBeIssued { Link Here
1371
        }
1375
        }
1372
    }
1376
    }
1373
1377
1378
    # CHECK FOR QUOTAS
1379
    if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) {
1380
        unless ( $quota->has_available_quota ) {
1381
            if ( C4::Context->preference("AllowQuotaOverride") ) {
1382
                $needsconfirmation{QUOTA_EXCEEDED} = {
1383
                    available => $quota->available_quota,
1384
                    total => $quota->allocation,
1385
                    used => $quota->used,
1386
                };
1387
            }
1388
            else {
1389
                $issuingimpossible{QUOTA_EXCEEDED} = {
1390
                    available => $quota->available_quota,
1391
                    total => $quota->allocation, 
1392
                    used => $quota->used,
1393
                };
1394
            }
1395
        }
1396
    }
1397
1374
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages );
1398
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages );
1375
}
1399
}
1376
1400
Lines 1987-1992 sub AddIssue { Link Here
1987
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
2011
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
1988
                { biblio_ids => [ $item_object->biblionumber ] } )
2012
                { biblio_ids => [ $item_object->biblionumber ] } )
1989
                if C4::Context->preference('RealTimeHoldsQueue');
2013
                if C4::Context->preference('RealTimeHoldsQueue');
2014
2015
            # Check quotas and record usage if needed
2016
            if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) {
2017
                # Update patron's used quota value
2018
                $quota->add_usage({
2019
                    patron_id => $patron->patron_id, 
2020
                    issue_id => $issue->issue_id,
2021
                });
2022
            }
1990
        }
2023
        }
1991
    }
2024
    }
1992
    return $issue;
2025
    return $issue;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +13 lines)
Lines 155-160 Link Here
155
                    </li>
155
                    </li>
156
                [% END %]
156
                [% END %]
157
157
158
                [%IF ( QUOTA_EXCEEDED ) %]
159
                    <li class="needsconfirm age_restriction">
160
                        Quota Exceeded [% QUOTA_EXCEEDED | html %].
161
                        [% IF CAN_user_circulate_force_checkout %]
162
                            Check out anyway?
163
                        [% END %]
164
                    </li>
165
                [% END %]
166
158
                [% IF ( DEBT ) %]
167
                [% IF ( DEBT ) %]
159
                    <li class="needsconfirm debt">The patron has a debt of [% DEBT | $Price %].</li>
168
                    <li class="needsconfirm debt">The patron has a debt of [% DEBT | $Price %].</li>
160
                [% END %]
169
                [% END %]
Lines 652-657 Link Here
652
                    <li>Age restriction [% AGE_RESTRICTION | html %].</li>
661
                    <li>Age restriction [% AGE_RESTRICTION | html %].</li>
653
                [% END %]
662
                [% END %]
654
663
664
                [%IF ( QUOTA_EXCEEDED ) %]
665
                    <li>Quota Exceeded [% QUOTA_EXCEEDED | html %].</li>
666
                [% END %]
667
655
                [% IF ( EXPIRED ) %]
668
                [% IF ( EXPIRED ) %]
656
                    <li>Patron's card is expired</li>
669
                    <li>Patron's card is expired</li>
657
                [% END %]
670
                [% END %]
658
- 

Return to bug 38924