From 5fc7fbbb214b26729421fbfb9b964251aee050be Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 23 Feb 2026 17:51:49 +0000 Subject: [PATCH] Bug 40255: Allow scrubbed HTML to be used Signed-off-by: Andrew Fuerste Henry Signed-off-by: Lucas Gass --- Koha/Account/Line.pm | 4 +- .../prog/en/modules/members/boraccount.tt | 319 +++++++++--------- 2 files changed, 164 insertions(+), 159 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index dfb6571f0f..82570f1c40 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -30,6 +30,7 @@ use Koha::Exceptions::Account; use Koha::Patron::Debarments; use Koha::Notice::Templates; use C4::Letters; +use C4::Scrubber; use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields); @@ -1151,7 +1152,8 @@ sub store { ); if ( $letter && $letter->{content} ) { - $self->description( $letter->{content} ); + my $scrubber = C4::Scrubber->new('note'); + $self->description( $scrubber->scrub( $letter->{content} ) ); } } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index d4ece58505..98666a6415 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -101,167 +101,170 @@ Actions - - - [% FOREACH account IN accounts %] - - [% account.date | $KohaDates %] - [% account.timestamp | $KohaDates with_hours = 1 %] - [% account.credit_number | html %] - [% PROCESS account_type_description account=account %] - - [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %] - [%- IF account.description %][% account.description | html %][% END %] -  [% IF ( account.itemnumber ) %] - [% account.item.biblio.title | html %] - [% END %] - [% IF ( account.itemnumber ) %] - [% account.item.barcode | html %] - [% END %] - [% IF ( account.itemnumber ) %][% account.item.itemcallnumber | html %][% END %] - [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %] - [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %] - [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.issuedate | $KohaDates %][% END %] - - [% IF ( account.issue_id ) || (account.old_issue_id) && account.checkout.library %] - [% account.checkout.library.branchname | html %] - [% END %] - - [% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %] - - [% account.note | html_line_break %] - [% IF CAN_user_updatecharges_edit_accountline_notes %] - - [% END %] - - [% IF account.amount <= 0 %] - [% SET td_class="credit" %] - [% ELSE %] - [% SET td_class="debig" %] + + + [% FOREACH account IN accounts %] + + [% account.date | $KohaDates %] + [% account.timestamp | $KohaDates with_hours = 1 %] + [% account.credit_number | html %] + [% PROCESS account_type_description account=account %] + + [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %] + [%- IF account.description %] + [% # Passing the raw filter here because this content is scrubbed %] + [% account.description | $raw %] [% END %] - [% account.amount | $Price %] - [% account.amountoutstanding | $Price %] - - [% IF ( account.is_credit ) %] - [% IF patron.notice_email_address %] -
- - -
- [% ELSE %] - Print - [% END %] + [% IF ( account.itemnumber ) %] + +   + [% account.item.biblio.title | html %] + + [% END %] + [% IF ( account.itemnumber ) %] + [% account.item.barcode | html %] + [% END %] + [% IF ( account.itemnumber ) %][% account.item.itemcallnumber | html %][% END %] + [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %] + [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %] + [% IF ( account.issue_id ) || (account.old_issue_id) %][% account.checkout.issuedate | $KohaDates %][% END %] + + [% IF ( account.issue_id ) || (account.old_issue_id) && account.checkout.library %] + [% account.checkout.library.branchname | html %] + [% END %] + + [% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %] + + [% account.note | html_line_break %] + [% IF CAN_user_updatecharges_edit_accountline_notes %] + + [% END %] + + [% IF account.amount <= 0 %] + [% SET td_class="credit" %] + [% ELSE %] + [% SET td_class="debig" %] + [% END %] + [% account.amount | $Price %] + [% account.amountoutstanding | $Price %] + + [% IF ( account.is_credit ) %] + [% IF patron.notice_email_address %] +
+ + +
[% ELSE %] - Print + Print [% END %] - Details - [% IF account.is_debit && account.amountoutstanding > 0 %] -
- - - - - - - - - -
- [% END %] - [% IF account.is_credit && account.status != 'VOID' %] - - [% END %] - [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %] - - [% END %] - [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %] - - [% END %] - [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %] - - [% END %] - [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %] - - [% END %] - - - [% END %] - + [% ELSE %] + Print + [% END %] + Details + [% IF account.is_debit && account.amountoutstanding > 0 %] +
+ + + + + + + + + +
+ [% END %] + [% IF account.is_credit && account.status != 'VOID' %] + + [% END %] + [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %] + + [% END %] + [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %] + + [% END %] + [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %] + + [% END %] + [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %] + + [% END %] + + + [% END %] Total due