|
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; |