From: dbwells Date: Tue, 25 Jan 2011 23:29:50 +0000 (+0000) Subject: Backport r19288 : twice tested, thrice approved X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cda69831273b7d3fbc94617e537118588785491d;p=evergreen%2Fequinox.git Backport r19288 : twice tested, thrice approved This change was confirmed to work at two test sites, and also passed a berick eyeball test. Would always be nice to have more... git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@19300 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 7931c4000e..1a75137d7a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -2942,8 +2942,8 @@ sub checkin_handle_circ { # backdate the circ if necessary if($self->backdate) { - $self->checkin_handle_backdate; - return if $self->bail_out; + my $evt = $self->checkin_handle_backdate; + return $self->bail_on_events($evt) if $evt; } if($self->void_overdues) { @@ -3062,41 +3062,23 @@ sub checkin_handle_lost { sub checkin_handle_backdate { my $self = shift; - my $bd = cleanse_ISO8601($self->backdate); - # ------------------------------------------------------------------ # clean up the backdate for date comparison - # we want any bills created on or after the backdate + # XXX We are currently taking the due-time from the original due-date, + # not the input. Do we need to do this? This certainly interferes with + # backdating of hourly checkouts, but that is likely a very rare case. # ------------------------------------------------------------------ + my $bd = cleanse_ISO8601($self->backdate); my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($self->circ->due_date)); my $new_date = DateTime::Format::ISO8601->new->parse_datetime($bd); $bd = cleanse_ISO8601($new_date->ymd . 'T' . $original_date->strftime('%T%z')); $self->backdate($bd); - my $bills = $self->editor->search_money_billing( - { - billing_ts => { '>=' => $bd }, - xact => $self->circ->id, - btype => 1 - } - ); - - $logger->debug("backdate found ".scalar(@$bills)." bills to void"); - - for my $bill (@$bills) { - unless( $U->is_true($bill->voided) ) { - $logger->info("backdate voiding bill ".$bill->id); - $bill->voided('t'); - $bill->void_time('now'); - $bill->voider($self->editor->requestor->id); - my $n = $bill->note || ""; - $bill->note("$n\nSystem: VOIDED FOR BACKDATE"); + my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($self->editor, $self->circ, $bd); + return $evt if $evt; - $self->bail_on_events($self->editor->event) - unless $self->editor->update_money_billing($bill); - } - } + return undef; }