@@ -, +, @@
---
.../prog/en/modules/members/boraccount.tt | 7 +++-
members/boraccount.pl | 49 +++++++++++++++-------
2 files changed, 39 insertions(+), 17 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
@@ -129,10 +129,15 @@
Total due |
[% IF ( totalcredit ) %]
[% total | $Price %] |
+
+ [% IF CAN_user_updatecharges_payout %]
+
+ [% END %]
+ |
[% ELSE %]
[% total | $Price %] |
+ |
[% END %]
- |
--- a/members/boraccount.pl
+++ a/members/boraccount.pl
@@ -76,24 +76,41 @@ if ( $action eq 'void' ) {
}
if ( $action eq 'payout' ) {
- my $payment_id = scalar $input->param('accountlines_id');
- my $payment = Koha::Account::Lines->find($payment_id);
+ my $payment_id = scalar $input->param('accountlines_id');
my $amount = scalar $input->param('amount');
my $transaction_type = scalar $input->param('transaction_type');
- $schema->txn_do(
- sub {
- my $payout = $payment->payout(
- {
- payout_type => $transaction_type,
- branch => $library_id,
- staff_id => $logged_in_user->id,
- cash_register => $registerid,
- interface => 'intranet',
- amount => $amount
- }
- );
- }
- );
+ if ( $payment_id eq "" ) {
+ $schema->txn_do(
+ sub {
+ $patron->account->payout_amount(
+ {
+ payout_type => $transaction_type,
+ branch => $library_id,
+ staff_id => $logged_in_user->id,
+ cash_register => $registerid,
+ interface => 'intranet',
+ amount => $amount
+ }
+ );
+ }
+ );
+ } else {
+ my $payment = Koha::Account::Lines->find($payment_id);
+ $schema->txn_do(
+ sub {
+ my $payout = $payment->payout(
+ {
+ payout_type => $transaction_type,
+ branch => $library_id,
+ staff_id => $logged_in_user->id,
+ cash_register => $registerid,
+ interface => 'intranet',
+ amount => $amount
+ }
+ );
+ }
+ );
+ }
}
if ( $action eq 'refund' ) {
--