diff --git a/C4/Letters.pm b/C4/Letters.pm
index 1db4037177..52a407bcb1 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -338,7 +338,7 @@ sub SendAlerts {
);
if ( $letter->{is_html} ) {
- $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
+ $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) );
} else {
$mail->text_body( $letter->{content} );
}
@@ -510,7 +510,7 @@ sub SendAlerts {
);
if ( $letter->{is_html} ) {
- $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title} ) );
+ $mail->html_body( _wrap_html( $letter->{content}, "" . $letter->{title}, 'email' ) );
} else {
$mail->text_body( "" . $letter->{content} );
}
@@ -1335,7 +1335,7 @@ sub _add_attachments {
my $message = Koha::Email->new;
if ( $letter->{is_html} ) {
- $message->html_body( _wrap_html( $letter->{content}, $letter->{title} ) );
+ $message->html_body( _wrap_html( $letter->{content}, $letter->{title}, 'email' ) );
} else {
$message->text_body( $letter->{content} );
}
@@ -1564,7 +1564,7 @@ sub _send_message_by_email {
} else {
$email = Koha::Email->create($params);
if ($is_html) {
- $email->html_body( _wrap_html( $content, $subject ) );
+ $email->html_body( _wrap_html( $content, $subject, 'email' ) );
} else {
$email->text_body($content);
}
@@ -1646,10 +1646,26 @@ sub _send_message_by_email {
}
sub _wrap_html {
- my ( $content, $title ) = @_;
+ my ( $content, $title, $type ) = @_;
+ my $stylesheets = '';
- my $css = C4::Context->preference("NoticeCSS") || '';
- $css = qq{} if $css;
+ my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || '';
+ $stylesheets .= qq{} if $all_stylesheets;
+ my $all_style_pref = C4::Context->preference("AllNoticeCSS");
+ $stylesheets .= qq{} if $all_style_pref;
+ if ( $type eq 'email' ) {
+ my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || '';
+ $stylesheets .= qq{} if $email_stylesheet;
+ my $email_style_pref = C4::Context->preference("EmailNoticeCSS");
+ $stylesheets .= qq{} if $email_style_pref;
+ }
+ if ( $type eq 'print' ) {
+ my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || '';
+ $stylesheets .= qq{} if $print_stylesheet;
+ my $print_style_pref = C4::Context->preference("PrintNoticeCSS");
+ $stylesheets .= qq{} if $print_style_pref;
+ }
+ $stylesheets =~ s/\n+\z//;
return <
@@ -1657,7 +1673,7 @@ sub _wrap_html {
$title
-$css
+$stylesheets
$content
diff --git a/Koha/Notice/Message.pm b/Koha/Notice/Message.pm
index e5753ad350..28823bbc67 100644
--- a/Koha/Notice/Message.pm
+++ b/Koha/Notice/Message.pm
@@ -58,15 +58,12 @@ with HTML headers and CSS includes for HTML formatted notices.
sub html_content {
my ($self) = @_;
- my $title = $self->subject;
- my $content = $self->content;
+ my $title = $self->subject;
+ my $content = $self->content;
+ my $stylesheets = $self->stylesheets;
my $wrapped;
if ( $self->is_html ) {
-
- my $css = C4::Context->preference("NoticeCSS") || '';
- $css = qq{} if $css;
-
$wrapped = <
@@ -74,7 +71,7 @@ sub html_content {
$title
- $css
+ $stylesheets
$content
@@ -124,6 +121,39 @@ sub restrict_patron_when_notice_fails {
return $self;
}
+=head3 stylesheets
+
+ my $stylesheets = $message->stylesheets;
+
+Returns a string of all the stylesheet links for the message
+
+=cut
+
+sub stylesheets {
+ my ($self) = @_;
+ my $stylesheets = '';
+
+ my $all_stylesheets = C4::Context->preference("AllNoticeStylesheet") || '';
+ $stylesheets .= qq{\n} if $all_stylesheets;
+ my $all_style_pref = C4::Context->preference("AllNoticeCSS");
+ $stylesheets .= qq{} if $all_style_pref;
+ if ( $self->message_transport_type eq 'email' ) {
+ my $email_stylesheet = C4::Context->preference("EmailNoticeStylesheet") || '';
+ $stylesheets .= qq{\n} if $email_stylesheet;
+ my $email_style_pref = C4::Context->preference("EmailNoticeCSS");
+ $stylesheets .= qq{} if $email_style_pref;
+ }
+ if ( $self->message_transport_type eq 'print' ) {
+ my $print_stylesheet = C4::Context->preference("PrintNoticeStylesheet") || '';
+ $stylesheets .= qq{\n} if $print_stylesheet;
+ my $print_style_pref = C4::Context->preference("PrintNoticeCSS");
+ $stylesheets .= qq{\n} if $print_style_pref;
+ }
+ $stylesheets =~ s/\n+\z//;
+
+ return $stylesheets;
+}
+
=head3 type
=cut
diff --git a/circ/transfer-slip.pl b/circ/transfer-slip.pl
index b76d7b273d..e2f780c208 100755
--- a/circ/transfer-slip.pl
+++ b/circ/transfer-slip.pl
@@ -53,12 +53,11 @@ if ( my $letter = TransferSlip( $session->param('branch') || $userenv->{branch},
$slip = "Item not found";
}
$template->param(
- slip => $slip,
- plain => !$is_html,
- caller => 'cud-transfer',
- stylesheet => C4::Context->preference("SlipCSS"),
- style => $style,
- id => 'transfer_slip',
+ slip => $slip,
+ plain => !$is_html,
+ caller => 'cud-transfer',
+ style => $style,
+ id => 'transfer_slip',
);
output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt
index 2e227d447a..ecafecee31 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt
@@ -32,8 +32,8 @@
[% Asset.css("css/print.css") | $raw %]
-[% IF ( Koha.Preference('SlipCSS') ) %]
-
+[% IF ( Koha.Preference('PrintSlipStylesheet') ) %]
+
[% END %]
[% FOR slip IN slips %]
[% IF slip.style %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt
index edf0615bb5..ce7b46cd08 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt
@@ -15,11 +15,8 @@
-[% Asset.css("css/print.css") | $raw %]
-[% IF ( Koha.Preference('SlipCSS') ) %]
-
-[% END %]
+[% Asset.css("css/print.css") | $raw %]
[% IF style %][% END %]
diff --git a/members/printslip.pl b/members/printslip.pl
index 02fcf5dafe..a5748063fa 100755
--- a/members/printslip.pl
+++ b/members/printslip.pl
@@ -117,10 +117,11 @@ $template->param(
plain => !$is_html,
borrowernumber => $borrowernumber,
caller => 'members',
- stylesheet => C4::Context->preference("SlipCSS"),
error => $error,
style => $letter->{style},
id => $print,
+ stylesheet => C4::Context->preference("PrintSlipStylesheet"),
+ error => $error,
);
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
diff --git a/opac/sco/printslip.pl b/opac/sco/printslip.pl
index 2ed6f7a34d..65d32e65f5 100755
--- a/opac/sco/printslip.pl
+++ b/opac/sco/printslip.pl
@@ -82,7 +82,7 @@ if ( my $letter =
$template->{VARS}->{slip} = $slip;
$template->{VARS}->{plain} = !$is_html;
$template->{VARS}->{borrowernumber} = $patron->borrowernumber;
-$template->{VARS}->{stylesheet} = C4::Context->preference("SlipCSS");
+$template->{VARS}->{stylesheet} = C4::Context->preference("PrintSlipStylesheet");
$template->{VARS}->{error} = $error;
output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/preservation/print_slip.pl b/preservation/print_slip.pl
index bebc894414..3272fa8e49 100755
--- a/preservation/print_slip.pl
+++ b/preservation/print_slip.pl
@@ -64,7 +64,7 @@ for my $train_item_id (@train_item_ids) {
$template->param(
slips => \@slips,
caller => 'preservation',
- stylesheet => C4::Context->preference("SlipCSS"),
+ stylesheet => C4::Context->preference("PrintSlipStylesheet"),
);
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );