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

(-)a/misc/cronjobs/longoverdue.pl (-10 / +10 lines)
Lines 317-327 sub longoverdue_sth { Link Here
317
    return C4::Context->dbh->prepare($query);
317
    return C4::Context->dbh->prepare($query);
318
}
318
}
319
319
320
my @holidays_by_branch;
321
322
sub get_number_of_holidays {
320
sub get_number_of_holidays {
323
    my ( $start_date, $end_date ) = @_;
321
    my ( $start_date, $end_date ) = @_;
324
322
323
    my @holidays_by_branch;
324
325
    $start_date = dt_from_string($start_date);
325
    $start_date = dt_from_string($start_date);
326
    $end_date   = dt_from_string($end_date);
326
    $end_date   = dt_from_string($end_date);
327
327
Lines 421-427 foreach my $startrange (sort keys %$lost) { Link Here
421
        my ($date2) = bounds(  $endrange);
421
        my ($date2) = bounds(  $endrange);
422
422
423
        if ( C4::Context->preference( 'LongOverdueNoticeCalendar' ) ) {
423
        if ( C4::Context->preference( 'LongOverdueNoticeCalendar' ) ) {
424
            get_number_of_holidays( $date2, $date1 );
424
            my $holidays_by_branch = get_number_of_holidays( $date2, $date1 );
425
425
426
            foreach my $branch ( @holidays_by_branch ) {
426
            foreach my $branch ( @holidays_by_branch ) {
427
427
Lines 436-448 foreach my $startrange (sort keys %$lost) { Link Here
436
                $sth_items->execute($startrange, $endrange_with_holidays, $lostvalue);
436
                $sth_items->execute($startrange, $endrange_with_holidays, $lostvalue);
437
            }
437
            }
438
        } else {
438
        } else {
439
439
            # print "\nRange ", ++$i, "\nDue $startrange - $endrange days ago ($date2 to $date1), lost => $lostvalue\n" if($verbose);
440
        # print "\nRange ", ++$i, "\nDue $startrange - $endrange days ago ($date2 to $date1), lost => $lostvalue\n" if($verbose);
440
            $verbose and
441
        $verbose and
441
                printf "\nRange %s\nDue %3s - %3s days ago (%s to %s), lost => %s\n", ++$i,
442
            printf "\nRange %s\nDue %3s - %3s days ago (%s to %s), lost => %s\n", ++$i,
442
                $startrange, $endrange, $date2, $date1, $lostvalue;
443
            $startrange, $endrange, $date2, $date1, $lostvalue;
443
            $sth_items->execute($startrange, $endrange, $lostvalue);
444
        $sth_items->execute($startrange, $endrange, $lostvalue);
445
        }
444
        }
445
446
        $count=0;
446
        $count=0;
447
        ITEM: while (my $row=$sth_items->fetchrow_hashref) {
447
        ITEM: while (my $row=$sth_items->fetchrow_hashref) {
448
            if( $filter_borrower_categories ) {
448
            if( $filter_borrower_categories ) {
Lines 466-471 foreach my $startrange (sort keys %$lost) { Link Here
466
            }
466
            }
467
            $count++;
467
            $count++;
468
        }
468
        }
469
469
        push @report, {
470
        push @report, {
470
           startrange => $startrange,
471
           startrange => $startrange,
471
             endrange => $endrange,
472
             endrange => $endrange,
472
- 

Return to bug 18064