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@equinoxinitiative.org>
Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
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;
# 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;
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