|
Lines 45-51
BEGIN {
Link Here
|
| 45 |
require Exporter; |
45 |
require Exporter; |
| 46 |
@ISA = qw(Exporter); |
46 |
@ISA = qw(Exporter); |
| 47 |
@EXPORT = qw( |
47 |
@EXPORT = qw( |
| 48 |
&GetLetters &GetLettersAvailableForALibrary &GetLetterTemplates &DelLetter &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages &GetMessageTransportTypes |
48 |
&GetLetters &GetLettersAvailableForALibrary &GetLetterTemplates &DelLetter &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &SendAlerts &GetPrintMessages &GetMessageTransportTypes |
| 49 |
); |
49 |
); |
| 50 |
} |
50 |
} |
| 51 |
|
51 |
|
|
Lines 333-369
sub getalert {
Link Here
|
| 333 |
return $sth->fetchall_arrayref({}); |
333 |
return $sth->fetchall_arrayref({}); |
| 334 |
} |
334 |
} |
| 335 |
|
335 |
|
| 336 |
=head2 findrelatedto($type, $externalid) |
|
|
| 337 |
|
| 338 |
parameters : |
| 339 |
- $type : the type of alert |
| 340 |
- $externalid : the id of the "object" to query |
| 341 |
|
| 342 |
In the table alert, a "id" is stored in the externalid field. This "id" is related to another table, depending on the type of the alert. |
| 343 |
When type=issue, the id is related to a subscriptionid and this sub returns the name of the biblio. |
| 344 |
|
| 345 |
=cut |
| 346 |
|
| 347 |
# outmoded POD: |
| 348 |
# When type=virtual, the id is related to a virtual shelf and this sub returns the name of the sub |
| 349 |
|
| 350 |
sub findrelatedto { |
| 351 |
my $type = shift or return; |
| 352 |
my $externalid = shift or return; |
| 353 |
my $q = ($type eq 'issue' ) ? |
| 354 |
"select title as result from subscription left join biblio on subscription.biblionumber=biblio.biblionumber where subscriptionid=?" : |
| 355 |
($type eq 'borrower') ? |
| 356 |
"select concat(firstname,' ',surname) from borrowers where borrowernumber=?" : undef; |
| 357 |
unless ($q) { |
| 358 |
warn "findrelatedto(): Illegal type '$type'"; |
| 359 |
return; |
| 360 |
} |
| 361 |
my $sth = C4::Context->dbh->prepare($q); |
| 362 |
$sth->execute($externalid); |
| 363 |
my ($result) = $sth->fetchrow; |
| 364 |
return $result; |
| 365 |
} |
| 366 |
|
| 367 |
=head2 SendAlerts |
336 |
=head2 SendAlerts |
| 368 |
|
337 |
|
| 369 |
my $err = &SendAlerts($type, $externalid, $letter_code); |
338 |
my $err = &SendAlerts($type, $externalid, $letter_code); |