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

(-)a/misc/cronjobs/overdue_notices.pl (-6 / +10 lines)
Lines 470-475 foreach my $branchcode (@branches) { Link Here
470
      || $library->inbound_email_address;
470
      || $library->inbound_email_address;
471
    my @output_chunks;    # may be sent to mail or stdout or csv file.
471
    my @output_chunks;    # may be sent to mail or stdout or csv file.
472
472
473
    $verbose and print "======================================\n";
473
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address;
474
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address;
474
475
475
    my $sql2 = <<"END_SQL";
476
    my $sql2 = <<"END_SQL";
Lines 524-532 END_SQL Link Here
524
            next unless defined $mindays;
525
            next unless defined $mindays;
525
526
526
            if ( !$overdue_rules->{"letter$i"} ) {
527
            if ( !$overdue_rules->{"letter$i"} ) {
527
                $verbose and warn "No letter$i code for branch '$branchcode'";
528
                $verbose and warn sprintf "No letter code found for pass %s\n", $i;
528
                next PERIOD;
529
                next PERIOD;
529
            }
530
            }
531
            $verbose and warn sprintf "Using letter code '%s' for pass %s\n", $overdue_rules->{"letter$i"}, $i;
530
532
531
            # $letter->{'content'} is the text of the mail that is sent.
533
            # $letter->{'content'} is the text of the mail that is sent.
532
            # this text contains fields that are replaced by their value. Those fields must be written between brackets
534
            # this text contains fields that are replaced by their value. Those fields must be written between brackets
Lines 562-568 END_SQL Link Here
562
            my $sth = $dbh->prepare($borrower_sql);
564
            my $sth = $dbh->prepare($borrower_sql);
563
            $sth->execute(@borrower_parameters);
565
            $sth->execute(@borrower_parameters);
564
566
565
            $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ".  $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows";
567
            if ( $verbose > 1 ){
568
                warn sprintf "--------Borrower SQL------\n";
569
                warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ".  $date_to_run->datetime() .")\n";
570
                warn sprintf "--------------------------\n";
571
            }
572
            $verbose and warn sprintf "Found %s borrowers with overdues\n", $sth->rows;
566
            my $borrowernumber;
573
            my $borrowernumber;
567
            while ( my $data = $sth->fetchrow_hashref ) {
574
            while ( my $data = $sth->fetchrow_hashref ) {
568
575
Lines 602-609 END_SQL Link Here
602
                    $data->{'firstname'} && $data->{'surname'} ? ', ' : '',
609
                    $data->{'firstname'} && $data->{'surname'} ? ', ' : '',
603
                    $data->{'firstname'} || '',
610
                    $data->{'firstname'} || '',
604
                    $borrowernumber );
611
                    $borrowernumber );
605
                $verbose
612
                $verbose and warn "borrower $borr has items triggering level $i.\n";
606
                  and warn "borrower $borr has items triggering level $i.";
607
613
608
                my $patron = Koha::Patrons->find( $borrowernumber );
614
                my $patron = Koha::Patrons->find( $borrowernumber );
609
                @emails_to_use = ();
615
                @emails_to_use = ();
Lines 649-655 END_SQL Link Here
649
                    $verbose and warn "debarring $borr\n";
655
                    $verbose and warn "debarring $borr\n";
650
                }
656
                }
651
                my @params = ($borrowernumber,$branchcode);
657
                my @params = ($borrowernumber,$branchcode);
652
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber";
653
658
654
                $sth2->execute(@params);
659
                $sth2->execute(@params);
655
                my $itemcount = 0;
660
                my $itemcount = 0;
656
- 

Return to bug 28555