Lines 339-346
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
Link Here
|
339 |
warn qq(using "$csvfilename" as filename, that seems odd); |
339 |
warn qq(using "$csvfilename" as filename, that seems odd); |
340 |
} |
340 |
} |
341 |
|
341 |
|
342 |
my @overduebranches = C4::Overdues::GetBranchcodesWithOverdueRules(); # Branches with overdue rules |
342 |
my @overduebranches = C4::Overdues::GetBranchcodesWithOverdueRules(); # Branches with overdue rules |
343 |
my @branches; # Branches passed as parameter with overdue rules |
343 |
my @branches; # Branches passed as parameter with overdue rules |
344 |
my $branchcount = scalar(@overduebranches); |
344 |
my $branchcount = scalar(@overduebranches); |
345 |
|
345 |
|
346 |
my $overduebranch_word = scalar @overduebranches > 1 ? 'branches' : 'branch'; |
346 |
my $overduebranch_word = scalar @overduebranches > 1 ? 'branches' : 'branch'; |
Lines 364-371
if (@branchcodes) {
Link Here
|
364 |
|
364 |
|
365 |
if (@branches) { |
365 |
if (@branches) { |
366 |
|
366 |
|
367 |
my $branch_word = scalar @branches > 1 ? 'branches' : 'branch'; |
367 |
my $branch_word = scalar @branches > 1 ? 'branches' : 'branch'; |
368 |
$verbose and warn "$branch_word @branches have overdue rules\n"; |
368 |
$verbose and warn "$branch_word @branches have overdue rules\n"; |
369 |
|
369 |
|
370 |
} else { |
370 |
} else { |
371 |
|
371 |
|
Lines 527-533
END_SQL
Link Here
|
527 |
# $letter->{'content'} is the text of the mail that is sent. |
527 |
# $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 |
528 |
# this text contains fields that are replaced by their value. Those fields must be written between brackets |
529 |
# The following fields are available : |
529 |
# The following fields are available : |
530 |
# itemcount is interpreted here as the number of items in the overdue range defined by the current notice or all overdues < max if(-list-all). |
530 |
# itemcount is interpreted here as the number of items in the overdue range defined by the current notice or all overdues < max if(-list-all). |
531 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
531 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
532 |
|
532 |
|
533 |
my $borrower_sql = <<"END_SQL"; |
533 |
my $borrower_sql = <<"END_SQL"; |
Lines 541-551
AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0
Link Here
|
541 |
END_SQL |
541 |
END_SQL |
542 |
my @borrower_parameters; |
542 |
my @borrower_parameters; |
543 |
if ($branchcode) { |
543 |
if ($branchcode) { |
544 |
if($owning_library) { |
544 |
if($owning_library) { |
545 |
$borrower_sql .= ' AND items.homebranch=? '; |
545 |
$borrower_sql .= ' AND items.homebranch=? '; |
546 |
} else { |
546 |
} else { |
547 |
$borrower_sql .= ' AND issues.branchcode=? '; |
547 |
$borrower_sql .= ' AND issues.branchcode=? '; |
548 |
} |
548 |
} |
549 |
push @borrower_parameters, $branchcode; |
549 |
push @borrower_parameters, $branchcode; |
550 |
} |
550 |
} |
551 |
if ( $overdue_rules->{categorycode} ) { |
551 |
if ( $overdue_rules->{categorycode} ) { |
Lines 555-561
END_SQL
Link Here
|
555 |
$borrower_sql .= ' AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber'; |
555 |
$borrower_sql .= ' AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber'; |
556 |
|
556 |
|
557 |
# $sth gets borrower info iff at least one overdue item has triggered the overdue action. |
557 |
# $sth gets borrower info iff at least one overdue item has triggered the overdue action. |
558 |
my $sth = $dbh->prepare($borrower_sql); |
558 |
my $sth = $dbh->prepare($borrower_sql); |
559 |
$sth->execute(@borrower_parameters); |
559 |
$sth->execute(@borrower_parameters); |
560 |
|
560 |
|
561 |
$verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows"; |
561 |
$verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays, ". $date_to_run->datetime() .")\nreturns " . $sth->rows . " rows"; |
562 |
- |
|
|