|
Lines 28-33
use Modern::Perl;
Link Here
|
| 28 |
use CGI qw ( -utf8 ); |
28 |
use CGI qw ( -utf8 ); |
| 29 |
use DateTime; |
29 |
use DateTime; |
| 30 |
use DateTime::Duration; |
30 |
use DateTime::Duration; |
|
|
31 |
use Scalar::Util qw( looks_like_number ); |
| 31 |
use C4::Output; |
32 |
use C4::Output; |
| 32 |
use C4::Print; |
33 |
use C4::Print; |
| 33 |
use C4::Auth qw/:DEFAULT get_session haspermission/; |
34 |
use C4::Auth qw/:DEFAULT get_session haspermission/; |
|
Lines 272-277
if ($findborrower) {
Link Here
|
| 272 |
} |
273 |
} |
| 273 |
|
274 |
|
| 274 |
# get the borrower information..... |
275 |
# get the borrower information..... |
|
|
276 |
my $balance = 0; |
| 275 |
$patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber; |
277 |
$patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber; |
| 276 |
if ($patron) { |
278 |
if ($patron) { |
| 277 |
|
279 |
|
|
Lines 280-286
if ($patron) {
Link Here
|
| 280 |
|
282 |
|
| 281 |
my $overdues = $patron->get_overdues; |
283 |
my $overdues = $patron->get_overdues; |
| 282 |
my $issues = $patron->checkouts; |
284 |
my $issues = $patron->checkouts; |
| 283 |
my $balance = $patron->account->balance; |
285 |
$balance = $patron->account->balance; |
| 284 |
|
286 |
|
| 285 |
|
287 |
|
| 286 |
# if the expiry date is before today ie they have expired |
288 |
# if the expiry date is before today ie they have expired |
|
Lines 468-558
if ($patron) {
Link Here
|
| 468 |
); |
470 |
); |
| 469 |
} |
471 |
} |
| 470 |
|
472 |
|
| 471 |
#title |
473 |
if ( $patron ) { |
| 472 |
my $flags = $patron ? C4::Members::patronflags( $patron->unblessed ) : {}; |
474 |
my $noissues; |
| 473 |
foreach my $flag ( sort keys %$flags ) { |
475 |
if ( $patron->gonenoaddress ) { |
| 474 |
$flags->{$flag}->{'message'} =~ s#\n#<br />#g; |
476 |
$template->param( gna => 1 ); |
| 475 |
if ( $flags->{$flag}->{'noissues'} ) { |
477 |
$noissues = 1; |
|
|
478 |
} |
| 479 |
if ( $patron->lost ) { |
| 480 |
$template->param( lost=> 1 ); |
| 481 |
$noissues = 1; |
| 482 |
} |
| 483 |
if ( $patron->is_debarred ) { |
| 484 |
$template->param( dbarred=> 1 ); |
| 485 |
$noissues = 1; |
| 486 |
} |
| 487 |
my $account = $patron->account; |
| 488 |
if( ( my $owing = $account->non_issues_charges ) > 0 ) { |
| 489 |
my $noissuescharge = C4::Context->preference("noissuescharge") || 5; # FIXME If noissuescharge == 0 then 5, why?? |
| 490 |
$noissues = ( not C4::Context->preference("AllowFineOverride") and ( $owing > $noissuescharge ) ); |
| 476 |
$template->param( |
491 |
$template->param( |
| 477 |
noissues => ($force_allow_issue) ? 0 : 'true', |
492 |
charges => 1, |
| 478 |
forceallow => $force_allow_issue, |
493 |
chargesamount => $owing, |
|
|
494 |
) |
| 495 |
} elsif ( $balance < 0 ) { |
| 496 |
$template->param( |
| 497 |
credits => 1, |
| 498 |
creditsamount => -$balance, |
| 479 |
); |
499 |
); |
| 480 |
if ( $flag eq 'GNA' ) { |
|
|
| 481 |
$template->param( gna => 'true' ); |
| 482 |
} |
| 483 |
elsif ( $flag eq 'LOST' ) { |
| 484 |
$template->param( lost => 'true' ); |
| 485 |
} |
| 486 |
elsif ( $flag eq 'DBARRED' ) { |
| 487 |
$template->param( dbarred => 'true' ); |
| 488 |
} |
| 489 |
elsif ( $flag eq 'CHARGES' ) { |
| 490 |
$template->param( |
| 491 |
charges => 'true', |
| 492 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
| 493 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
| 494 |
charges_is_blocker => 1 |
| 495 |
); |
| 496 |
} |
| 497 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
| 498 |
$template->param( |
| 499 |
charges_guarantees => 'true', |
| 500 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
| 501 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
| 502 |
charges_guarantees_is_blocker => 1 |
| 503 |
); |
| 504 |
} |
| 505 |
elsif ( $flag eq 'CREDITS' ) { |
| 506 |
$template->param( |
| 507 |
credits => 'true', |
| 508 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
| 509 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
| 510 |
); |
| 511 |
} |
| 512 |
} |
500 |
} |
| 513 |
else { |
|
|
| 514 |
if ( $flag eq 'CHARGES' ) { |
| 515 |
$template->param( |
| 516 |
charges => 'true', |
| 517 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
| 518 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
| 519 |
); |
| 520 |
} |
| 521 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
| 522 |
$template->param( |
| 523 |
charges_guarantees => 'true', |
| 524 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
| 525 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
| 526 |
); |
| 527 |
} |
| 528 |
elsif ( $flag eq 'CREDITS' ) { |
| 529 |
$template->param( |
| 530 |
credits => 'true', |
| 531 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
| 532 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
| 533 |
); |
| 534 |
} |
| 535 |
elsif ( $flag eq 'ODUES' ) { |
| 536 |
$template->param( |
| 537 |
odues => 'true', |
| 538 |
oduesmsg => $flags->{'ODUES'}->{'message'} |
| 539 |
); |
| 540 |
|
501 |
|
| 541 |
my $items = $flags->{$flag}->{'itemlist'}; |
502 |
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); |
| 542 |
if ( ! $query->param('module') || $query->param('module') ne 'returns' ) { |
503 |
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); |
| 543 |
$template->param( nonreturns => 'true' ); |
504 |
if ( defined $no_issues_charge_guarantees ) { |
| 544 |
} |
505 |
my $guarantees_non_issues_charges = 0; |
|
|
506 |
my $guarantees = $patron->guarantees; |
| 507 |
while ( my $g = $guarantees->next ) { |
| 508 |
$guarantees_non_issues_charges += $g->account->non_issues_charges; |
| 545 |
} |
509 |
} |
| 546 |
elsif ( $flag eq 'NOTES' ) { |
510 |
if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees ) { |
| 547 |
$template->param( |
511 |
$template->param( |
| 548 |
notes => 'true', |
512 |
charges_guarantees => 1, |
| 549 |
notesmsg => $flags->{'NOTES'}->{'message'} |
513 |
chargesamount_guarantees => $guarantees_non_issues_charges, |
| 550 |
); |
514 |
); |
|
|
515 |
$noissues = 1 unless C4::Context->preference("allowfineoverride"); |
| 551 |
} |
516 |
} |
| 552 |
} |
517 |
} |
| 553 |
} |
|
|
| 554 |
|
518 |
|
| 555 |
my $total = $patron ? $patron->account->balance : 0; |
519 |
if ( $patron->has_overdues ) { |
|
|
520 |
$template->param( odues => 1 ); |
| 521 |
} |
| 522 |
|
| 523 |
if ( $patron->borrowernotes ) { |
| 524 |
my $borrowernotes = $patron->borrowernotes; |
| 525 |
$borrowernotes =~ s#\n#<br />#g; |
| 526 |
$template->param( |
| 527 |
notes =>1, |
| 528 |
notesmsg => $borrowernotes, |
| 529 |
) |
| 530 |
} |
| 531 |
|
| 532 |
if ( $noissues ) { |
| 533 |
$template->param( |
| 534 |
noissues => ($force_allow_issue) ? 0 : 'true', |
| 535 |
forceallow => $force_allow_issue, |
| 536 |
); |
| 537 |
} |
| 538 |
} |
| 556 |
|
539 |
|
| 557 |
if ( $patron && $patron->is_child) { |
540 |
if ( $patron && $patron->is_child) { |
| 558 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
541 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
|
Lines 634-640
$template->param(
Link Here
|
| 634 |
duedatespec => $duedatespec, |
617 |
duedatespec => $duedatespec, |
| 635 |
restoreduedatespec => $restoreduedatespec, |
618 |
restoreduedatespec => $restoreduedatespec, |
| 636 |
message => $message, |
619 |
message => $message, |
| 637 |
totaldue => sprintf('%.2f', $total), |
620 |
totaldue => sprintf('%.2f', $balance), # FIXME not used in template? |
| 638 |
inprocess => $inprocess, |
621 |
inprocess => $inprocess, |
| 639 |
$view => 1, |
622 |
$view => 1, |
| 640 |
batch_allowed => $batch_allowed, |
623 |
batch_allowed => $batch_allowed, |