Bug 17680: C4::Circulation - Remove GetItemIssue, complex calls
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 25 Nov 2016 12:53:03 +0000 (13:53 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 Jul 2017 15:06:37 +0000 (12:06 -0300)
commitfa592a9685a5f072b20ef16c3f3fbcd2fa6e36b2
treeb616fa58ca4ab76f1ac7b1916cefbcd0a0b0d473
parentff100eb77362781ce901066818baa03b4ff1f7eb
Bug 17680: C4::Circulation - Remove GetItemIssue, complex calls

There are a few calls to GetItemIssue where it's not as easy to make
sure everything will be fine just replacing the calls with a
Koha::Issues->find
- In AddReturn the overdue flag is used (that's why this patch depends
on bug 17689)
- In CanBookBeRenewed, as well as the overdue flag the dates converted
to DateTime were used. It's now our job to convert them when we need
them.
- Same in AddRenewal but we also call _CalculateAndUpdateFine, so we
need to update the variables in this subroutine.

Note that, prior to this patch, AddReturn returned the GetItemIssue
hashref in the $iteminformation. Most of the time this variable is not
used, I have found only 1 place where it's used: circ/returns.pl
TODO: In this script we should call ->is_overdue instead of the
DateTime->compare calls

Test plan:
All the circulation tests must pass (it's how I have caught the specific
cases).
Do some checkins/checkouts/renewal and focus on the due date

Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Circulation.pm
circ/returns.pl