Lines 291-296
debts.
Link Here
|
291 |
Reduction type may be one of: |
291 |
Reduction type may be one of: |
292 |
|
292 |
|
293 |
* REFUND |
293 |
* REFUND |
|
|
294 |
* DISCOUNT |
294 |
|
295 |
|
295 |
Returns the reduction accountline (which will be a credit) |
296 |
Returns the reduction accountline (which will be a credit) |
296 |
|
297 |
|
Lines 339-352
sub reduce {
Link Here
|
339 |
"Amount to reduce ($params->{amount}) is higher than original amount ($original)" |
340 |
"Amount to reduce ($params->{amount}) is higher than original amount ($original)" |
340 |
) unless ( $original >= $params->{amount} ); |
341 |
) unless ( $original >= $params->{amount} ); |
341 |
my $reduced = |
342 |
my $reduced = |
342 |
$self->credits( { credit_type_code => [ 'REFUND' ] } )->total; |
343 |
$self->credits( { credit_type_code => [ 'DISCOUNT', 'REFUND' ] } )->total; |
343 |
Koha::Exceptions::ParameterTooHigh->throw( error => |
344 |
Koha::Exceptions::ParameterTooHigh->throw( error => |
344 |
"Combined reduction ($params->{amount} + $reduced) is higher than original amount (" |
345 |
"Combined reduction ($params->{amount} + $reduced) is higher than original amount (" |
345 |
. abs($original) |
346 |
. abs($original) |
346 |
. ")" ) |
347 |
. ")" ) |
347 |
unless ( $original >= ( $params->{amount} + abs($reduced) ) ); |
348 |
unless ( $original >= ( $params->{amount} + abs($reduced) ) ); |
348 |
|
349 |
|
349 |
my $status = { 'REFUND' => 'REFUNDED' }; |
350 |
my $status = { 'REFUND' => 'REFUNDED', 'DISCOUNT' => 'DISCOUNTED' }; |
350 |
|
351 |
|
351 |
my $reduction; |
352 |
my $reduction; |
352 |
$self->_result->result_source->schema->txn_do( |
353 |
$self->_result->result_source->schema->txn_do( |
353 |
- |
|
|