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
[email protected]
_______________________________________________
Koha-devel mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to