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 471-561
if ($patron) {
Link Here
|
471 |
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); |
473 |
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); |
472 |
} |
474 |
} |
473 |
|
475 |
|
474 |
#title |
476 |
if ( $patron ) { |
475 |
my $flags = $patron ? C4::Members::patronflags( $patron->unblessed ) : {}; |
477 |
my $noissues; |
476 |
foreach my $flag ( sort keys %$flags ) { |
478 |
if ( $patron->gonenoaddress ) { |
477 |
$flags->{$flag}->{'message'} =~ s#\n#<br />#g; |
479 |
$template->param( gna => 1 ); |
478 |
if ( $flags->{$flag}->{'noissues'} ) { |
480 |
$noissues = 1; |
|
|
481 |
} |
482 |
if ( $patron->lost ) { |
483 |
$template->param( lost=> 1 ); |
484 |
$noissues = 1; |
485 |
} |
486 |
if ( $patron->is_debarred ) { |
487 |
$template->param( dbarred=> 1 ); |
488 |
$noissues = 1; |
489 |
} |
490 |
my $account = $patron->account; |
491 |
if( ( my $owing = $account->non_issues_charges ) > 0 ) { |
492 |
my $noissuescharge = C4::Context->preference("noissuescharge") || 5; # FIXME If noissuescharge == 0 then 5, why?? |
493 |
$noissues = ( not C4::Context->preference("AllowFineOverride") and ( $owing > $noissuescharge ) ); |
479 |
$template->param( |
494 |
$template->param( |
480 |
noissues => ($force_allow_issue) ? 0 : 'true', |
495 |
charges => 1, |
481 |
forceallow => $force_allow_issue, |
496 |
chargesamount => $owing, |
|
|
497 |
) |
498 |
} elsif ( $balance < 0 ) { |
499 |
$template->param( |
500 |
credits => 1, |
501 |
creditsamount => -$balance, |
482 |
); |
502 |
); |
483 |
if ( $flag eq 'GNA' ) { |
|
|
484 |
$template->param( gna => 'true' ); |
485 |
} |
486 |
elsif ( $flag eq 'LOST' ) { |
487 |
$template->param( lost => 'true' ); |
488 |
} |
489 |
elsif ( $flag eq 'DBARRED' ) { |
490 |
$template->param( dbarred => 'true' ); |
491 |
} |
492 |
elsif ( $flag eq 'CHARGES' ) { |
493 |
$template->param( |
494 |
charges => 'true', |
495 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
496 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
497 |
charges_is_blocker => 1 |
498 |
); |
499 |
} |
500 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
501 |
$template->param( |
502 |
charges_guarantees => 'true', |
503 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
504 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
505 |
charges_guarantees_is_blocker => 1 |
506 |
); |
507 |
} |
508 |
elsif ( $flag eq 'CREDITS' ) { |
509 |
$template->param( |
510 |
credits => 'true', |
511 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
512 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
513 |
); |
514 |
} |
515 |
} |
503 |
} |
516 |
else { |
|
|
517 |
if ( $flag eq 'CHARGES' ) { |
518 |
$template->param( |
519 |
charges => 'true', |
520 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
521 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
522 |
); |
523 |
} |
524 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
525 |
$template->param( |
526 |
charges_guarantees => 'true', |
527 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
528 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
529 |
); |
530 |
} |
531 |
elsif ( $flag eq 'CREDITS' ) { |
532 |
$template->param( |
533 |
credits => 'true', |
534 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
535 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
536 |
); |
537 |
} |
538 |
elsif ( $flag eq 'ODUES' ) { |
539 |
$template->param( |
540 |
odues => 'true', |
541 |
oduesmsg => $flags->{'ODUES'}->{'message'} |
542 |
); |
543 |
|
504 |
|
544 |
my $items = $flags->{$flag}->{'itemlist'}; |
505 |
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); |
545 |
if ( ! $query->param('module') || $query->param('module') ne 'returns' ) { |
506 |
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); |
546 |
$template->param( nonreturns => 'true' ); |
507 |
if ( defined $no_issues_charge_guarantees ) { |
547 |
} |
508 |
my $guarantees_non_issues_charges = 0; |
|
|
509 |
my $guarantees = $patron->guarantees; |
510 |
while ( my $g = $guarantees->next ) { |
511 |
$guarantees_non_issues_charges += $g->account->non_issues_charges; |
548 |
} |
512 |
} |
549 |
elsif ( $flag eq 'NOTES' ) { |
513 |
if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees ) { |
550 |
$template->param( |
514 |
$template->param( |
551 |
notes => 'true', |
515 |
charges_guarantees => 1, |
552 |
notesmsg => $flags->{'NOTES'}->{'message'} |
516 |
chargesamount_guarantees => $guarantees_non_issues_charges, |
553 |
); |
517 |
); |
|
|
518 |
$noissues = 1 unless C4::Context->preference("allowfineoverride"); |
554 |
} |
519 |
} |
555 |
} |
520 |
} |
556 |
} |
|
|
557 |
|
521 |
|
558 |
my $total = $patron ? $patron->account->balance : 0; |
522 |
if ( $patron->has_overdues ) { |
|
|
523 |
$template->param( odues => 1 ); |
524 |
} |
525 |
|
526 |
if ( $patron->borrowernotes ) { |
527 |
my $borrowernotes = $patron->borrowernotes; |
528 |
$borrowernotes =~ s#\n#<br />#g; |
529 |
$template->param( |
530 |
notes =>1, |
531 |
notesmsg => $borrowernotes, |
532 |
) |
533 |
} |
534 |
|
535 |
if ( $noissues ) { |
536 |
$template->param( |
537 |
noissues => ($force_allow_issue) ? 0 : 'true', |
538 |
forceallow => $force_allow_issue, |
539 |
); |
540 |
} |
541 |
} |
559 |
|
542 |
|
560 |
if ( $patron && $patron->category->category_type eq 'C') { |
543 |
if ( $patron && $patron->category->category_type eq 'C') { |
561 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
544 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
Lines 641-647
$template->param(
Link Here
|
641 |
duedatespec => $duedatespec, |
624 |
duedatespec => $duedatespec, |
642 |
restoreduedatespec => $restoreduedatespec, |
625 |
restoreduedatespec => $restoreduedatespec, |
643 |
message => $message, |
626 |
message => $message, |
644 |
totaldue => sprintf('%.2f', $total), |
627 |
totaldue => sprintf('%.2f', $balance), # FIXME not used in template? |
645 |
inprocess => $inprocess, |
628 |
inprocess => $inprocess, |
646 |
$view => 1, |
629 |
$view => 1, |
647 |
batch_allowed => $batch_allowed, |
630 |
batch_allowed => $batch_allowed, |