From 6c94b5a5ccd41fbb4f44535290866101edd6f0dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 22 Mar 2016 13:06:01 +0100 Subject: [PATCH] warnings: besseres sanitizing in Form::calculate_tax --- SL/Form.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.20.1