From: Sven Schöling Date: Tue, 22 Mar 2016 12:06:01 +0000 (+0100) Subject: warnings: besseres sanitizing in Form::calculate_tax X-Git-Tag: release-3.4.1~294 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6c94b5a5ccd41fbb4f44535290866101edd6f0dd;p=kivitendo-erp.git warnings: besseres sanitizing in Form::calculate_tax --- diff --git a/SL/Form.pm b/SL/Form.pm index 1f380b7cf..d2aa04927 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -3673,11 +3673,12 @@ sub calculate_tax { my ($self,$amount,$taxrate,$taxincluded,$roundplaces) = @_; - $roundplaces = 2 unless defined $roundplaces; + $roundplaces //= 2; + $taxincluded //= 0; my $tax; - if ($taxincluded *= 1) { + if ($taxincluded) { # calculate tax (unrounded), subtract from amount, round amount and round tax $tax = $amount - ($amount / ($taxrate + 1)); # equivalent to: taxrate * amount / (taxrate + 1) $amount = $self->round_amount($amount - $tax, $roundplaces);