X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0d34b38184fdd6a6f1dd1bc7ce509c560e326b4e..04caff2d7309da75f53424675795addff173f32c:/SL/DB/Helper/Payment.pm diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index 93dc1ecf7..654eb41fa 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -162,7 +162,9 @@ sub pay_invoice { $paid_amount += -1 * $amount; $skonto_amount_check -= $skonto_booking->{'skonto_amount'}; }; - die "difference_as_skonto calculated incorrectly, sum of calculated payments doesn't add up to open amount $total_open_amount, reference_amount = $reference_amount\n" unless _round($reference_amount) == 0; + if ( $params{payment_type} eq 'difference_as_skonto' ) { + die "difference_as_skonto calculated incorrectly, sum of calculated payments doesn't add up to open amount $total_open_amount, reference_amount = $reference_amount\n" unless _round($reference_amount) == 0; + } }; @@ -368,7 +370,7 @@ sub amount_less_skonto { my $is_sales = ref($self) eq 'SL::DB::Invoice'; - my $percent_skonto = $self->percent_skonto; + my $percent_skonto = $self->percent_skonto || 0; return _round($self->amount - ( $self->amount * $percent_skonto) );