From 9957c9cc2252843c29dfeaa3013e81695b44e473 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 9 Jan 2020 14:14:34 +0000 Subject: [PATCH] Bug 24081: Add DISCOUNT to the allowed 'reduce' types This patch adds the DISCOUNT type to the handled types list in the reduce method introduced in bug 23442 --- Koha/Account/Line.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index bd86317bb4..c295ad8b03 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -339,14 +339,14 @@ sub reduce { "Amount to reduce ($params->{amount}) is higher than original amount ($original)" ) unless ( $original >= $params->{amount} ); my $reduced = - $self->credits( { credit_type_code => [ 'REFUND' ] } )->total; + $self->credits( { credit_type_code => [ 'DISCOUNT', 'REFUND' ] } )->total; Koha::Exceptions::ParameterTooHigh->throw( error => "Combined reduction ($params->{amount} + $reduced) is higher than original amount (" . abs($original) . ")" ) unless ( $original >= ( $params->{amount} + abs($reduced) ) ); - my $status = { 'REFUND' => 'REFUNDED' }; + my $status = { 'REFUND' => 'REFUNDED', 'DISCOUNT' => 'DISCOUNTED' }; my $reduction; $self->_result->result_source->schema->txn_do( -- 2.20.1