|
Lines 21-26
use Modern::Perl;
Link Here
|
| 21 |
|
21 |
|
| 22 |
use Carp; |
22 |
use Carp; |
| 23 |
use Data::Dumper; |
23 |
use Data::Dumper; |
|
|
24 |
use List::MoreUtils qw(uniq); |
| 24 |
|
25 |
|
| 25 |
use C4::Log qw( logaction ); |
26 |
use C4::Log qw( logaction ); |
| 26 |
use C4::Stats qw( UpdateStats ); |
27 |
use C4::Stats qw( UpdateStats ); |
|
Lines 286-291
sub balance {
Link Here
|
| 286 |
: 0; |
287 |
: 0; |
| 287 |
} |
288 |
} |
| 288 |
|
289 |
|
|
|
290 |
sub non_issues_charges { |
| 291 |
my ($self) = @_; |
| 292 |
|
| 293 |
# FIXME REMOVE And add a warning in the about page + update DB if length(MANUAL_INV) > 5 |
| 294 |
my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous... |
| 295 |
|
| 296 |
my @not_fines; |
| 297 |
push @not_fines, 'Res' |
| 298 |
unless C4::Context->preference('HoldsInNoissuesCharge'); |
| 299 |
push @not_fines, 'Rent' |
| 300 |
unless C4::Context->preference('RentalsInNoissuesCharge'); |
| 301 |
unless ( C4::Context->preference('ManInvInNoissuesCharge') ) { |
| 302 |
my $dbh = C4::Context->dbh; |
| 303 |
push @not_fines, |
| 304 |
@{ |
| 305 |
$dbh->selectcol_arrayref(q| |
| 306 |
SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV' |
| 307 |
|) |
| 308 |
}; |
| 309 |
} |
| 310 |
@not_fines = map { substr( $_, 0, $ACCOUNT_TYPE_LENGTH ) } uniq(@not_fines); |
| 311 |
|
| 312 |
my $non_issues_charges = Koha::Account::Lines->search( |
| 313 |
{ |
| 314 |
borrowernumber => $self->{patron_id}, |
| 315 |
accounttype => { -not_in => \@not_fines } |
| 316 |
}, |
| 317 |
{ |
| 318 |
select => [ { sum => 'amountoutstanding' } ], |
| 319 |
as => ['non_issues_charges'], |
| 320 |
} |
| 321 |
); |
| 322 |
return $non_issues_charges->count |
| 323 |
? $non_issues_charges->next->get_column('non_issues_charges') + 0 |
| 324 |
: 0; |
| 325 |
} |
| 326 |
|
| 289 |
1; |
327 |
1; |
| 290 |
|
328 |
|
| 291 |
=head1 AUTHOR |
329 |
=head1 AUTHOR |