warnings: besseres sanitizing in Form::calculate_tax
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:06:01 +0000 (13:06 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:06:01 +0000 (13:06 +0100)
SL/Form.pm

index 1f380b7..d2aa049 100644 (file)
@@ -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);