@@ -, +, @@ modals. --- .../prog/en/includes/payments.inc | 29 ------------- .../prog/en/includes/transaction_types.inc | 33 +++++++++++++++ .../prog/en/modules/members/boraccount.tt | 42 ++++++------------- .../prog/en/modules/members/paycollect.tt | 5 +-- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 3 +- .../prog/en/modules/pos/register.tt | 36 +++++++--------- members/boraccount.pl | 10 ++--- pos/register.pl | 4 +- 8 files changed, 72 insertions(+), 90 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/transaction_types.inc --- a/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc @@ -1,29 +0,0 @@ -[% 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 %] -
  • - [% IF Koha.Preference('UseCashRegisters') %] - - - Required - [%- ELSE -%] - - - [%- END -%] -
  • - [% END %] -[%- END -%] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/transaction_types.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/transaction_types.inc @@ -0,0 +1,33 @@ +[% USE AuthorisedValues %] +[% 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 %] +
  • + [% IF Koha.Preference('UseCashRegisters') %] + + + Required + [%- ELSE -%] + + + [%- END -%] +
  • +[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -115,7 +115,7 @@ [% END %] [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %] - + [% END %] [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %] @@ -177,20 +177,8 @@ Required - [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] - [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %] - [% IF payment_types > 3 %] -
  • - - -
  • - [% END %] + + [% INCLUDE 'transaction_types.inc' type="payout" %] [% IF Koha.Preference('UseCashRegisters') %]
  • @@ -246,18 +234,8 @@ Required
  • - [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] -
  • - - -
  • + + [% INCLUDE 'transaction_types.inc' type="refund" %] [% IF Koha.Preference('UseCashRegisters') %]
  • @@ -379,11 +357,17 @@ var accountline = button.data('accountline'); $('#refundline').val(accountline); var amount = button.data('amount'); - var amountoutstanding = button.data('amountoutstanding'); + var amountoutstanding = button.data('amountoutstanding') || 0; var paid = amount - amountoutstanding; $("#paid + span").replaceWith(paid); $("#returned").attr({ "value": paid, "max": paid }); - $("#returned, #refund_transaction_type").focus(); + var member = button.data('member'); + if ( member === '' ) { + $("#refund_type option[value='AC']").remove(); + } else if ( $("#refund_type option[value='AC']").length == 0 ) { + $("#refund_type").prepend(''); + } + $("#returned, #refund_type").focus(); }); $("#applyDiscountModal").on("shown.bs.modal", function(e){ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -5,7 +5,6 @@ [% USE Registers %] [% USE Price %] [% SET footerjs = 1 %] -[% PROCESS 'payments.inc' %] [% PROCESS 'accounts.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% BLOCK cash_register_required %] @@ -149,7 +148,7 @@ 0.00
  • - [% PROCESS account_payment_types %] + [% INCLUDE 'transaction_types.inc' type="payment" %] [% IF Koha.Preference('UseCashRegisters') %]
  • @@ -280,7 +279,7 @@ 0.00
  • - [% PROCESS account_payment_types %] + [% INCLUDE 'transaction_types.inc' type="payment" %] [% IF Koha.Preference('UseCashRegisters') %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -6,7 +6,6 @@ [% USE TablesSettings %] [% USE Registers %] [% SET footerjs = 1 %] -[% PROCESS 'payments.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% SET registers = Registers.all( filters => { current_branch => 1 } ) %] Koha › Payments @@ -125,7 +124,7 @@
  • - [% PROCESS account_payment_types %] + [% INCLUDE 'transaction_types.inc' type="payment" %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -100,9 +100,9 @@ [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED' ) %] - + [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber %] - + [% END %] @@ -188,8 +188,8 @@ [% credit.debit.amount | $Price %] - [% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED' ) %] - + [% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %] + [% END %] @@ -276,19 +276,7 @@ Required
  • - [% 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 %] -
  • - - -
  • + [% INCLUDE 'transaction_types.inc' type="refund" %] @@ -363,9 +351,17 @@ var accountline = button.data('accountline'); $('#refundline').val(accountline); var amount = button.data('amount'); - $("#paid + span").replaceWith(amount); - $("#returned").attr({ "value": amount, "max": amount }); - $("#returned, #transaction_type").focus(); + var amountoutstanding = button.data('amountoutstanding') || 0; + var paid = amount - amountoutstanding; + $("#paid + span").replaceWith(paid); + $("#returned").attr({ "value": paid, "max": paid }); + var member = button.data('member'); + if ( member === '' ) { + $("#refund_type option[value='AC']").remove(); + } else if ( $("#refund_type option[value='AC']").length == 0 ) { + $("#refund_type").prepend(''); + } + $("#returned, #refund_type").focus(); }); $(".printReceipt").click(function() { --- a/members/boraccount.pl +++ a/members/boraccount.pl @@ -79,12 +79,12 @@ if ( $action eq 'payout' ) { my $payment_id = scalar $input->param('accountlines_id'); my $payment = Koha::Account::Lines->find($payment_id); my $amount = scalar $input->param('amount'); - my $transaction_type = scalar $input->param('transaction_type'); + my $payout_type = scalar $input->param('payout_type'); $schema->txn_do( sub { my $payout = $payment->payout( { - payout_type => $transaction_type, + payout_type => $payout_type, branch => $library_id, staff_id => $logged_in_user->id, cash_register => $registerid, @@ -100,7 +100,7 @@ if ( $action eq 'refund' ) { my $charge_id = scalar $input->param('accountlines_id'); my $charge = Koha::Account::Lines->find($charge_id); my $amount = scalar $input->param('amount'); - my $transaction_type = scalar $input->param('transaction_type'); + my $refund_type = scalar $input->param('refund_type'); $schema->txn_do( sub { @@ -113,10 +113,10 @@ if ( $action eq 'refund' ) { amount => $amount } ); - unless ( $transaction_type eq 'AC' ) { + unless ( $refund_type eq 'AC' ) { my $payout = $refund->payout( { - payout_type => $transaction_type, + payout_type => $refund_type, branch => $library_id, staff_id => $logged_in_user->id, cash_register => $registerid, --- a/pos/register.pl +++ a/pos/register.pl @@ -119,7 +119,7 @@ else { my $amount = $input->param('amount'); my $quantity = $input->param('quantity'); my $accountline_id = $input->param('accountline'); - my $transaction_type = $input->param('transaction_type'); + my $refund_type = $input->param('refund_type'); my $accountline = Koha::Account::Lines->find($accountline_id); $schema->txn_do( @@ -136,7 +136,7 @@ else { ); my $payout = $refund->payout( { - payout_type => $transaction_type, + payout_type => $refund_type, branch => $library_id, staff_id => $logged_in_user->id, cash_register => $cash_register->id, --