[open-ils-commits] [GIT] Evergreen ILS branch rel_3_3 updated. fe71a4428e401a18b6ad2f393fe97b2b282d6f48

Evergreen Git git at git.evergreen-ils.org
Fri Jan 3 13:47:21 EST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_3 has been updated
       via  fe71a4428e401a18b6ad2f393fe97b2b282d6f48 (commit)
      from  4ab843f4988f147ef1f5e8fcd8643d3ad8998c4d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fe71a4428e401a18b6ad2f393fe97b2b282d6f48
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Fri Dec 20 12:55:16 2019 -0500

    LP#1857156: handle HHH:MM:SS durations in loans
    
    This patch fixes a problem where loan durations of the form
    HHH:MM:SS, where the hours component is longer than 2 digits, could
    cause checkouts to fail. This sort of duration has been observed
    in cases where a library wanted a long-term reserves loan that
    doesn't have the due time bumped up to midnight.
    
    To test
    -------
    [1] Set up a circulation policy that has a loan duration of 167:59:59.
    [2] Attempt a checkout that uses that policy. Note that the checkout
        will fail.
    [3] Apply the patch and repeat step 2. This time, the checkout should
        succeed.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Michele Morgan <mmorgan at noblenet.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/DateTime.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/DateTime.pm
index 1da0951f40..bef04c5afb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/DateTime.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/DateTime.pm
@@ -109,7 +109,7 @@ sub interval_to_seconds {
     my $interval = ($class eq __PACKAGE__) ? shift : $class;
     my $context = shift;
 
-    $interval =~ s/(\d{2}):(\d{2}):(\d{2})/ $1 h $2 min $3 s /go;
+    $interval =~ s/(\d{2,}):(\d{2}):(\d{2})/ $1 h $2 min $3 s /go;
 
     $interval =~ s/and/,/g;
     $interval =~ s/,/ /g;
diff --git a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
index 81cf90ffae..2aa2afb5d3 100644
--- a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
+++ b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t
@@ -14,7 +14,7 @@
 # truckload to verify that everything would continue to work if
 # we turn it on across the board.
 
-use Test::More tests => 47;
+use Test::More tests => 48;
 use Test::Warn;
 use DateTime::TimeZone;
 use DateTime::Format::ISO8601;
@@ -140,6 +140,7 @@ is (OpenILS::Utils::DateTime::interval_to_seconds('1 month',
 
 is (OpenILS::Utils::DateTime::interval_to_seconds('1 year'), 31536000);
 is (OpenILS::Utils::DateTime::interval_to_seconds('1 year 1 second'), 31536001);
+is (OpenILS::Utils::DateTime::interval_to_seconds('167:59:59'), 604799, 'correctly convert HHH:MM:SS intervals where hours longer than 2 digits');
 
 sub get_offset {
     # get current timezone offset for future use

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/Utils/DateTime.pm | 2 +-
 Open-ILS/src/perlmods/t/14-OpenILS-Utils.t          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list