|
Lines 364-369
sub findrelatedto {
Link Here
|
| 364 |
return $result; |
364 |
return $result; |
| 365 |
} |
365 |
} |
| 366 |
|
366 |
|
|
|
367 |
=head2 SendSuggestionEmail |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
=cut |
| 372 |
|
| 373 |
sub SendSuggestionEmail { |
| 374 |
my ($type, $suggestion, $borrower_email_address, $code, ) = @_; |
| 375 |
my $library = Koha::Libraries->find( $_->{branchcode} ); |
| 376 |
my $userenv = C4::Context->userenv; |
| 377 |
my $letter = GetPreparedLetter ( |
| 378 |
module => 'suggestions', |
| 379 |
letter_code => $code, |
| 380 |
branchcode => $userenv->{branch}, |
| 381 |
tables => { |
| 382 |
'suggestions' => $suggestion->{suggestionid}, |
| 383 |
}, |
| 384 |
want_librarian => 1, |
| 385 |
) or return { error => "no_letter" }; |
| 386 |
|
| 387 |
my $mail = Koha:;Email->new(); |
| 388 |
my %mail = $email->create_message_headers ( |
| 389 |
{ |
| 390 |
to => $borrower_email_address, |
| 391 |
from => $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress'), |
| 392 |
replyto => $library->{branchreplyto}, |
| 393 |
sender => $library->{branchreturnpath}, |
| 394 |
Subject => Encode::encode( "UTF-8", "" . $letter->{title} ), |
| 395 |
Message => $letter->{'is_html'} |
| 396 |
? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ), |
| 397 |
Encode::encode( "UTF-8", "" . $letter->{'title'} )) |
| 398 |
: Encode::encode( "UTF-8", "" . $letter->{'content'} ), |
| 399 |
'Content-Type' => $letter->{'is_html'} |
| 400 |
? 'text/html; charset="utf-8"' |
| 401 |
: 'text/plain; charset="utf-8"', |
| 402 |
); |
| 403 |
unless ( sendmail(%mail) ) { |
| 404 |
carp $Mail::Sendmail::error; |
| 405 |
return { error => $Mail::Sendmail::error }; |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
|
| 367 |
=head2 SendAlerts |
410 |
=head2 SendAlerts |
| 368 |
|
411 |
|
| 369 |
my $err = &SendAlerts($type, $externalid, $letter_code); |
412 |
my $err = &SendAlerts($type, $externalid, $letter_code); |