[Koha-bugs] [Bug 16387] Incorrect loan period calculation when using decreaseLoanHighHolds feature
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Aug 19 22:52:13 CEST 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16387
Christopher Brannon <cbrannon at cdalibrary.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cbrannon at cdalibrary.org
--- Comment #1 from Christopher Brannon <cbrannon at cdalibrary.org> ---
I was just noticing this. I talked with Nick Clemens, and he thinks it might
be this in circulation.pm:
1178 my $issuedate = DateTime->now( time_zone => C4::Context->tz() );
1179
1180 my $calendar = Koha::Calendar->new( branchcode => $branch );
1181
1182 my $itype =
1183 ( C4::Context->preference('item-level_itypes') )
1184 ? $biblio->{'itype'}
1185 : $biblio->{'itemtype'};
1186
1187 my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype,
$branch, $borrower );
1188
1189 my $decreaseLoanHighHoldsDuration =
C4::Context->preference('decreaseLoanHighHoldsDuration');
1190
1191 my $reduced_datedue = $calendar->addDate( $issuedate,
$decreaseLoanHighHoldsDuration );
1192
1193 if ( DateTime->compare( $reduced_datedue, $orig_due ) == -1 ) {
1194 $return_data->{exceeded} = 1;
1195 $return_data->{duration} = $decreaseLoanHighHoldsDuration;
1196 $return_data->{due_date} = $reduced_datedue;
Line 1196 is assigning the value in $reduced_datedue.
Line 1191 is basing the value of $reduced_datedue from $issuedate
Line 1178 is assigning $issuedate a value based on now(the time at this very
moment).
So somehow we need $reduced_datedue to use the same time as $orig_due, but only
adjust the date, and not reference $issuedate.
I would do this, but I barely understand what I am looking at, thanks to Nick's
help.
Hope this helps.
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list