Lines 388-406
UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
Link Here
|
388 |
|
388 |
|
389 |
# Now, run through all the people that want digests and send them |
389 |
# Now, run through all the people that want digests and send them |
390 |
|
390 |
|
391 |
my $sth_digest = $dbh->prepare(<<'END_SQL'); |
391 |
my $digest_query = 'SELECT biblio.*, items.*, issues.* |
392 |
SELECT biblio.*, items.*, issues.* |
|
|
393 |
FROM issues,items,biblio |
392 |
FROM issues,items,biblio |
394 |
WHERE items.itemnumber=issues.itemnumber |
393 |
WHERE items.itemnumber=issues.itemnumber |
395 |
AND biblio.biblionumber=items.biblionumber |
394 |
AND biblio.biblionumber=items.biblionumber |
396 |
AND issues.borrowernumber = ? |
395 |
AND issues.borrowernumber = ? |
397 |
AND (TO_DAYS(date_due)-TO_DAYS(NOW()) = ?) |
396 |
AND (TO_DAYS(date_due)-TO_DAYS(NOW()) = ?)'; |
398 |
END_SQL |
397 |
|
|
|
398 |
my $sth_digest = $dbh->prepare($digest_query); |
399 |
|
399 |
|
400 |
if ($digest_per_branch) { |
400 |
if ($digest_per_branch) { |
401 |
while (my ($branchcode, $digests) = each %$upcoming_digest) { |
401 |
while (my ($branchcode, $digests) = each %$upcoming_digest) { |
402 |
send_digests({ |
402 |
send_digests({ |
403 |
sth => $sth_digest, |
403 |
sth => $dbh->prepare( $digest_query . " AND issues.branchcode = '" . $branchcode . "'"), |
404 |
digests => $digests, |
404 |
digests => $digests, |
405 |
letter_code => 'PREDUEDGST', |
405 |
letter_code => 'PREDUEDGST', |
406 |
message_name => 'advance_notice', |
406 |
message_name => 'advance_notice', |
Lines 418-424
if ($digest_per_branch) {
Link Here
|
418 |
|
418 |
|
419 |
while (my ($branchcode, $digests) = each %$due_digest) { |
419 |
while (my ($branchcode, $digests) = each %$due_digest) { |
420 |
send_digests({ |
420 |
send_digests({ |
421 |
sth => $sth_digest, |
421 |
sth => $dbh->prepare( $digest_query . " AND issues.branchcode = '" . $branchcode . "'" ), |
422 |
digests => $digests, |
422 |
digests => $digests, |
423 |
letter_code => 'DUEDGST', |
423 |
letter_code => 'DUEDGST', |
424 |
branchcode => $branchcode, |
424 |
branchcode => $branchcode, |
425 |
- |
|
|