Lines 102-146
else {
Link Here
|
102 |
|
102 |
|
103 |
my $op = $input->param('op') // ''; |
103 |
my $op = $input->param('op') // ''; |
104 |
if ( $op eq 'cashup' ) { |
104 |
if ( $op eq 'cashup' ) { |
105 |
$cash_register->add_cashup( |
105 |
if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) { |
106 |
{ |
106 |
$cash_register->add_cashup( |
107 |
manager_id => $logged_in_user->id, |
107 |
{ |
108 |
amount => $cash_register->outstanding_accountlines->total |
108 |
manager_id => $logged_in_user->id, |
109 |
} |
109 |
amount => $cash_register->outstanding_accountlines->total |
110 |
); |
110 |
} |
|
|
111 |
); |
112 |
} |
113 |
else { |
114 |
$template->param( error_cashup_permission => 1 ); |
115 |
} |
111 |
} |
116 |
} |
112 |
elsif ( $op eq 'refund' ) { |
117 |
elsif ( $op eq 'refund' ) { |
113 |
my $amount = $input->param('amount'); |
118 |
if ( $logged_in_user->has_permission( { cash_management => 'anonymous_refund' } ) ) { |
114 |
my $quantity = $input->param('quantity'); |
119 |
my $amount = $input->param('amount'); |
115 |
my $accountline_id = $input->param('accountline'); |
120 |
my $quantity = $input->param('quantity'); |
116 |
my $transaction_type = $input->param('transaction_type'); |
121 |
my $accountline_id = $input->param('accountline'); |
117 |
|
122 |
my $transaction_type = $input->param('transaction_type'); |
118 |
my $accountline = Koha::Account::Lines->find($accountline_id); |
123 |
|
119 |
$schema->txn_do( |
124 |
my $accountline = Koha::Account::Lines->find($accountline_id); |
120 |
sub { |
125 |
$schema->txn_do( |
121 |
|
126 |
sub { |
122 |
my $refund = $accountline->reduce( |
127 |
|
123 |
{ |
128 |
my $refund = $accountline->reduce( |
124 |
reduction_type => 'Refund', |
129 |
{ |
125 |
branch => $library_id, |
130 |
reduction_type => 'Refund', |
126 |
staff_id => $logged_in_user->id, |
131 |
branch => $library_id, |
127 |
interface => 'intranet', |
132 |
staff_id => $logged_in_user->id, |
128 |
amount => $amount |
133 |
interface => 'intranet', |
129 |
} |
134 |
amount => $amount |
130 |
); |
135 |
} |
131 |
my $payout = $refund->payout( |
136 |
); |
132 |
{ |
137 |
my $payout = $refund->payout( |
133 |
payout_type => $transaction_type, |
138 |
{ |
134 |
branch => $library_id, |
139 |
payout_type => $transaction_type, |
135 |
staff_id => $logged_in_user->id, |
140 |
branch => $library_id, |
136 |
cash_register => $cash_register->id, |
141 |
staff_id => $logged_in_user->id, |
137 |
interface => 'intranet', |
142 |
cash_register => $cash_register->id, |
138 |
amount => $amount |
143 |
interface => 'intranet', |
139 |
} |
144 |
amount => $amount |
140 |
); |
145 |
} |
|
|
146 |
); |
141 |
|
147 |
|
142 |
} |
148 |
} |
143 |
); |
149 |
); |
|
|
150 |
} |
151 |
else { |
152 |
$template->param( error_refund_permission => 1 ); |
153 |
} |
144 |
} |
154 |
} |
145 |
} |
155 |
} |
146 |
|
156 |
|
147 |
- |
|
|