[Koha-devel] About "Problems on Due date when checking in"

Bernardo Gonzalez Kriegel bgkriegel at gmail.com
Fri Jun 15 03:07:55 CEST 2012


Hi,
we noted a strange behavior: if check out an item and immediately check in
the item then the user is debarred.

Following the code found that user is debarred if ($deltadays
-$grace)->is_positive is true
(_FixFineDaysOnReturn, C4/Circulation.pm)

I think that $deltadays = $calendar->days_between( $dt_due, $dt_today )
needs to be negative if
$dt_due > $dt_today, but is computed on Koha/Calendar.pm as

my $duration = $dateend_temp->delta_days($datestart_temp);
(there is a while that changes $duration but DateTime->compare(
$datestart_temp, $dateend_temp ) = 1 in this case)

Now, the method delta_days() *always returns a positive duration*, even if
$dt_due > $dt_today

If we compute $duration as

my $duration = $dateend_temp->subtract_datetime($datestart_temp);

and add a line on C4/Circulation.pm

my $deltadays = $calendar->days_between( $dt_due, $dt_today );
+return if ( $deltadays->is_negative );

we solved our problem.

Do you think that this is a real bug or we missed some configuration?

(the code examples are from master but the problem is on 3.8.0, where we
found it.
BUG 8045 changes some of the code, but not the use of delta_days() method)

Sincerely
Bernardo

-- 
Bernardo Gonzalez Kriegel
bgkriegel at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20120614/a9d2ac03/attachment.htm>


More information about the Koha-devel mailing list