projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c841eb4
)
warnings: besseres sanitizing in Form::calculate_tax
author
Sven Schöling
<s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:06:01 +0000
(13:06 +0100)
committer
Sven Schöling
<s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:06:01 +0000
(13:06 +0100)
SL/Form.pm
patch
|
blob
|
history
diff --git
a/SL/Form.pm
b/SL/Form.pm
index
1f380b7
..
d2aa049
100644
(file)
--- 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);