}
if( $self->circ ) {
- $self->checkin_handle_circ;
+ $self->checkin_handle_circ_start;
return if $self->bail_out;
- $self->checkin_changed(1);
if (!$dont_change_lost_zero) {
# if this circ is LOST and we are configured to generate overdue
# handle fines for this circ, including overdue gen if needed
$self->handle_fines;
}
+
+ $self->checkin_handle_circ_finish;
+ return if $self->bail_out;
+ $self->checkin_changed(1);
+
} elsif( $self->transit ) {
my $hold_transit = $self->process_received_transit;
$self->checkin_changed(1);
return undef;
}
-sub checkin_handle_circ {
+sub checkin_handle_circ_start {
my $self = shift;
my $circ = $self->circ;
my $copy = $self->copy;
$self->update_copy;
}
+ return undef;
+}
+
+sub checkin_handle_circ_finish {
+ my $self = shift;
+ my $circ = $self->circ;
# see if there are any fines owed on this circ. if not, close it
- ($obt) = $U->fetch_mbts($circ->id, $self->editor);
+ my ($obt) = $U->fetch_mbts($circ->id, $self->editor);
$circ->xact_finish('now') if( $obt and $obt->balance_owed == 0 );
$logger->debug("circulator: ".$obt->balance_owed." is owed on this circulation");
--- /dev/null
+#!perl
+
+use Test::More tests => 2;
+
+diag("Make sure we don't close xacts with fines");
+
+use strict;
+use warnings;
+
+use OpenILS::Utils::TestUtils;
+my $script = OpenILS::Utils::TestUtils->new();
+#our $apputils = "OpenILS::Application::AppUtils";
+my $storage_ses = $script->session('open-ils.storage');
+$script->authenticate({
+ username => 'admin',
+ password => 'demo123',
+ type => 'staff'});
+ok( $script->authtoken, 'Have an authtoken');
+
+my $barcode = 'CONC4000054';
+my $circ_id = 18;
+
+my $checkin_resp = $script->do_checkin_override({
+ barcode => $barcode});
+
+my $circ_req = $storage_ses->request('open-ils.storage.direct.action.circulation.retrieve', $circ_id);
+if (my $circ_resp = $circ_req->recv) {
+ if (my $circ = $circ_resp->content) {
+ ok(
+ !$circ->xact_finish,
+ 'Circ with id = ' . $circ_id . ' is overdue with fines, so xact_finish isn\'t set'
+ );
+ }
+}
+
+$script->logout();