From c78f499a2a333122ac8daa21058049767e2e4b42 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Mon, 19 Oct 2020 13:54:58 +0100
Subject: [PATCH] Bug 26734: Update sample notices to use standardised syntax

This patch updates the default notices shiped with Koha to use the new
syntax.

Test plan
1/ Install Koha afresh
2/ Check the notices print as expected
3/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 .../mysql/en/mandatory/sample_notices.yml     | 66 +++++++++----------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml
index e58c0075af..1f85e0b56e 100644
--- a/installer/data/mysql/en/mandatory/sample_notices.yml
+++ b/installer/data/mysql/en/mandatory/sample_notices.yml
@@ -47,11 +47,13 @@ tables:
           code: ACCOUNT_CREDIT
           branchcode: ""
           name: "Account payment"
-          is_html: 0
+          is_html: 1
           title: "Account payment"
           message_transport_type: print
           lang: default
           content:
+            - "[% USE Price %]"
+            - "[% PROCESS 'accounts.inc' %]"
             - "<table>"
             - "[% IF ( LibraryName ) %]"
             - " <tr>"
@@ -67,13 +69,13 @@ tables:
             - " </tr>"
             - " <tr>"
             - "    <th colspan=\"4\" class=\"centerednames\">"
-            - "        <h2>[% Branches.GetName( patron.branchcode ) | html %]</h2>"
+            - "        <h2>[% Branches.GetName( credit.patron.branchcode ) | html %]</h2>"
             - "    </th>"
             - " </tr>"
             - " <tr>"
             - "    <th colspan=\"4\">"
-            - "        Received with thanks from  [% patron.firstname | html %] [% patron.surname | html %] <br />"
-            - "        Card number: [% patron.cardnumber | html %]<br />"
+            - "        Received with thanks from  [% credit.patron.firstname | html %] [% credit.patron.surname | html %] <br />"
+            - "        Card number: [% credit.patron.cardnumber | html %]<br />"
             - "    </th>"
             - " </tr>"
             - "  <tr>"
@@ -83,22 +85,20 @@ tables:
             - "    <th>Amount</th>"
             - " </tr>"
             - ""
-            - "  [% FOREACH account IN accounts %]"
-            - "    <tr class=\"highlight\">"
-            - "      <td>[% account.date | $KohaDates %]</td>"
-            - "      <td>"
-            - "        [% PROCESS account_type_description account=account %]"
-            - "        [%- IF account.description %], [% account.description | html %][% END %]"
-            - "      </td>"
-            - "      <td>[% account.note | html %]</td>"
-            - "      [% IF ( account.amountcredit ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% account.amount | $Price %]</td>"
-            - "    </tr>"
+            - " <tr class=\"highlight\">"
+            - "    <td>[% credit.date | $KohaDates %]</td>"
+            - "    <td>"
+            - "      [% PROCESS account_type_description account=credit %]"
+            - "      [%- IF credit.description %], [% credit.description | html %][% END %]"
+            - "    </td>"
+            - "    <td>[% credit.note | html %]</td>"
+            - "    <td class=\"credit\">[% credit.amount | $Price %]</td>"
+            - " </tr>"
             - ""
-            - "  [% END %]"
             - "<tfoot>"
             - "  <tr>"
             - "    <td colspan=\"3\">Total outstanding dues as on date: </td>"
-            - "    [% IF ( totalcredit ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% total | $Price %]</td>"
+            - "    [% IF ( credit.patron.account.balance >= 0 ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% credit.patron.account.balance | $Price %]</td>"
             - "  </tr>"
             - "</tfoot>"
             - "</table>"
@@ -107,11 +107,13 @@ tables:
           code: ACCOUNT_DEBIT
           branchcode: ""
           name: "Account fee"
-          is_html: 0
+          is_html: 1
           title: "Account fee"
           message_transport_type: print
           lang: default
           content:
+            - "[% USE Price %]"
+            - "[% PROCESS 'accounts.inc' %]"
             - "<table>"
             - "  [% IF ( LibraryName ) %]"
             - "    <tr>"
@@ -128,13 +130,13 @@ tables:
             - "  </tr>"
             - "  <tr>"
             - "    <th colspan=\"5\" class=\"centerednames\">"
-            - "      <h2>[% Branches.GetName( patron.branchcode ) | html %]</h2>"
+            - "      <h2>[% Branches.GetName( debit.patron.branchcode ) | html %]</h2>"
             - "    </th>"
             - "  </tr>"
             - "  <tr>"
             - "    <th colspan=\"5\" >"
-            - "      Bill to: [% patron.firstname | html %] [% patron.surname | html %] <br />"
-            - "      Card number: [% patron.cardnumber | html %]<br />"
+            - "      Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %] <br />"
+            - "      Card number: [% debit.patron.cardnumber | html %]<br />"
             - "    </th>"
             - "  </tr>"
             - "  <tr>"
@@ -145,23 +147,21 @@ tables:
             - "    <th style=\"text-align:right;\">Amount outstanding</th>"
             - "  </tr>"
             - ""
-            - "  [% FOREACH account IN accounts %]"
-            - "    <tr class=\"highlight\">"
-            - "      <td>[% account.date | $KohaDates%]</td>"
-            - "      <td>"
-            - "        [% PROCESS account_type_description account=account %]"
-            - "        [%- IF account.description %], [% account.description | html %][% END %]"
-            - "      </td>"
-            - "      <td>[% account.note | html %]</td>"
-            - "      [% IF ( account.amountcredit ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% account.amount | $Price %]</td>"
-            - "      [% IF ( account.amountoutstandingcredit ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% account.amountoutstanding | $Price %]</td>"
-            - "    </tr>"
-            - "  [% END %]"
+            - "  <tr class=\"highlight\">"
+            - "    <td>[% debit.date | $KohaDates%]</td>"
+            - "    <td>"
+            - "      [% PROCESS account_type_description account=debit %]"
+            - "      [%- IF debit.description %], [% debit.description | html %][% END %]"
+            - "    </td>"
+            - "    <td>[% debit.note | html %]</td>"
+            - "    <td class=\"debit\">[% debit.amount | $Price %]</td>"
+            - "    <td class=\"debit\">[% debit.amountoutstanding | $Price %]</td>"
+            - "  </tr>"
             - ""
             - "  <tfoot>"
             - "    <tr>"
             - "      <td colspan=\"4\">Total outstanding dues as on date: </td>"
-            - "      [% IF ( totalcredit ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% total | $Price %]</td>"
+            - "      [% IF ( debit.patron.account.balance <= 0 ) %]<td class=\"credit\">[% ELSE %]<td class=\"debit\">[% END %][% debit.patron.account.balance | $Price %]</td>"
             - "    </tr>"
             - "  </tfoot>"
             - "</table>"
-- 
2.20.1