Lines 29-34
use warnings;
Link Here
|
29 |
use CGI qw ( -utf8 ); |
29 |
use CGI qw ( -utf8 ); |
30 |
use DateTime; |
30 |
use DateTime; |
31 |
use DateTime::Duration; |
31 |
use DateTime::Duration; |
|
|
32 |
use Scalar::Util qw( looks_like_number ); |
32 |
use C4::Output; |
33 |
use C4::Output; |
33 |
use C4::Print; |
34 |
use C4::Print; |
34 |
use C4::Auth qw/:DEFAULT get_session haspermission/; |
35 |
use C4::Auth qw/:DEFAULT get_session haspermission/; |
Lines 261-271
if ($findborrower) {
Link Here
|
261 |
} |
262 |
} |
262 |
|
263 |
|
263 |
# get the borrower information..... |
264 |
# get the borrower information..... |
|
|
265 |
my $balance = 0; |
264 |
$patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber; |
266 |
$patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber; |
265 |
if ($patron) { |
267 |
if ($patron) { |
266 |
my $overdues = $patron->get_overdues; |
268 |
my $overdues = $patron->get_overdues; |
267 |
my $issues = $patron->checkouts; |
269 |
my $issues = $patron->checkouts; |
268 |
my $balance = $patron->account->balance; |
270 |
$balance = $patron->account->balance; |
269 |
|
271 |
|
270 |
|
272 |
|
271 |
# if the expiry date is before today ie they have expired |
273 |
# if the expiry date is before today ie they have expired |
Lines 456-546
if ($patron) {
Link Here
|
456 |
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); |
458 |
$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); |
457 |
} |
459 |
} |
458 |
|
460 |
|
459 |
#title |
461 |
if ( $patron ) { |
460 |
my $flags = $patron ? C4::Members::patronflags( $patron->unblessed ) : {}; |
462 |
my $noissues; |
461 |
foreach my $flag ( sort keys %$flags ) { |
463 |
if ( $patron->gonenoaddress ) { |
462 |
$flags->{$flag}->{'message'} =~ s#\n#<br />#g; |
464 |
$template->param( gna => 1 ); |
463 |
if ( $flags->{$flag}->{'noissues'} ) { |
465 |
$noissues = 1; |
|
|
466 |
} |
467 |
if ( $patron->lost ) { |
468 |
$template->param( lost=> 1 ); |
469 |
$noissues = 1; |
470 |
} |
471 |
if ( $patron->is_debarred ) { |
472 |
$template->param( dbarred=> 1 ); |
473 |
$noissues = 1; |
474 |
} |
475 |
my $account = $patron->account; |
476 |
if( ( my $owing = $account->non_issues_charges ) > 0 ) { |
477 |
my $noissuescharge = C4::Context->preference("noissuescharge") || 5; # FIXME If noissuescharge == 0 then 5, why?? |
478 |
$noissues = ( not C4::Context->preference("AllowFineOverride") and ( $owing > $noissuescharge ) ); |
464 |
$template->param( |
479 |
$template->param( |
465 |
noissues => ($force_allow_issue) ? 0 : 'true', |
480 |
charges => 1, |
466 |
forceallow => $force_allow_issue, |
481 |
chargesamount => $owing, |
|
|
482 |
) |
483 |
} elsif ( $balance < 0 ) { |
484 |
$template->param( |
485 |
credits => 1, |
486 |
creditsamount => -$balance, |
467 |
); |
487 |
); |
468 |
if ( $flag eq 'GNA' ) { |
|
|
469 |
$template->param( gna => 'true' ); |
470 |
} |
471 |
elsif ( $flag eq 'LOST' ) { |
472 |
$template->param( lost => 'true' ); |
473 |
} |
474 |
elsif ( $flag eq 'DBARRED' ) { |
475 |
$template->param( dbarred => 'true' ); |
476 |
} |
477 |
elsif ( $flag eq 'CHARGES' ) { |
478 |
$template->param( |
479 |
charges => 'true', |
480 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
481 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
482 |
charges_is_blocker => 1 |
483 |
); |
484 |
} |
485 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
486 |
$template->param( |
487 |
charges_guarantees => 'true', |
488 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
489 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
490 |
charges_guarantees_is_blocker => 1 |
491 |
); |
492 |
} |
493 |
elsif ( $flag eq 'CREDITS' ) { |
494 |
$template->param( |
495 |
credits => 'true', |
496 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
497 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
498 |
); |
499 |
} |
500 |
} |
488 |
} |
501 |
else { |
|
|
502 |
if ( $flag eq 'CHARGES' ) { |
503 |
$template->param( |
504 |
charges => 'true', |
505 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
506 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
507 |
); |
508 |
} |
509 |
elsif ( $flag eq 'CHARGES_GUARANTEES' ) { |
510 |
$template->param( |
511 |
charges_guarantees => 'true', |
512 |
chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'}, |
513 |
chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'}, |
514 |
); |
515 |
} |
516 |
elsif ( $flag eq 'CREDITS' ) { |
517 |
$template->param( |
518 |
credits => 'true', |
519 |
creditsmsg => $flags->{'CREDITS'}->{'message'}, |
520 |
creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov |
521 |
); |
522 |
} |
523 |
elsif ( $flag eq 'ODUES' ) { |
524 |
$template->param( |
525 |
odues => 'true', |
526 |
oduesmsg => $flags->{'ODUES'}->{'message'} |
527 |
); |
528 |
|
489 |
|
529 |
my $items = $flags->{$flag}->{'itemlist'}; |
490 |
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); |
530 |
if ( ! $query->param('module') || $query->param('module') ne 'returns' ) { |
491 |
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); |
531 |
$template->param( nonreturns => 'true' ); |
492 |
if ( defined $no_issues_charge_guarantees ) { |
532 |
} |
493 |
my $guarantees_non_issues_charges = 0; |
|
|
494 |
my $guarantees = $patron->guarantees; |
495 |
while ( my $g = $guarantees->next ) { |
496 |
$guarantees_non_issues_charges += $g->account->non_issues_charges; |
533 |
} |
497 |
} |
534 |
elsif ( $flag eq 'NOTES' ) { |
498 |
if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees ) { |
535 |
$template->param( |
499 |
$template->param( |
536 |
notes => 'true', |
500 |
charges_guarantees => 1, |
537 |
notesmsg => $flags->{'NOTES'}->{'message'} |
501 |
chargesamount_guarantees => $guarantees_non_issues_charges, |
538 |
); |
502 |
); |
|
|
503 |
$noissues = 1 unless C4::Context->preference("allowfineoverride"); |
539 |
} |
504 |
} |
540 |
} |
505 |
} |
541 |
} |
|
|
542 |
|
506 |
|
543 |
my $total = $patron ? $patron->account->balance : 0; |
507 |
if ( $patron->has_overdues ) { |
|
|
508 |
$template->param( odues => 1 ); |
509 |
} |
510 |
|
511 |
if ( $patron->borrowernotes ) { |
512 |
my $borrowernotes = $patron->borrowernotes; |
513 |
$borrowernotes =~ s#\n#<br />#g; |
514 |
$template->param( |
515 |
notes =>1, |
516 |
notesmsg => $borrowernotes, |
517 |
) |
518 |
} |
519 |
|
520 |
if ( $noissues ) { |
521 |
$template->param( |
522 |
noissues => ($force_allow_issue) ? 0 : 'true', |
523 |
forceallow => $force_allow_issue, |
524 |
); |
525 |
} |
526 |
} |
544 |
|
527 |
|
545 |
if ( $patron && $patron->category->category_type eq 'C') { |
528 |
if ( $patron && $patron->category->category_type eq 'C') { |
546 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
529 |
my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); |
Lines 626-632
$template->param(
Link Here
|
626 |
duedatespec => $duedatespec, |
609 |
duedatespec => $duedatespec, |
627 |
restoreduedatespec => $restoreduedatespec, |
610 |
restoreduedatespec => $restoreduedatespec, |
628 |
message => $message, |
611 |
message => $message, |
629 |
totaldue => sprintf('%.2f', $total), |
612 |
totaldue => sprintf('%.2f', $balance), # FIXME not used in template? |
630 |
inprocess => $inprocess, |
613 |
inprocess => $inprocess, |
631 |
$view => 1, |
614 |
$view => 1, |
632 |
batch_allowed => $batch_allowed, |
615 |
batch_allowed => $batch_allowed, |