From d808c32b61bdac801c03dbbacd8983af67e607c4 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 5 Nov 2021 14:53:39 +0000 Subject: [PATCH] Bug 28374: Update existing notices This patch updates the default slip to include KohaDates, Branches and Price plugins as required and prepends the same to existing notices at upgrade time. We also, switch the HTML flag on. --- .../data/mysql/atomicupdate/bug_28374.pl | 35 +++++++++++++++++++ .../mysql/en/mandatory/sample_notices.yml | 23 ++++++------ 2 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_28374.pl diff --git a/installer/data/mysql/atomicupdate/bug_28374.pl b/installer/data/mysql/atomicupdate/bug_28374.pl new file mode 100644 index 0000000000..dc164f807f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_28374.pl @@ -0,0 +1,35 @@ +use Modern::Perl; + +return { + bug_number => "28374", + description => "Update point of sale print receipt", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + UPDATE letter SET content = CONCAT('[% USE KohaDates %][% USE Branches %][% USE Price %]', content), is_html = 1 WHERE code = 'RECEIPT'; + }); + say $out "Added KohaDates, Branches and Price plugins"; + + $dbh->do(q{ + UPDATE letter SET content = REPLACE(content, 'payment.', 'credit.') WHERE code = 'RECEIPT'; + }); + say $out "Replaced 'payment' with 'credit' param in RECEIPT template"; + + $dbh->do(q{ + UPDATE letter SET content = REPLACE(content, 'offsets', 'credit.debits') WHERE code = 'RECEIPT'; + }); + say $out "Replaced 'offsets' with 'credit.debits' param in RECEIPT template"; + + $dbh->do(q{ + UPDATE letter SET content = REPLACE(content, 'offset', 'debit') WHERE code = 'RECEIPT'; + }); + say $out "Replaced 'offset' with 'debit' param in RECEIPT template"; + + $dbh->do(q{ + UPDATE letter SET content = REPLACE(content, 'debit.debit', 'debit') WHERE code = 'RECEIPT'; + }); + say $out "Replaced 'debit.debit' with 'debit' param in RECEIPT template"; + }, +} diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index e95df89a87..ed95bfb4fb 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1113,11 +1113,14 @@ tables: code: RECEIPT branchcode: "" name: "Point of sale receipt" - is_html: 0 + is_html: 1 title: "Receipt" message_transport_type: print lang: default content: + - "[% USE KohaDates %]" + - "[% USE Branches %]" + - "[% USE Price %]" - "[% PROCESS \"accounts.inc\" %]" - "" - "[% IF ( LibraryName ) %]" @@ -1129,24 +1132,24 @@ tables: - "[% END %]" - " " - " " - " " - "" - " " - "" - " " - - " " + - " " - "" - "" - " " - - " " + - " " - "" - "" - " " - - " " + - " " - "" - " " - " " @@ -1160,17 +1163,17 @@ tables: - " " - " " - "" - - " [% FOREACH offset IN offsets %]" + - " [% FOREACH debit IN credit.debits %]" - " " - - " " - - " " + - " " + - " " - " " - " [% END %]" - "" - "" - " " - " " - - " " + - " " - " " - " " - " " -- 2.20.1
" - - "

[% Branches.GetName( payment.branchcode ) | html %]

" + - "

[% Branches.GetName( credit.branchcode ) | html %]

" - "
" - - "

[% payment.date | $KohaDates %]

" + - "

[% credit.date | $KohaDates %]

" - "
Transaction ID: [% payment.accountlines_id %][% credit.accountlines_id %]
Operator ID: [% payment.manager_id %][% credit.manager_id %]
Payment type: [% payment.payment_type %][% credit.payment_type %]
Amount
[% PROCESS account_type_description account=offset.debit %][% offset.amount * -1 | $Price %][% PROCESS account_type_description account=debit %][% debit.amount * -1 | $Price %]
Total: [% payment.amount * -1| $Price %][% credit.amount * -1| $Price %]
Tendered: