Lines 339-352
sub reduce {
Link Here
|
339 |
"Amount to reduce ($params->{amount}) is higher than original amount ($original)" |
339 |
"Amount to reduce ($params->{amount}) is higher than original amount ($original)" |
340 |
) unless ( $original >= $params->{amount} ); |
340 |
) unless ( $original >= $params->{amount} ); |
341 |
my $reduced = |
341 |
my $reduced = |
342 |
$self->credits( { credit_type_code => [ 'REFUND' ] } )->total; |
342 |
$self->credits( { credit_type_code => [ 'DISCOUNT', 'REFUND' ] } )->total; |
343 |
Koha::Exceptions::ParameterTooHigh->throw( error => |
343 |
Koha::Exceptions::ParameterTooHigh->throw( error => |
344 |
"Combined reduction ($params->{amount} + $reduced) is higher than original amount (" |
344 |
"Combined reduction ($params->{amount} + $reduced) is higher than original amount (" |
345 |
. abs($original) |
345 |
. abs($original) |
346 |
. ")" ) |
346 |
. ")" ) |
347 |
unless ( $original >= ( $params->{amount} + abs($reduced) ) ); |
347 |
unless ( $original >= ( $params->{amount} + abs($reduced) ) ); |
348 |
|
348 |
|
349 |
my $status = { 'REFUND' => 'REFUNDED' }; |
349 |
my $status = { 'REFUND' => 'REFUNDED', 'DISCOUNT' => 'DISCOUNTED' }; |
350 |
|
350 |
|
351 |
my $reduction; |
351 |
my $reduction; |
352 |
$self->_result->result_source->schema->txn_do( |
352 |
$self->_result->result_source->schema->txn_do( |
353 |
- |
|
|