From 1651fcf3917d3e584ce83e2f287f7f5b3910f608 Mon Sep 17 00:00:00 2001 From: dbwells Date: Tue, 25 Jan 2011 20:43:47 +0000 Subject: [PATCH] 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/trunk@19288 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 12318596f6..c000676b45 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; } -- 2.11.0