From 245e9ebf653072d1f2902dca02ae6164ca72ff9d Mon Sep 17 00:00:00 2001 From: dbwells Date: Tue, 1 Feb 2011 18:43:55 +0000 Subject: [PATCH] Backport r19288 : Fix checkin backdate assumptions checkin_handle_backdate() did not properly interpret bill data (voided too much), so lets use void_overdues() instead git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_2@19350 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Circ/Circulate.pm | 36 ++++++---------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index b422e90e04..92f0d17459 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -2707,8 +2707,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(!$circ->stop_fines) { @@ -2816,41 +2816,23 @@ sub checkin_handle_lost { sub checkin_handle_backdate { my $self = shift; - my $bd = clense_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 = clense_ISO8601($self->backdate); my $original_date = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($self->circ->due_date)); my $new_date = DateTime::Format::ISO8601->new->parse_datetime($bd); $bd = clense_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; } -- 2.11.0