Bug 11633 Return Correct status if patron blocked by fines

If the patron has amassed charges that block borrowing, but we
allow staff override the information that the patron cannot
issue should be included the patron information response

This patch sets the appropriate status fields in the patron object

It restores the fee_limit member to the patron object
and calls a local subroutine to set it.

This could be done more elegantly but that would require more
major refactoring of the rather messy initializer code
in ILS::Patron

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Colin Campbell 2014-04-17 16:07:20 +01:00 committed by Tomas Cohen Arazi
parent 2bd151fab5
commit 04857ed68e
1 changed files with 10 additions and 8 deletions

View File

@ -61,6 +61,8 @@ sub new {
$dexpiry and $dexpiry =~ s/-//g; # YYYYMMDD
my $fines_amount = $flags->{CHARGES}->{amount};
$fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0;
my $fee_limit = _fee_limit();
my $fine_blocked = $fines_amount > $fee_limit;
{
no warnings; # any of these $kp->{fields} being concat'd could be undef
%ilspatron = (
@ -79,10 +81,10 @@ sub new {
address => $adr,
home_phone => $kp->{phone},
email_addr => $kp->{email},
charge_ok => ( !$debarred && !$expired ),
renew_ok => ( !$debarred && !$expired ),
recall_ok => ( !$debarred && !$expired ),
hold_ok => ( !$debarred && !$expired ),
charge_ok => ( !$debarred && !$expired && !$fine_blocked),
renew_ok => ( !$debarred && !$expired && !$fine_blocked),
recall_ok => ( !$debarred && !$expired && !$fine_blocked),
hold_ok => ( !$debarred && !$expired && !$fine_blocked),
card_lost => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
claims_returned => 0,
fines => $fines_amount, # GetMemberAccountRecords($kp->{borrowernumber})
@ -99,6 +101,7 @@ sub new {
unavail_holds => [],
inet => ( !$debarred && !$expired ),
expired => $expired,
fee_limit => $fee_limit,
);
}
$debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
@ -146,7 +149,7 @@ my %fields = (
card_lost => 0, # for patron_status[4]
recall_overdue => 0,
currency => 1,
# fee_limit => 0,
fee_limit => 0,
screen_msg => 1,
print_line => 1,
too_many_charged => 0, # for patron_status[5]
@ -331,9 +334,8 @@ sub inet_privileges {
return $self->{inet} ? 'Y' : 'N';
}
sub fee_limit {
my $self = shift;
return C4::Context->preference("noissuescharge") || 5;
sub _fee_limit {
return C4::Context->preference('noissuescharge') || 5;
}
sub excessive_fees {