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