[Koha-patches] [PATCH] bug 2758: don't confirm checkout if fine balance is 0
Galen Charlton
galen.charlton at liblime.com
Tue Dec 2 18:09:57 CET 2008
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.
---
C4/Circulation.pm | 2 +-
t/lib/KohaTest/Circulation/AddIssue.pm | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index fb0cbb0..455a90d 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -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 );
}
}
diff --git a/t/lib/KohaTest/Circulation/AddIssue.pm b/t/lib/KohaTest/Circulation/AddIssue.pm
index 73cf7b2..2c3e393 100644
--- a/t/lib/KohaTest/Circulation/AddIssue.pm
+++ b/t/lib/KohaTest/Circulation/AddIssue.pm
@@ -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" );
--
1.5.5.GIT
More information about the Koha-patches
mailing list