View | Details | Raw Unified | Return to bug 35267
Collapse All | Expand All

(-)a/C4/Letters.pm (-9 / +25 lines)
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 1324-1330 sub _add_attachments { Link Here
1324
    my $message = Koha::Email->new;
1324
    my $message = Koha::Email->new;
1325
1325
1326
    if ( $letter->{is_html} ) {
1326
    if ( $letter->{is_html} ) {
1327
        $message->html_body( _wrap_html( $letter->{content}, $letter->{title} ) );
1327
        $message->html_body( _wrap_html( $letter->{content}, $letter->{title}, 'email' ) );
1328
    } else {
1328
    } else {
1329
        $message->text_body( $letter->{content} );
1329
        $message->text_body( $letter->{content} );
1330
    }
1330
    }
Lines 1553-1559 sub _send_message_by_email { Link Here
1553
        } else {
1553
        } else {
1554
            $email = Koha::Email->create($params);
1554
            $email = Koha::Email->create($params);
1555
            if ($is_html) {
1555
            if ($is_html) {
1556
                $email->html_body( _wrap_html( $content, $subject ) );
1556
                $email->html_body( _wrap_html( $content, $subject, 'email' ) );
1557
            } else {
1557
            } else {
1558
                $email->text_body($content);
1558
                $email->text_body($content);
1559
            }
1559
            }
Lines 1635-1644 sub _send_message_by_email { Link Here
1635
}
1635
}
1636
1636
1637
sub _wrap_html {
1637
sub _wrap_html {
1638
    my ( $content, $title ) = @_;
1638
    my ( $content, $title, $type ) = @_;
1639
1639
    my $stylesheets = '';
1640
    my $css = C4::Context->preference("NoticeCSS") || '';
1640
1641
    $css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css;
1641
    my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || '';
1642
    $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$all_stylesheets">} if $all_stylesheets;
1643
    my $all_style_pref = C4::Context->preference("AllNoticeCSS");
1644
    $stylesheets .= qq{<style type="text/css">$all_style_pref</style>} if $all_style_pref;
1645
    if ( $type eq 'email' ) {
1646
        my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || '';
1647
        $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$email_stylesheet">} if $email_stylesheet;
1648
        my $email_style_pref = C4::Context->preference("EmailNoticeCSS");
1649
        $stylesheets .= qq{<style type="text/css">$email_style_pref</style>} if $email_style_pref;
1650
    }
1651
    if ( $type eq 'print' ) {
1652
        my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || '';
1653
        $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$print_stylesheet">} if $print_stylesheet;
1654
        my $print_style_pref = C4::Context->preference("PrintNoticeCSS");
1655
        $stylesheets .= qq{<style type="text/css">$print_style_pref</style>} if $print_style_pref;
1656
    }
1657
    $stylesheets =~ s/\n+\z//;
1642
    return <<EOS;
1658
    return <<EOS;
1643
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1659
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1644
    "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1660
    "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Lines 1646-1652 sub _wrap_html { Link Here
1646
<head>
1662
<head>
1647
<title>$title</title>
1663
<title>$title</title>
1648
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1664
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1649
$css
1665
$stylesheets
1650
</head>
1666
</head>
1651
<body>
1667
<body>
1652
$content
1668
$content
(-)a/Koha/Notice/Message.pm (-7 / +37 lines)
Lines 58-72 with HTML headers and CSS includes for HTML formatted notices. Link Here
58
sub html_content {
58
sub html_content {
59
    my ($self) = @_;
59
    my ($self) = @_;
60
60
61
    my $title   = $self->subject;
61
    my $title       = $self->subject;
62
    my $content = $self->content;
62
    my $content     = $self->content;
63
    my $stylesheets = $self->stylesheets;
63
64
64
    my $wrapped;
65
    my $wrapped;
65
    if ( $self->is_html ) {
66
    if ( $self->is_html ) {
66
67
        my $css = C4::Context->preference("NoticeCSS") || '';
68
        $css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css;
69
70
        $wrapped = <<EOS;
67
        $wrapped = <<EOS;
71
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
68
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
72
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
69
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Lines 74-80 sub html_content { Link Here
74
  <head>
71
  <head>
75
    <title>$title</title>
72
    <title>$title</title>
76
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
73
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
77
    $css
74
    $stylesheets
78
  </head>
75
  </head>
79
  <body>
76
  <body>
80
  $content
77
  $content
Lines 124-129 sub restrict_patron_when_notice_fails { Link Here
124
    return $self;
121
    return $self;
125
}
122
}
126
123
124
=head3 stylesheets
125
126
  my $stylesheets = $message->stylesheets;
127
128
Returns a string of all the stylesheet links for the message
129
130
=cut
131
132
sub stylesheets {
133
    my ($self) = @_;
134
    my $stylesheets = '';
135
136
    my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || '';
137
    $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$all_stylesheets">\n} if $all_stylesheets;
138
    my $all_style_pref = C4::Context->preference("AllNoticeCSS");
139
    $stylesheets .= qq{<style type="text/css">$all_style_pref</style>} if $all_style_pref;
140
    if ( $self->message_transport_type eq 'email' ) {
141
        my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || '';
142
        $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$email_stylesheet">\n} if $email_stylesheet;
143
        my $email_style_pref = C4::Context->preference("EmailNoticeCSS");
144
        $stylesheets .= qq{<style type="text/css">$email_style_pref</style>} if $email_style_pref;
145
    }
146
    if ( $self->message_transport_type eq 'print' ) {
147
        my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || '';
148
        $stylesheets .= qq{<link rel="stylesheet" type="text/css" href="$print_stylesheet">\n} if $print_stylesheet;
149
        my $print_style_pref = C4::Context->preference("PrintNoticeCSS");
150
        $stylesheets .= qq{<style type="text/css">$print_style_pref</style>\n} if $print_style_pref;
151
    }
152
    $stylesheets =~ s/\n+\z//;
153
154
    return $stylesheets;
155
}
156
127
=head3 type
157
=head3 type
128
158
129
=cut
159
=cut
(-)a/circ/transfer-slip.pl (-6 / +5 lines)
Lines 53-64 if ( my $letter = TransferSlip( $session->param('branch') || $userenv->{branch}, Link Here
53
    $slip = "Item not found";
53
    $slip = "Item not found";
54
}
54
}
55
$template->param(
55
$template->param(
56
    slip       => $slip,
56
    slip   => $slip,
57
    plain      => !$is_html,
57
    plain  => !$is_html,
58
    caller     => 'cud-transfer',
58
    caller => 'cud-transfer',
59
    stylesheet => C4::Context->preference("SlipCSS"),
59
    style  => $style,
60
    style      => $style,
60
    id     => 'transfer_slip',
61
    id         => 'transfer_slip',
62
);
61
);
63
62
64
output_html_with_http_headers $input, $cookie, $template->output;
63
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt (-2 / +2 lines)
Lines 32-39 Link Here
32
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
33
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
33
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
34
[% Asset.css("css/print.css") | $raw %]
34
[% Asset.css("css/print.css") | $raw %]
35
[% IF ( Koha.Preference('SlipCSS') ) %]
35
[% IF ( Koha.Preference('PrintSlipStylesheet') ) %]
36
    <link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
36
    <link rel="stylesheet" type="text/css" href="[% Koha.Preference('PrintSlipStylesheet') | $raw %]" />
37
[% END %]
37
[% END %]
38
[% FOR slip IN slips %]
38
[% FOR slip IN slips %]
39
    [% IF slip.style %]
39
    [% IF slip.style %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt (-5 / +1 lines)
Lines 15-25 Link Here
15
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
15
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
16
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
17
17
18
[% Asset.css("css/print.css") | $raw %]
18
[% Asset.css("css/print.css") | $raw %] <!-- prettier-ignore-start -->
19
[% IF ( Koha.Preference('SlipCSS') ) %]
20
    <link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
21
[% END %]
22
<!-- prettier-ignore-start -->
23
[% IF style %]<style>[% style | $raw %]</style>[% END %]
19
[% IF style %]<style>[% style | $raw %]</style>[% END %]
24
<!-- prettier-ignore-end -->
20
<!-- prettier-ignore-end -->
25
</head>
21
</head>
(-)a/members/printslip.pl (-1 / +2 lines)
Lines 117-126 $template->param( Link Here
117
    plain          => !$is_html,
117
    plain          => !$is_html,
118
    borrowernumber => $borrowernumber,
118
    borrowernumber => $borrowernumber,
119
    caller         => 'members',
119
    caller         => 'members',
120
    stylesheet     => C4::Context->preference("SlipCSS"),
121
    error          => $error,
120
    error          => $error,
122
    style          => $letter->{style},
121
    style          => $letter->{style},
123
    id             => $print,
122
    id             => $print,
123
    stylesheet     => C4::Context->preference("PrintSlipStylesheet"),
124
    error          => $error,
124
);
125
);
125
126
126
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
127
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
(-)a/opac/sco/printslip.pl (-1 / +1 lines)
Lines 82-88 if ( my $letter = Link Here
82
$template->{VARS}->{slip}           = $slip;
82
$template->{VARS}->{slip}           = $slip;
83
$template->{VARS}->{plain}          = !$is_html;
83
$template->{VARS}->{plain}          = !$is_html;
84
$template->{VARS}->{borrowernumber} = $patron->borrowernumber;
84
$template->{VARS}->{borrowernumber} = $patron->borrowernumber;
85
$template->{VARS}->{stylesheet}     = C4::Context->preference("SlipCSS");
85
$template->{VARS}->{stylesheet}     = C4::Context->preference("PrintSlipStylesheet");
86
$template->{VARS}->{error}          = $error;
86
$template->{VARS}->{error}          = $error;
87
87
88
output_html_with_http_headers $input, $cookie, $template->output;
88
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/preservation/print_slip.pl (-2 / +1 lines)
Lines 64-70 for my $train_item_id (@train_item_ids) { Link Here
64
$template->param(
64
$template->param(
65
    slips      => \@slips,
65
    slips      => \@slips,
66
    caller     => 'preservation',
66
    caller     => 'preservation',
67
    stylesheet => C4::Context->preference("SlipCSS"),
67
    stylesheet => C4::Context->preference("PrintSlipStylesheet"),
68
);
68
);
69
69
70
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
70
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
71
- 

Return to bug 35267