From: Chris Cormack Date: Tue, 20 Mar 2012 22:09:51 +0000 (+1300) Subject: Bug 5549 : _FixFineDaysOnReturn was using C4::Dates in calling X-Git-Tag: v3.08.00~239^2~4 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=62621825e5f12c203a10c59464e5f5ed6cc3c0a6;p=koha_gimpoz Bug 5549 : _FixFineDaysOnReturn was using C4::Dates in calling days_between, fixed to use DateTime objects --- diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 59f01fae58..0adc8dc971 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1785,7 +1785,9 @@ Internal function, called only by AddReturn that calculate and update the user f sub _FixFineDaysOnReturn { my ( $borrower, $item, $datedue ) = @_; - + + my $dt_due = dt_from_string($datedue); + my $dt_today = DateTime->now( time_zone => C4::Context->tz() ); if ($datedue) { $datedue = C4::Dates->new( $datedue, "iso" ); } else { @@ -1796,7 +1798,7 @@ sub _FixFineDaysOnReturn { my $calendar = Koha::Calendar->new( branchcode => $branchcode ); my $today = C4::Dates->new(); - my $deltadays = $calendar->days_between( $datedue, C4::Dates->new() ); + my $deltadays = $calendar->days_between( $dt_due, $dt_today ); my $circcontrol = C4::Context::preference('CircControl'); my $issuingrule = GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode );