Lines 65-71
use Koha::Exceptions::Checkout;
Link Here
|
65 |
use Koha::Plugins; |
65 |
use Koha::Plugins; |
66 |
use Koha::Recalls; |
66 |
use Koha::Recalls; |
67 |
use Koha::Library::Hours; |
67 |
use Koha::Library::Hours; |
68 |
use Carp qw( carp ); |
68 |
use Koha::Patron::Quotas; |
|
|
69 |
use Koha::Patron::Quota; |
70 |
use Koha::Patron::Quota::Usage; |
71 |
|
72 |
use Carp qw( carp ); |
69 |
use List::MoreUtils qw( any ); |
73 |
use List::MoreUtils qw( any ); |
70 |
use Scalar::Util qw( looks_like_number blessed ); |
74 |
use Scalar::Util qw( looks_like_number blessed ); |
71 |
use Date::Calc qw( Date_to_Days ); |
75 |
use Date::Calc qw( Date_to_Days ); |
Lines 1365-1370
sub CanBookBeIssued {
Link Here
|
1365 |
} |
1369 |
} |
1366 |
} |
1370 |
} |
1367 |
|
1371 |
|
|
|
1372 |
# CHECK FOR QUOTAS |
1373 |
if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { |
1374 |
unless ( $quota->has_available_quota ) { |
1375 |
if ( C4::Context->preference("AllowQuotaOverride") ) { |
1376 |
$needsconfirmation{QUOTA_EXCEEDED} = { |
1377 |
available => $quota->available_quota, |
1378 |
total => $quota->allocation, |
1379 |
used => $quota->used, |
1380 |
}; |
1381 |
} |
1382 |
else { |
1383 |
$issuingimpossible{QUOTA_EXCEEDED} = { |
1384 |
available => $quota->available_quota, |
1385 |
total => $quota->allocation, |
1386 |
used => $quota->used, |
1387 |
}; |
1388 |
} |
1389 |
} |
1390 |
} |
1391 |
|
1368 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); |
1392 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); |
1369 |
} |
1393 |
} |
1370 |
|
1394 |
|
Lines 1953-1958
sub AddIssue {
Link Here
|
1953 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
1977 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
1954 |
{ biblio_ids => [ $item_object->biblionumber ] } ) |
1978 |
{ biblio_ids => [ $item_object->biblionumber ] } ) |
1955 |
if C4::Context->preference('RealTimeHoldsQueue'); |
1979 |
if C4::Context->preference('RealTimeHoldsQueue'); |
|
|
1980 |
|
1981 |
# Check quotas and record usage if needed |
1982 |
if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { |
1983 |
# Update patron's used quota value |
1984 |
$quota->add_usage({ |
1985 |
patron_id => $patron->patron_id, |
1986 |
issue_id => $issue->issue_id, |
1987 |
}); |
1988 |
} |
1956 |
} |
1989 |
} |
1957 |
} |
1990 |
} |
1958 |
return $issue; |
1991 |
return $issue; |