From a54b18e01f98ac74dfa9ab9e886c344e045e92d7 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 31 Jul 2017 15:15:57 -0400 Subject: [PATCH] Revert "LP#1635737 Use new OpenSRF interval_to_seconds() context" This reverts commit 04a101312b0a42d34108c8d78997a3960241363a. --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm | 6 +++++- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 65b6f042d3..21b875d49c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -2077,12 +2077,16 @@ sub apply_modified_due_date { sub create_due_date { my( $self, $duration, $date_ceiling, $force_date, $start_time ) = @_; + # if there is a raw time component (e.g. from postgres), + # turn it into an interval that interval_to_seconds can parse + $duration =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o; + # for now, use the server timezone. TODO: use workstation org timezone my $due_date = DateTime->now(time_zone => 'local'); $due_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($start_time)) if $start_time; # add the circ duration - $due_date->add(seconds => OpenSRF::Utils->interval_to_seconds($duration, $due_date)); + $due_date->add(seconds => OpenSRF::Utils->interval_to_seconds($duration)); if($date_ceiling) { my $cdate = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($date_ceiling)); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm index 3302b87055..26b85d2cd7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm @@ -188,7 +188,7 @@ sub noncat_due_date { my $duedate = $_dt_parser->parse_datetime( cleanse_ISO8601($circ->circ_time) ); $duedate = $duedate - ->add( seconds => interval_to_seconds($otype->circ_duration, $duedate) ) + ->add( seconds => interval_to_seconds($otype->circ_duration) ) ->strftime('%FT%T%z'); my $offset = $U->storagereq( -- 2.11.0