bug 2758: don't confirm checkout if fine balance is 0

Fixes problem where if the IssuingInProcess preference is ON,
the operator is always required to confirm a checkout if
the patron has had any fine transactions at all, even if
the patron's balance is 0.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Galen Charlton 2008-12-02 10:58:40 -06:00
parent 873d1c6336
commit 5f18793461
2 changed files with 17 additions and 2 deletions

View file

@ -689,7 +689,7 @@ sub CanBookBeIssued {
if ( $amount > $amountlimit && !$inprocess ) {
$issuingimpossible{DEBT} = sprintf( "%.2f", $amount );
}
elsif ( $amount <= $amountlimit && !$inprocess ) {
elsif ( $amount > 0 && $amount <= $amountlimit && !$inprocess ) {
$needsconfirmation{DEBT} = sprintf( "%.2f", $amount );
}
}

View file

@ -17,7 +17,7 @@ broken as we go along.
=cut
sub basic_usage : Test( 11 ) {
sub basic_usage : Test( 13 ) {
my $self = shift;
my $borrowernumber = $self->{'memberid'};
@ -43,6 +43,21 @@ sub basic_usage : Test( 11 ) {
is( scalar keys %$needsconfirmation, 0, '...and the transaction does not needsconfirmation' )
or diag( Data::Dumper->Dump( [ $issuingimpossible, $needsconfirmation ], [ qw( issuingimpossible needsconfirmation ) ] ) );
# bug 2758 don't ask for confirmation if patron has $0.00 account balance
# and IssuingInProcess is on
my $orig_issuing_in_process = C4::Context->preference('IssuingInProcess');
my $dbh = C4::Context->dbh;
$dbh->do("UPDATE systempreferences SET value = 1 WHERE variable = 'IssuingInProcess'");
C4::Context->clear_syspref_cache(); # FIXME not needed after a syspref mutator is written
( $issuingimpossible, $needsconfirmation ) = C4::Circulation::CanBookBeIssued( $borrower, $barcode );
is( scalar keys %$issuingimpossible, 0, 'the item CanBookBeIssued with IssuingInProcess ON (bug 2758)' )
or diag( Data::Dumper->Dump( [ $issuingimpossible, $needsconfirmation ], [ qw( issuingimpossible needsconfirmation ) ] ) );
is( scalar keys %$needsconfirmation, 0,
'...and the transaction does not needsconfirmation with IssuingInProcess ON (bug 2758)' )
or diag( Data::Dumper->Dump( [ $issuingimpossible, $needsconfirmation ], [ qw( issuingimpossible needsconfirmation ) ] ) );
$dbh->do("UPDATE systempreferences SET value = ? WHERE variable = 'IssuingInProcess'", {}, $orig_issuing_in_process);
C4::Context->clear_syspref_cache(); # FIXME not needed after a syspref mutator is written
my $datedue = C4::Circulation::AddIssue( $borrower, $barcode );
ok( $datedue, "the item has been issued and it is due: $datedue" );