- [% 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 %]
@@ -302,19 +302,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" %]
@@ -390,9 +378,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() {
diff --git a/members/boraccount.pl b/members/boraccount.pl
index 35930810be..7bd550940d 100755
--- a/members/boraccount.pl
+++ b/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,
diff --git a/pos/register.pl b/pos/register.pl
index 97d6d63cf6..e398bda396 100755
--- a/pos/register.pl
+++ b/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,