X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=98bb4dbe24c0d426bb4b61f3004be31af5069504;hb=88dea78ecdb77761f71c5016ca97e53b2d55d9d3;hp=1f380b7cfce1e7482ce77aa4151e6da414ce416a;hpb=c841eb4f1f375e1a66144b61ef82be1c9edc687d;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 1f380b7cf..98bb4dbe2 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -75,6 +75,7 @@ use SL::PrefixedNumber; use SL::Request; use SL::Template; use SL::User; +use SL::Util; use SL::X; use Template; use URI; @@ -3001,19 +3002,9 @@ sub current_date { } sub like { - $main::lxdebug->enter_sub(); - my ($self, $string) = @_; - if ($string !~ /%/) { - $string = "%$string%"; - } - - $string =~ s/\'/\'\'/g; - - $main::lxdebug->leave_sub(); - - return $string; + return "%" . SL::Util::trim($string // '') . "%"; } sub redo_rows { @@ -3673,11 +3664,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);