|
Lines 389-406
sub SendAlerts {
Link Here
|
| 389 |
if ( $type eq 'issue' ) { |
389 |
if ( $type eq 'issue' ) { |
| 390 |
|
390 |
|
| 391 |
# prepare the letter... |
391 |
# prepare the letter... |
| 392 |
# search the biblionumber |
392 |
# search the subscriptionid |
| 393 |
my $sth = |
393 |
my $sth = |
| 394 |
$dbh->prepare( |
394 |
$dbh->prepare( |
| 395 |
"SELECT biblionumber FROM subscription WHERE subscriptionid=?"); |
395 |
"SELECT subscriptionid FROM serial WHERE serialid=?"); |
| 396 |
$sth->execute($externalid); |
396 |
$sth->execute($externalid); |
| 397 |
my ($biblionumber) = $sth->fetchrow |
397 |
my ($subscriptionid) = $sth->fetchrow |
| 398 |
or warn( "No subscription for '$externalid'" ), |
398 |
or warn( "No subscription for '$externalid'" ), |
| 399 |
return; |
399 |
return; |
| 400 |
|
400 |
|
|
|
401 |
# search the biblionumber |
| 402 |
$sth = |
| 403 |
$dbh->prepare( |
| 404 |
"SELECT biblionumber FROM subscription WHERE subscriptionid=?"); |
| 405 |
$sth->execute($subscriptionid); |
| 406 |
my ($biblionumber) = $sth->fetchrow |
| 407 |
or warn( "No biblionumber for '$subscriptionid'" ), |
| 408 |
return; |
| 409 |
|
| 401 |
my %letter; |
410 |
my %letter; |
| 402 |
# find the list of borrowers to alert |
411 |
# find the list of borrowers to alert |
| 403 |
my $alerts = getalert( '', 'issue', $externalid ); |
412 |
my $alerts = getalert( '', 'issue', $subscriptionid ); |
| 404 |
foreach (@$alerts) { |
413 |
foreach (@$alerts) { |
| 405 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
414 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
| 406 |
my $email = $borinfo->{email} or next; |
415 |
my $email = $borinfo->{email} or next; |
|
Lines 417-422
sub SendAlerts {
Link Here
|
| 417 |
'biblio' => $biblionumber, |
426 |
'biblio' => $biblionumber, |
| 418 |
'biblioitems' => $biblionumber, |
427 |
'biblioitems' => $biblionumber, |
| 419 |
'borrowers' => $borinfo, |
428 |
'borrowers' => $borinfo, |
|
|
429 |
'subscription' => $subscriptionid, |
| 430 |
'serial' => $externalid, |
| 420 |
}, |
431 |
}, |
| 421 |
want_librarian => 1, |
432 |
want_librarian => 1, |
| 422 |
) or return; |
433 |
) or return; |
|
Lines 758-763
sub _parseletter_sth {
Link Here
|
| 758 |
($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : |
769 |
($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : |
| 759 |
($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : |
770 |
($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : |
| 760 |
($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" : |
771 |
($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" : |
|
|
772 |
($table eq 'subscription') ? "SELECT * FROM $table WHERE subscriptionid = ?" : |
| 773 |
($table eq 'serial') ? "SELECT * FROM $table WHERE serialid = ?" : |
| 761 |
undef ; |
774 |
undef ; |
| 762 |
unless ($query) { |
775 |
unless ($query) { |
| 763 |
warn "ERROR: No _parseletter_sth query for table '$table'"; |
776 |
warn "ERROR: No _parseletter_sth query for table '$table'"; |