[Koha-bugs] [Bug 8251] Patrons are systematically debarred at checkin

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jul 16 16:39:38 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8251

--- Comment #19 from Koha Team Lyon 3 <koha at univ-lyon3.fr> ---
It solves the problem of patrons getting systematically debarred but create a
new one  : false calculation of closed days (as I had already explained in
comment 9 and for the same reason that has been also noted in bug 8110). 
the subtraction of closed days, line 189 ($duration->subtract( days => 1 ) is
not correct when duration is greater than one month because subtract method
only subtracts days from days amount and not month one.

When initial duration is calculated with a subtraction between 2 datetime
objects (my $duration = $dateend_temp - $datestart_temp), here's the hash you
could get after the closed days had been 'subtracted' in "while (
DateTime->compare" loop :
example : the patron is 65 days late, there are 14 days closed
    $VAR1 = bless( {
                   'seconds' => 0,
                   'minutes' => 0,
                   'end_of_month' => 'wrap',
                   'nanoseconds' => 0,
                   'days' => -10,
                   'months' => 2
                 }, 'DateTime::Duration' ); 
So the patron won't be restriced at all !!

But if initial duration is calculated with delta_days fonction, with the same
example you'll obtain the following  :
$VAR1 = bless( {
                   'seconds' => 0,
                   'minutes' => 0,
                   'end_of_month' => 'wrap',
                   'nanoseconds' => 0,
                   'days' => 51,
                   'months' => 0
                 }, 'DateTime::Duration' ); 

So, this way, it's ok, the patron will be restricted for 51 days.
Others solution would be to calculate duration with integer and not duration
object as suggested in bug 8110 discussion or to find a way to subtract closed
day in correct way

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list