Lines 466-471
foreach my $branchcode (@branches) {
Link Here
|
466 |
|| $library->inbound_email_address; |
466 |
|| $library->inbound_email_address; |
467 |
my @output_chunks; # may be sent to mail or stdout or csv file. |
467 |
my @output_chunks; # may be sent to mail or stdout or csv file. |
468 |
|
468 |
|
|
|
469 |
$verbose and print "======================================\n"; |
469 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address; |
470 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $branch_email_address; |
470 |
|
471 |
|
471 |
my $sql2 = <<"END_SQL"; |
472 |
my $sql2 = <<"END_SQL"; |
Lines 520-528
END_SQL
Link Here
|
520 |
next unless defined $mindays; |
521 |
next unless defined $mindays; |
521 |
|
522 |
|
522 |
if ( !$overdue_rules->{"letter$i"} ) { |
523 |
if ( !$overdue_rules->{"letter$i"} ) { |
523 |
$verbose and warn "No letter$i code for branch '$branchcode'"; |
524 |
$verbose and warn sprintf "No letter code found for pass %s\n", $i; |
524 |
next PERIOD; |
525 |
next PERIOD; |
525 |
} |
526 |
} |
|
|
527 |
$verbose and warn sprintf "Using letter code '%s' for pass %s\n", $overdue_rules->{"letter$i"}, $i; |
526 |
|
528 |
|
527 |
# $letter->{'content'} is the text of the mail that is sent. |
529 |
# $letter->{'content'} is the text of the mail that is sent. |
528 |
# this text contains fields that are replaced by their value. Those fields must be written between brackets |
530 |
# this text contains fields that are replaced by their value. Those fields must be written between brackets |
Lines 558-564
END_SQL
Link Here
|
558 |
my $sth = $dbh->prepare($borrower_sql); |
560 |
my $sth = $dbh->prepare($borrower_sql); |
559 |
$sth->execute(@borrower_parameters); |
561 |
$sth->execute(@borrower_parameters); |
560 |
|
562 |
|
561 |
$verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows"; |
563 |
if ( $verbose > 1 ){ |
|
|
564 |
warn sprintf "--------Borrower SQL------\n"; |
565 |
warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\n"; |
566 |
warn sprintf "--------------------------\n"; |
567 |
} |
568 |
$verbose and warn sprintf "Found %s borrowers with overdues\n", $sth->rows; |
562 |
my $borrowernumber; |
569 |
my $borrowernumber; |
563 |
while ( my $data = $sth->fetchrow_hashref ) { |
570 |
while ( my $data = $sth->fetchrow_hashref ) { |
564 |
|
571 |
|
Lines 598-605
END_SQL
Link Here
|
598 |
$data->{'firstname'} && $data->{'surname'} ? ', ' : '', |
605 |
$data->{'firstname'} && $data->{'surname'} ? ', ' : '', |
599 |
$data->{'firstname'} || '', |
606 |
$data->{'firstname'} || '', |
600 |
$borrowernumber ); |
607 |
$borrowernumber ); |
601 |
$verbose |
608 |
$verbose and warn "borrower $borr has items triggering level $i.\n"; |
602 |
and warn "borrower $borr has items triggering level $i."; |
|
|
603 |
|
609 |
|
604 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
610 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
605 |
@emails_to_use = (); |
611 |
@emails_to_use = (); |
Lines 645-651
END_SQL
Link Here
|
645 |
$verbose and warn "debarring $borr\n"; |
651 |
$verbose and warn "debarring $borr\n"; |
646 |
} |
652 |
} |
647 |
my @params = ($borrowernumber,$branchcode); |
653 |
my @params = ($borrowernumber,$branchcode); |
648 |
$verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber"; |
|
|
649 |
|
654 |
|
650 |
$sth2->execute(@params); |
655 |
$sth2->execute(@params); |
651 |
my $itemcount = 0; |
656 |
my $itemcount = 0; |
652 |
- |
|
|