|
Lines 124-129
use Koha::Plugins;
Link Here
|
| 124 |
use Koha::Recalls; |
124 |
use Koha::Recalls; |
| 125 |
use Koha::Library::Hours; |
125 |
use Koha::Library::Hours; |
| 126 |
use Koha::Library::FloatLimits; |
126 |
use Koha::Library::FloatLimits; |
|
|
127 |
use Koha::Patron::Quotas; |
| 128 |
use Koha::Patron::Quota; |
| 129 |
use Koha::Patron::Quota::Usage; |
| 127 |
use Carp qw( carp ); |
130 |
use Carp qw( carp ); |
| 128 |
use List::MoreUtils qw( any ); |
131 |
use List::MoreUtils qw( any ); |
| 129 |
use Scalar::Util qw( looks_like_number blessed ); |
132 |
use Scalar::Util qw( looks_like_number blessed ); |
|
Lines 1371-1376
sub CanBookBeIssued {
Link Here
|
| 1371 |
} |
1374 |
} |
| 1372 |
} |
1375 |
} |
| 1373 |
|
1376 |
|
|
|
1377 |
# CHECK FOR QUOTAS |
| 1378 |
if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { |
| 1379 |
unless ( $quota->has_available_quota ) { |
| 1380 |
if ( C4::Context->preference("AllowQuotaOverride") ) { |
| 1381 |
$needsconfirmation{QUOTA_EXCEEDED} = { |
| 1382 |
available => $quota->available_quota, |
| 1383 |
total => $quota->allocation, |
| 1384 |
used => $quota->used, |
| 1385 |
}; |
| 1386 |
} |
| 1387 |
else { |
| 1388 |
$issuingimpossible{QUOTA_EXCEEDED} = { |
| 1389 |
available => $quota->available_quota, |
| 1390 |
total => $quota->allocation, |
| 1391 |
used => $quota->used, |
| 1392 |
}; |
| 1393 |
} |
| 1394 |
} |
| 1395 |
} |
| 1396 |
|
| 1374 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages ); |
1397 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages ); |
| 1375 |
} |
1398 |
} |
| 1376 |
|
1399 |
|
|
Lines 1998-2003
sub AddIssue {
Link Here
|
| 1998 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
2021 |
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( |
| 1999 |
{ biblio_ids => [ $item_object->biblionumber ] } ) |
2022 |
{ biblio_ids => [ $item_object->biblionumber ] } ) |
| 2000 |
if C4::Context->preference('RealTimeHoldsQueue'); |
2023 |
if C4::Context->preference('RealTimeHoldsQueue'); |
|
|
2024 |
|
| 2025 |
# Check quotas and record usage if needed |
| 2026 |
if ( my $quota = Koha::Patron::Quotas->get_patron_quota($patron->borrowernumber) ) { |
| 2027 |
# Update patron's used quota value |
| 2028 |
$quota->add_usage({ |
| 2029 |
patron_id => $patron->patron_id, |
| 2030 |
issue_id => $issue->issue_id, |
| 2031 |
}); |
| 2032 |
} |
| 2001 |
} |
2033 |
} |
| 2002 |
} |
2034 |
} |
| 2003 |
return $issue; |
2035 |
return $issue; |