From 2a85fa229352c5e273ff2474da86005cd0f87348 Mon Sep 17 00:00:00 2001
From: gmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 5 Aug 2010 03:03:15 +0000
Subject: [PATCH] bug 613703: normalize backdate on item checkin better

Fixes bug that appears to cause all checkins uploaded
via offline circ to fail with an "invalid date format"
error.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>


git-svn-id: svn://svn.open-ils.org/ILS/trunk@17088 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
index 8cb1dd16fa..7eb71928fd 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
@@ -2797,7 +2797,7 @@ sub checkin_handle_lost {
 sub checkin_handle_backdate {
     my $self = shift;
 
-    my $bd = $self->backdate;
+    my $bd = cleanse_ISO8601($self->backdate);
 
     # ------------------------------------------------------------------
     # clean up the backdate for date comparison
@@ -2805,7 +2805,7 @@ sub checkin_handle_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 = $new_date->ymd . 'T' . $original_date->strftime('%T%z');
+    $bd = cleanse_ISO8601($new_date->ymd . 'T' . $original_date->strftime('%T%z'));
 
     $self->backdate($bd);
 
-- 
2.11.0