LP#1481036 Ignore future backdates (part 2).
authorBill Erickson <berickxx@gmail.com>
Mon, 3 Aug 2015 18:03:52 +0000 (14:03 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 3 Aug 2015 18:06:59 +0000 (14:06 -0400)
Ensure that future backdates are successully ignored in the checkin API.
The logic was in place to do this, but it failed to clear the values,
resulting in using the future backdate anyway.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 61ef659..78eaf3a 100644 (file)
@@ -3480,12 +3480,14 @@ sub checkin_handle_backdate {
     $new_date->set_minute($original_date->minute());
     if ($new_date >= DateTime->now) {
         # We can't say that the item will be checked in later...so assume someone's clock is wrong instead.
-        $bd = undef;
+        # $self->backdate() autoload handler ignores undef values.  
+        # Clear the backdate manually.
+        $logger->info("circulator: ignoring future backdate: $new_date");
+        delete $self->{backdate};
     } else {
-        $bd = cleanse_ISO8601($new_date->datetime());
+        $self->backdate(cleanse_ISO8601($new_date->datetime()));
     }
 
-    $self->backdate($bd);
     return undef;
 }