# run the fine generator against this circ, if this circ is there
$self->generate_fines_start if $self->circ;
-
if( $self->checkin_check_holds_shelf() ) {
$self->bail_on_events(OpenILS::Event->new('NO_CHANGE'));
$self->hold($U->fetch_open_hold_by_copy($self->copy->id));
}
if( $self->is_renewal ) {
+ $self->finish_fines_and_voiding;
+ return if $self->bail_out;
$self->push_events(OpenILS::Event->new('SUCCESS'));
return;
}
unless @{$self->events};
}
- # gather any updates to the circ after fine generation, if there was a circ
- $self->generate_fines_finish if ($self->circ);
+ $self->finish_fines_and_voiding;
OpenILS::Utils::Penalty->calculate_penalties(
$self->editor, $self->patron->id, $self->circ_lib) if $self->patron;
return;
}
+sub finish_fines_and_voiding {
+ my $self = shift;
+
+ # gather any updates to the circ after fine generation, if there was a circ
+ $self->generate_fines_finish if ($self->circ);
+
+ return unless $self->backdate or $self->void_overdues;
+
+ # void overdues after fine generation to prevent concurrent DB access to overdue billings
+ my $note = 'System: Amnesty Checkin' if $self->void_overdues;
+
+ my $evt = OpenILS::Application::Circ::CircCommon->void_overdues(
+ $self->editor, $self->circ, $self->backdate, $note);
+
+ return $self->bail_on_events($evt) if $evt;
+
+ # make sure the circ isn't closed if we just voided some fines
+ $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($self->editor, $self->circ->id);
+ return $self->bail_on_events($evt) if $evt;
+
+ return undef;
+}
+
+
# if a deposit was payed for this item, push the event
sub check_circ_deposit {
my $self = shift;
return $self->bail_on_events($evt) if $evt;
}
- if($self->void_overdues) {
- my $evt = OpenILS::Application::Circ::CircCommon->void_overdues(
- $self->editor, $circ, undef, 'System: Amnesty Checkin'); # TODO i18n for system-generated notes
- return $self->bail_on_events($evt) if $evt;
- }
-
if(!$circ->stop_fines) {
$circ->stop_fines(OILS_STOP_FINES_CHECKIN);
$circ->stop_fines(OILS_STOP_FINES_RENEW) if $self->is_renewal;
return $self->bail_on_events($self->editor->event)
unless $self->editor->update_action_circulation($circ);
- # make sure the circ isn't closed if we just voided some fines
- $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($self->editor, $circ->id);
- return $self->bail_on_events($evt) if $evt;
-
return undef;
}
$bd = cleanse_ISO8601($new_date->ymd . 'T' . $original_date->strftime('%T%z'));
$self->backdate($bd);
-
- my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($self->editor, $self->circ, $bd);
- return $evt if $evt;
-
return undef;
}