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