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