loans with HHH:MM:SS durations can fail

Bug #1857156 reported by Galen Charlton
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.3
Fix Released
Medium
Unassigned

Bug Description

If a loan duration is expressed in PostgreSQL in the form HHH:MM:SS, i.e., where the number of hours spans more than two digits, a checkout that uses that duration can fail with the following sort of error:

error calling method open-ils.circ.checkout.full : 500 : *** Call to [open-ils.circ.checkout.full] failed for session [0.333027440482416841576780004704], thread trace [0]:
The following parameter was passed in the call to DateTime::Duration::new but was not listed in the validation options: 67
 at /usr/lib/x86_64-linux-gnu/perl5/5.22/DateTime/Duration.pm line 30.
 DateTime::Duration::new(undef, 67, 1) called at /usr/lib/x86_64-linux-gnu/perl5/5.22/DateTime/Duration.pm line 233
 DateTime::Duration::add(DateTime::Duration=HASH(0x7255968), 67, 1) called at /usr/local/share/perl/5.22.1/OpenILS/Utils/DateTime.pm line 138
 OpenILS::Utils::DateTime::interval_to_seconds("OpenILS::Utils::DateTime", "167:59:59", DateTime=HASH(0x7255ec0)) called at /usr/local/share/perl/5.22.1/OpenILS/Application/Circ/Circulate.pm line 2408
 OpenILS::Application::Circ::Circulator::create_due_date(OpenILS::Application::Circ::Circulator=HASH(0x724fb60), "167:59:59", undef, undef, undef) called at /usr/local/share/perl/5.22.1/OpenILS/Application/Circ/Circulate.pm line 2177
...

An example of such a duration in found in production use is 167:59:59. This duration was set for a laptop reserves loan, and the interval was intentionally set to a week minus one second to avoid having the due time be bumped up to midnight.

Evergreen 3.4+

Revision history for this message
Galen Charlton (gmc) wrote :

This may well affect 3.3 as well, and possibly earlier versions.

Changed in evergreen:
importance: Undecided → Medium
milestone: none → 3.4.2
Revision history for this message
Galen Charlton (gmc) wrote :

A patch is available in the branch working/user/gmcharlt/lp1857156_fix_hhh_mm_ss_loan_durations / https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/gmcharlt/lp1857156_fix_hhh_mm_ss_loan_durations

tags: added: circulation
tags: added: pullrequest
Revision history for this message
Dan Scott (denials) wrote :

I have tested the patch on our 3.4-based development system with items that had a circulation duration of 168 hours ("168:00:00"). It was a blocking problem: even trying to override the due date failed as the code first tries to resolve the default duration.

Before applying the patch, we suffered the same problem as was reported in this bug.

After applying the patch, the problem was resolved. I then applied it to our production 3.4-based system.

I also ran the Perl tests and can report that the additional test that Galen added (thank you!) passed successfully. I have posted a signoff branch at working/user/dbs/lp1857156_fix_hhh_mm_ss_loan_durations_signoff / https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbs/lp1857156_fix_hhh_mm_ss_loan_durations_signoff

tags: added: signedoff
Revision history for this message
Michele Morgan (mmorgan) wrote :
Revision history for this message
Galen Charlton (gmc) wrote :

Thanks for testing and signing off, Dan and MIchele. I've pushed the patch to master, rel_3_4, and rel_3_3.

Changed in evergreen:
status: New → Confirmed
assignee: nobody → Galen Charlton (gmc)
no longer affects: evergreen/3.2
Changed in evergreen:
status: Confirmed → Fix Committed
assignee: Galen Charlton (gmc) → nobody
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.