Bug 8045

Summary: Problems on Due date when checking in
Product: Koha Reporter: Adrien SAURAT <adrien.saurat>
Component: CirculationAssignee: Adrien SAURAT <adrien.saurat>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: chris, gmcharlt, koha.sekjal, nengard, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: proposed patch #1
[SIGNED-OFF] Bug 8045: fixes "date due" when checking in

Description Adrien SAURAT 2012-05-04 13:07:05 UTC
When a document is checked in :
1) The due date displayed is the date of the checkin operation. It's not very useful for librarians as they can't see if the patron was late.

2) When checking in a late document, the displayed "due date" is not even the date of today, but the date of tomorrow!


To correct both problems:
-> Shouldn't we display the initial due date instead?
Comment 1 Adrien SAURAT 2012-05-04 13:16:23 UTC
CORRECTION:
The bug only appears when the document is late, and the displayed date is then the date of tomorrow.
Only one problem then. And no question about the solution.
Comment 2 Owen Leonard 2012-05-04 15:57:08 UTC
*** Bug 8046 has been marked as a duplicate of this bug. ***
Comment 3 Owen Leonard 2012-05-04 16:22:48 UTC
I suspect this commit: 99eccc18ed4a21fa416a3d61fed3f70825dc2203 (Bug 5549), but it's hard to tell because I can't even open returns.pl under that revision ("Undefined subroutine &main::now called at /home/oleonard/kohaclone/circ/returns.pl line 180.")
Comment 4 Adrien SAURAT 2012-05-07 09:04:03 UTC
Looks like the problem comes from the _FixFineDaysOnReturn function in Circulation.pm

The commit mentionned by Owen is pushed but the bug 5549 is still only signed off. Are the houly loans partly implemented ?
Comment 5 Chris Cormack 2012-05-07 09:07:29 UTC
No the patch on there is a further enhancement.
Comment 6 Adrien SAURAT 2012-05-07 09:12:18 UTC
Ok.

What I see is that after the following line :
my $dt_due =  dt_from_string( $datedue );

the $datedue value is broken, getting the value of today. Is dt_from_string really supposed to work this way?
Comment 7 Adrien SAURAT 2012-05-07 10:00:45 UTC
I misread some logs, the error actually comes from the following line in _FixFineDaysOnReturn:

my $deltadays = $calendar->days_between( $dt_due, $dt_today );

When calculating the delay for the fine management, the due date is modified. I'm not familiar with these dates handling and I'm not sure yet of the best fix. I keep looking at it.
Comment 8 Adrien SAURAT 2012-05-07 14:15:37 UTC Comment hidden (obsolete)
Comment 9 Nicole C. Engard 2012-05-07 14:29:35 UTC
Created attachment 9429 [details] [review]
[SIGNED-OFF] Bug 8045: fixes "date due" when checking in

Added cloning of object parameters in "days_between" method.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

Checked in items that were overdue, due in the future and not
checked out and all showed the right info in the check in
table.
Comment 10 Ian Walls 2012-05-10 16:20:26 UTC
Clones start and end dates, which prevents any leaked modifications to the object.  Marking as Passed QA.
Comment 11 Chris Cormack 2012-05-14 20:51:57 UTC
Bugfix will be in 3.8.1