View | Details | Raw Unified | Return to bug 23382
Collapse All | Expand All

(-)a/Koha/Calendar.pm (-5 / +8 lines)
Lines 344-360 sub hours_between { Link Here
344
    # However for hourly loans the logic should be expanded to
344
    # However for hourly loans the logic should be expanded to
345
    # take into account open/close times then it would be a duration
345
    # take into account open/close times then it would be a duration
346
    # of library open hours
346
    # of library open hours
347
    # start and end should not be closed days
348
    my $skipped_days = 0;
347
    my $skipped_days = 0;
349
    while( $start_dt->compare($end_dt) < 1 ) {
348
    for (my $dt = $start_dt->clone();
350
        $start_dt->add( days => 1 );
349
        $dt <= $end_dt;
351
        $skipped_days++ if $self->is_holiday($start_dt);
350
        $dt->add(days => 1)
351
    ) {
352
        if ($self->is_holiday($dt)) {
353
            ++$skipped_days;
354
        }
352
    }
355
    }
353
    if ($skipped_days) {
356
    if ($skipped_days) {
354
        $duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days));
357
        $duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days));
355
    }
358
    }
356
359
357
    return $duration;
360
    return $duration;
361
358
}
362
}
359
363
360
sub set_daysmode {
364
sub set_daysmode {
361
- 

Return to bug 23382