From d12cacda1a0a860c0df947c91686de941a5c1fb1 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 23 Oct 2025 21:10:30 +0000 Subject: [PATCH] Bug 41086: Add way to get allowed tags from C4/Scrubber --- C4/Scrubber.pm | 6 ++++++ .../intranet-tmpl/prog/en/modules/tools/letter.tt | 12 ++++++++++++ tools/letter.pl | 14 +++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/C4/Scrubber.pm b/C4/Scrubber.pm index 8086c43ad9d..8acc3a61639 100644 --- a/C4/Scrubber.pm +++ b/C4/Scrubber.pm @@ -142,6 +142,12 @@ sub new { return $scrubber; } +sub get_allowed_list { + my ( $self, $profile ) = @_; + my $rules = $scrubbertypes{$profile}; + return $rules->{allow}; +} + 1; __END__ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 6ec0ce10799..2f4e2b50895 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -519,6 +519,18 @@ Required + [% IF code == "VIRTUALCARD" && allowed_html %] +
  • + +
    +
    + [% FOREACH allowed IN allowed_html %] + [% allowed | html %] + [% END %] +
    +
    +
  • + [% END %] [% IF code and preview_is_available %]
  • diff --git a/tools/letter.pl b/tools/letter.pl index 631cfa2646d..84d9eb49b11 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -46,9 +46,10 @@ use Try::Tiny; use C4::Auth qw( get_template_and_user ); use C4::Context; -use C4::Output qw( output_html_with_http_headers ); -use C4::Letters qw( GetMessageTransportTypes ); -use C4::Log qw( logaction ); +use C4::Output qw( output_html_with_http_headers ); +use C4::Letters qw( GetMessageTransportTypes ); +use C4::Log qw( logaction ); +use C4::Scrubber qw( get_allowed_list ); use Koha::Notice::Templates; use Koha::Patron::Attribute::Types; @@ -304,6 +305,13 @@ sub add_form { $preview_is_available = grep { $_ eq $code } qw( CHECKIN CHECKOUT HOLD_SLIP ); } + if ( $code && $code eq 'VIRTUALCARD' ) { + my $allowed_html = C4::Scrubber->get_allowed_list('opac'); + $template->param( + allowed_html => $allowed_html, + ); + } + $template->param( module => $module, SQLfieldnames => $field_selection, -- 2.39.5