|
Lines 22-27
use Modern::Perl;
Link Here
|
| 22 |
|
22 |
|
| 23 |
use List::MoreUtils qw( any none uniq notall zip6); |
23 |
use List::MoreUtils qw( any none uniq notall zip6); |
| 24 |
use JSON qw( to_json ); |
24 |
use JSON qw( to_json ); |
|
|
25 |
use Scalar::Util qw(looks_like_number); |
| 25 |
use Unicode::Normalize qw( NFKD ); |
26 |
use Unicode::Normalize qw( NFKD ); |
| 26 |
use Try::Tiny; |
27 |
use Try::Tiny; |
| 27 |
use DateTime (); |
28 |
use DateTime (); |
|
Lines 3519-3525
sub is_patron_inside_charge_limits {
Link Here
|
| 3519 |
my $guarantors_non_issues_charges = 0; |
3520 |
my $guarantors_non_issues_charges = 0; |
| 3520 |
|
3521 |
|
| 3521 |
# Check the debt of this patrons guarantees |
3522 |
# Check the debt of this patrons guarantees |
| 3522 |
if ( defined $no_issues_charge_guarantees ) { |
3523 |
if ( defined $no_issues_charge_guarantees && looks_like_number($no_issues_charge_guarantees) ) { |
| 3523 |
my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list; |
3524 |
my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list; |
| 3524 |
foreach my $g (@guarantees) { |
3525 |
foreach my $g (@guarantees) { |
| 3525 |
$guarantees_non_issues_charges += $g->account->non_issues_charges; |
3526 |
$guarantees_non_issues_charges += $g->account->non_issues_charges; |
|
Lines 3527-3533
sub is_patron_inside_charge_limits {
Link Here
|
| 3527 |
} |
3528 |
} |
| 3528 |
|
3529 |
|
| 3529 |
# Check the debt of this patrons guarantors *and* the guarantees of those guarantors |
3530 |
# Check the debt of this patrons guarantors *and* the guarantees of those guarantors |
| 3530 |
if ( defined $no_issues_charge_guarantors_with_guarantees ) { |
3531 |
if ( defined $no_issues_charge_guarantors_with_guarantees |
|
|
3532 |
&& looks_like_number($no_issues_charge_guarantors_with_guarantees) ) |
| 3533 |
{ |
| 3531 |
$guarantors_non_issues_charges = $patron->relationships_debt( |
3534 |
$guarantors_non_issues_charges = $patron->relationships_debt( |
| 3532 |
{ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 } ); |
3535 |
{ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 } ); |
| 3533 |
} |
3536 |
} |
| 3534 |
- |
|
|