Browse Source

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.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Martin Renvoize 2 years ago
committed by Jonathan Druart
parent
commit
5c6312b873
  1. 35
      installer/data/mysql/atomicupdate/bug_28374.pl
  2. 23
      installer/data/mysql/en/mandatory/sample_notices.yml

35
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";
},
}

23
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\" %]"
- "<table>"
- "[% IF ( LibraryName ) %]"
@ -1129,24 +1132,24 @@ tables:
- "[% END %]"
- " <tr>"
- " <th colspan=\"2\" class=\"centerednames\">"
- " <h2>[% Branches.GetName( payment.branchcode ) | html %]</h2>"
- " <h2>[% Branches.GetName( credit.branchcode ) | html %]</h2>"
- " </th>"
- " </tr>"
- "<tr>"
- " <th colspan=\"2\" class=\"centerednames\">"
- " <h3>[% payment.date | $KohaDates %]</h3>"
- " <h3>[% credit.date | $KohaDates %]</h3>"
- "</tr>"
- "<tr>"
- " <td>Transaction ID: </td>"
- " <td>[% payment.accountlines_id %]</td>"
- " <td>[% credit.accountlines_id %]</td>"
- "</tr>"
- "<tr>"
- " <td>Operator ID: </td>"
- " <td>[% payment.manager_id %]</td>"
- " <td>[% credit.manager_id %]</td>"
- "</tr>"
- "<tr>"
- " <td>Payment type: </td>"
- " <td>[% payment.payment_type %]</td>"
- " <td>[% credit.payment_type %]</td>"
- "</tr>"
- " <tr></tr>"
- " <tr>"
@ -1160,17 +1163,17 @@ tables:
- " <th>Amount</th>"
- " </tr>"
- ""
- " [% FOREACH offset IN offsets %]"
- " [% FOREACH debit IN credit.debits %]"
- " <tr>"
- " <td>[% PROCESS account_type_description account=offset.debit %]</td>"
- " <td>[% offset.amount * -1 | $Price %]</td>"
- " <td>[% PROCESS account_type_description account=debit %]</td>"
- " <td>[% debit.amount * -1 | $Price %]</td>"
- " </tr>"
- " [% END %]"
- ""
- "<tfoot>"
- " <tr class=\"highlight\">"
- " <td>Total: </td>"
- " <td>[% payment.amount * -1| $Price %]</td>"
- " <td>[% credit.amount * -1| $Price %]</td>"
- " </tr>"
- " <tr>"
- " <td>Tendered: </td>"

Loading…
Cancel
Save