|
Lines 342-348
sub SendAlerts {
Link Here
|
| 342 |
); |
342 |
); |
| 343 |
|
343 |
|
| 344 |
if ( $letter->{is_html} ) { |
344 |
if ( $letter->{is_html} ) { |
| 345 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); |
345 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) ); |
| 346 |
} else { |
346 |
} else { |
| 347 |
$mail->text_body( $letter->{content} ); |
347 |
$mail->text_body( $letter->{content} ); |
| 348 |
} |
348 |
} |
|
Lines 514-520
sub SendAlerts {
Link Here
|
| 514 |
); |
514 |
); |
| 515 |
|
515 |
|
| 516 |
if ( $letter->{is_html} ) { |
516 |
if ( $letter->{is_html} ) { |
| 517 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) ); |
517 |
$mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) ); |
| 518 |
} else { |
518 |
} else { |
| 519 |
$mail->text_body( "" . $letter->{content} ); |
519 |
$mail->text_body( "" . $letter->{content} ); |
| 520 |
} |
520 |
} |
|
Lines 1348-1354
sub _add_attachments {
Link Here
|
| 1348 |
my $message = Koha::Email->new; |
1348 |
my $message = Koha::Email->new; |
| 1349 |
|
1349 |
|
| 1350 |
if ( $letter->{is_html} ) { |
1350 |
if ( $letter->{is_html} ) { |
| 1351 |
$message->html_body( _wrap_html( $letter->{content}, $letter->{title} ) ); |
1351 |
$message->html_body( _wrap_html( $letter->{content}, $letter->{title}, 'email' ) ); |
| 1352 |
} else { |
1352 |
} else { |
| 1353 |
$message->text_body( $letter->{content} ); |
1353 |
$message->text_body( $letter->{content} ); |
| 1354 |
} |
1354 |
} |
|
Lines 1577-1583
sub _send_message_by_email {
Link Here
|
| 1577 |
} else { |
1577 |
} else { |
| 1578 |
$email = Koha::Email->create($params); |
1578 |
$email = Koha::Email->create($params); |
| 1579 |
if ($is_html) { |
1579 |
if ($is_html) { |
| 1580 |
$email->html_body( _wrap_html( $content, $subject ) ); |
1580 |
$email->html_body( _wrap_html( $content, $subject, 'email' ) ); |
| 1581 |
} else { |
1581 |
} else { |
| 1582 |
$email->text_body($content); |
1582 |
$email->text_body($content); |
| 1583 |
} |
1583 |
} |
|
Lines 1659-1668
sub _send_message_by_email {
Link Here
|
| 1659 |
} |
1659 |
} |
| 1660 |
|
1660 |
|
| 1661 |
sub _wrap_html { |
1661 |
sub _wrap_html { |
| 1662 |
my ( $content, $title ) = @_; |
1662 |
my ( $content, $title, $type ) = @_; |
| 1663 |
|
1663 |
my $stylesheets = ''; |
| 1664 |
my $css = C4::Context->preference("NoticeCSS") || ''; |
1664 |
|
| 1665 |
$css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css; |
1665 |
my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || ''; |
|
|
1666 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$all_stylesheets">} if $all_stylesheets; |
| 1667 |
my $all_style_pref = C4::Context->preference("AllNoticeCSS"); |
| 1668 |
$stylesheets .= qq{<style type="text/css">$all_style_pref</style>} if $all_style_pref; |
| 1669 |
if ( $type eq 'email' ) { |
| 1670 |
my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || ''; |
| 1671 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$email_stylesheet">} if $email_stylesheet; |
| 1672 |
my $email_style_pref = C4::Context->preference("EmailNoticeCSS"); |
| 1673 |
$stylesheets .= qq{<style type="text/css">$email_style_pref</style>} if $email_style_pref; |
| 1674 |
} |
| 1675 |
if ( $type eq 'print' ) { |
| 1676 |
my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || ''; |
| 1677 |
$stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$print_stylesheet">} if $print_stylesheet; |
| 1678 |
my $print_style_pref = C4::Context->preference("PrintNoticeCSS"); |
| 1679 |
$stylesheets .= qq{<style type="text/css">$print_style_pref</style>} if $print_style_pref; |
| 1680 |
} |
| 1681 |
$stylesheets =~ s/\n+\z//; |
| 1666 |
return <<EOS; |
1682 |
return <<EOS; |
| 1667 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
1683 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 1668 |
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
1684 |
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
Lines 1670-1676
sub _wrap_html {
Link Here
|
| 1670 |
<head> |
1686 |
<head> |
| 1671 |
<title>$title</title> |
1687 |
<title>$title</title> |
| 1672 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
1688 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 1673 |
$css |
1689 |
$stylesheets |
| 1674 |
</head> |
1690 |
</head> |
| 1675 |
<body> |
1691 |
<body> |
| 1676 |
$content |
1692 |
$content |