From 0918e317c14bdff2e24214a002ec55e790386a57 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 17 Jun 2013 13:14:34 -0400 Subject: [PATCH] process_recall needs the right ISO8601 standard We need to run dates through cleanse_ISO8601() to make date comparisons happy. Signed-off-by: Dan Scott --- .../perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index 2bbfe3f726..b777796abd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -1852,7 +1852,7 @@ sub process_recall { $log->info("Found " . scalar(@$all_copies) . " eligible checked-out copies for recall"); - my $return_date = DateTime->now(time_zone => 'local')->add(seconds => interval_to_seconds($return_interval))->iso8601(); + my $return_date = cleanse_ISO8601(DateTime->now(time_zone => 'local')->add(seconds => interval_to_seconds($return_interval))->iso8601()); # Iterate over the checked-out copies to find a copy with a # loan period longer than the recall threshold: @@ -1873,9 +1873,10 @@ sub process_recall { $return_date = $threshold_date; } + my $due_date = cleanse_ISO8601($circ->due_date); # Ensure that new loan period is not longer than original due date, if it is, stick with original date - if (DateTime->compare(DateTime::Format::ISO8601->parse_datetime($circ->due_date),DateTime::Format::ISO8601->parse_datetime($return_date)) == -1) { - $return_date = $circ->due_date; + if (DateTime->compare(DateTime::Format::ISO8601->parse_datetime($due_date),DateTime::Format::ISO8601->parse_datetime($return_date)) == -1) { + $return_date = $due_date; }; my $update_fields = { -- 2.11.0