|
Lines 338-344
sub SendAlerts {
Link Here
|
| 338 |
); |
338 |
); |
| 339 |
|
339 |
|
| 340 |
if ( $letter->{is_html} ) { |
340 |
if ( $letter->{is_html} ) { |
| 341 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); |
341 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) ); |
| 342 |
} else { |
342 |
} else { |
| 343 |
$mail->text_body( $letter->{content} ); |
343 |
$mail->text_body( $letter->{content} ); |
| 344 |
} |
344 |
} |
|
Lines 510-516
sub SendAlerts {
Link Here
|
| 510 |
); |
510 |
); |
| 511 |
|
511 |
|
| 512 |
if ( $letter->{is_html} ) { |
512 |
if ( $letter->{is_html} ) { |
| 513 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); |
513 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) ); |
| 514 |
} else { |
514 |
} else { |
| 515 |
$mail->text_body( "" . $letter->{content} ); |
515 |
$mail->text_body( "" . $letter->{content} ); |
| 516 |
} |
516 |
} |
|
Lines 1335-1341
sub _add_attachments {
Link Here
|
| 1335 |
my $message = Koha::Email->new; |
1335 |
my $message = Koha::Email->new; |
| 1336 |
|
1336 |
|
| 1337 |
if ( $letter->{is_html} ) { |
1337 |
if ( $letter->{is_html} ) { |
| 1338 |
$message->html_body( _wrap_html( $letter->{content}, $letter->{title} ) ); |
1338 |
$message->html_body( _wrap_html( $letter->{content}, $letter->{title}, 'email' ) ); |
| 1339 |
} else { |
1339 |
} else { |
| 1340 |
$message->text_body( $letter->{content} ); |
1340 |
$message->text_body( $letter->{content} ); |
| 1341 |
} |
1341 |
} |
|
Lines 1564-1570
sub _send_message_by_email {
Link Here
|
| 1564 |
} else { |
1564 |
} else { |
| 1565 |
$email = Koha::Email->create($params); |
1565 |
$email = Koha::Email->create($params); |
| 1566 |
if ($is_html) { |
1566 |
if ($is_html) { |
| 1567 |
$email->html_body( _wrap_html( $content, $subject ) ); |
1567 |
$email->html_body( _wrap_html( $content, $subject, 'email' ) ); |
| 1568 |
} else { |
1568 |
} else { |
| 1569 |
$email->text_body($content); |
1569 |
$email->text_body($content); |
| 1570 |
} |
1570 |
} |
|
Lines 1646-1655
sub _send_message_by_email {
Link Here
|
| 1646 |
} |
1646 |
} |
| 1647 |
|
1647 |
|
| 1648 |
sub _wrap_html { |
1648 |
sub _wrap_html { |
| 1649 |
my ( $content, $title ) = @_; |
1649 |
my ( $content, $title, $type ) = @_; |
| 1650 |
|
1650 |
my $stylesheets = ''; |
| 1651 |
my $css = C4::Context->preference("NoticeCSS") || ''; |
1651 |
|
| 1652 |
$css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css; |
1652 |
my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || ''; |
|
|
1653 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$all_stylesheets">} if $all_stylesheets; |
| 1654 |
my $all_style_pref = C4::Context->preference("AllNoticeCSS"); |
| 1655 |
$stylesheets .= qq{<style type="text/css">$all_style_pref</style>} if $all_style_pref; |
| 1656 |
if ( $type eq 'email' ) { |
| 1657 |
my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || ''; |
| 1658 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$email_stylesheet">} if $email_stylesheet; |
| 1659 |
my $email_style_pref = C4::Context->preference("EmailNoticeCSS"); |
| 1660 |
$stylesheets .= qq{<style type="text/css">$email_style_pref</style>} if $email_style_pref; |
| 1661 |
} |
| 1662 |
if ( $type eq 'print' ) { |
| 1663 |
my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || ''; |
| 1664 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$print_stylesheet">} if $print_stylesheet; |
| 1665 |
my $print_style_pref = C4::Context->preference("PrintNoticeCSS"); |
| 1666 |
$stylesheets .= qq{<style type="text/css">$print_style_pref</style>} if $print_style_pref; |
| 1667 |
} |
| 1668 |
$stylesheets =~ s/\n+\z//; |
| 1653 |
return <<EOS; |
1669 |
return <<EOS; |
| 1654 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
1670 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 1655 |
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
1671 |
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
Lines 1657-1663
sub _wrap_html {
Link Here
|
| 1657 |
<head> |
1673 |
<head> |
| 1658 |
<title>$title</title> |
1674 |
<title>$title</title> |
| 1659 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1675 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 1660 |
$css |
1676 |
$stylesheets |
| 1661 |
</head> |
1677 |
</head> |
| 1662 |
<body> |
1678 |
<body> |
| 1663 |
$content |
1679 |
$content |