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