From ed7c1b34533149b081d8b0e5bd320b40623bb136 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 28 Jan 2020 14:05:35 +0000 Subject: [PATCH] Bug 24525: (follow-up) Factor out to an include Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- .../prog/en/includes/payments.inc | 19 +++++++++ .../prog/en/modules/members/paycollect.tt | 39 +++---------------- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 16 +------- 3 files changed, 27 insertions(+), 47 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc new file mode 100644 index 0000000000..e6b5d597d5 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc @@ -0,0 +1,19 @@ +[% USE AuthorisedValues %] +[%- BLOCK account_payment_types -%] + [% SET payment_types = [] %] + [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] + [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %] + [% payment_types.push(pt) %] + [% END %] + [% IF payment_types.size > 0 %] +
  • + + +
  • + [% END %] +[%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index ae2f53d486..d6ad995226 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -2,9 +2,9 @@ [% USE Asset %] [% USE Koha %] [% USE Branches %] -[% USE AuthorisedValues %] [% USE Price %] [% SET footerjs = 1 %] +[% PROCESS 'payments.inc' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF type == 'WRITEOFF' %] @@ -123,22 +123,9 @@ <label>Change to give: </label> <span id="change">0.00</span> </li> - [% SET payment_types = [] %] - [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] - [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %] - [% payment_types.push(pt) %] - [% END %] - [% IF payment_types.size > 0 %] - <li> - <label for="payment_type">Payment type: </label> - <select name="payment_type" id="payment_type"> - <option value=""></option> - [% FOREACH pt IN payment_types %] - <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option> - [% END %] - </select> - </li> - [% END %] + + [% PROCESS account_payment_types %] + [% IF Koha.Preference('UseCashRegisters') %] <li> <label for="cash_register">Cash register: </label> @@ -257,22 +244,8 @@ <label>Change to give: </label> <span id="change">0.00</span> </li> - [% SET payment_types = [] %] - [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] - [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %] - [% payment_types.push(pt) %] - [% END %] - [% IF payment_types.size > 0 %] - <li> - <label for="payment_type">Payment type: </label> - <select name="payment_type" id="payment_type"> - <option value=""></option> - [% FOREACH pt IN payment_types %] - <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option> - [% END %] - </select> - </li> - [% END %] + + [% PROCESS account_payment_types %] [% IF Koha.Preference('UseCashRegisters') %] <li> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index b933fbcd6f..f3c781034f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -1,9 +1,9 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] -[% USE AuthorisedValues %] [% USE Price %] [% SET footerjs = 1 %] +[% PROCESS 'payments.inc' %] [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Payments [% INCLUDE 'doc-head-close.inc' %] @@ -112,19 +112,7 @@ - [% SET payment_types = [] %] - [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] - [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %] - [% payment_types.push(pt) %] - [% END %] -
  • - - -
  • + [% PROCESS account_payment_types %] [% IF Koha.Preference('UseCashRegisters') %]
  • -- 2.39.5