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

(-)a/misc/cronjobs/overdue_notices.pl (-7 / +11 lines)
Lines 318-324 my ( $date_input, $today ); Link Here
318
GetOptions(
318
GetOptions(
319
    'help|?'         => \$help,
319
    'help|?'         => \$help,
320
    'man'            => \$man,
320
    'man'            => \$man,
321
    'v'              => \$verbose,
321
    'v|verbose+'     => \$verbose,
322
    'n'              => \$nomail,
322
    'n'              => \$nomail,
323
    'max=s'          => \$MAX,
323
    'max=s'          => \$MAX,
324
    'library=s'      => \@branchcodes,
324
    'library=s'      => \@branchcodes,
Lines 475-480 foreach my $branchcode (@branches) { Link Here
475
      || $library->inbound_email_address;
475
      || $library->inbound_email_address;
476
    my @output_chunks;    # may be sent to mail or stdout or csv file.
476
    my @output_chunks;    # may be sent to mail or stdout or csv file.
477
477
478
    $verbose and print "======================================\n";
478
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address;
479
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address;
479
480
480
    my $sql2 = <<"END_SQL";
481
    my $sql2 = <<"END_SQL";
Lines 529-537 END_SQL Link Here
529
            next unless defined $mindays;
530
            next unless defined $mindays;
530
531
531
            if ( !$overdue_rules->{"letter$i"} ) {
532
            if ( !$overdue_rules->{"letter$i"} ) {
532
                $verbose and warn "No letter$i code for branch '$branchcode'";
533
                $verbose and warn sprintf "No letter code found for pass %s\n", $i;
533
                next PERIOD;
534
                next PERIOD;
534
            }
535
            }
536
            $verbose and warn sprintf "Using letter code '%s' for pass %s\n", $overdue_rules->{"letter$i"}, $i;
535
537
536
            # $letter->{'content'} is the text of the mail that is sent.
538
            # $letter->{'content'} is the text of the mail that is sent.
537
            # this text contains fields that are replaced by their value. Those fields must be written between brackets
539
            # this text contains fields that are replaced by their value. Those fields must be written between brackets
Lines 567-573 END_SQL Link Here
567
            my $sth = $dbh->prepare($borrower_sql);
569
            my $sth = $dbh->prepare($borrower_sql);
568
            $sth->execute(@borrower_parameters);
570
            $sth->execute(@borrower_parameters);
569
571
570
            $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ".  $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows";
572
            if ( $verbose > 1 ){
573
                warn sprintf "--------Borrower SQL------\n";
574
                warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ".  $date_to_run->datetime() .")\n";
575
                warn sprintf "--------------------------\n";
576
            }
577
            $verbose and warn sprintf "Found %s borrowers with overdues\n", $sth->rows;
571
            my $borrowernumber;
578
            my $borrowernumber;
572
            while ( my $data = $sth->fetchrow_hashref ) {
579
            while ( my $data = $sth->fetchrow_hashref ) {
573
580
Lines 607-614 END_SQL Link Here
607
                    $data->{'firstname'} && $data->{'surname'} ? ', ' : '',
614
                    $data->{'firstname'} && $data->{'surname'} ? ', ' : '',
608
                    $data->{'firstname'} || '',
615
                    $data->{'firstname'} || '',
609
                    $borrowernumber );
616
                    $borrowernumber );
610
                $verbose
617
                $verbose and warn "borrower $borr has items triggering level $i.\n";
611
                  and warn "borrower $borr has items triggering level $i.";
612
618
613
                my $patron = Koha::Patrons->find( $borrowernumber );
619
                my $patron = Koha::Patrons->find( $borrowernumber );
614
                @emails_to_use = ();
620
                @emails_to_use = ();
Lines 648-654 END_SQL Link Here
648
                    $verbose and warn "debarring $borr\n";
654
                    $verbose and warn "debarring $borr\n";
649
                }
655
                }
650
                my @params = ($borrowernumber,$branchcode);
656
                my @params = ($borrowernumber,$branchcode);
651
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber";
652
657
653
                $sth2->execute(@params);
658
                $sth2->execute(@params);
654
                my $itemcount = 0;
659
                my $itemcount = 0;
655
- 

Return to bug 28555