Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6c94b5a5

Von Sven Schöling vor etwa 8 Jahren hinzugefügt

  • ID 6c94b5a5ccd41fbb4f44535290866101edd6f0dd
  • Vorgänger c841eb4f
  • Nachfolger 15b67fd5

warnings: besseres sanitizing in Form::calculate_tax

Unterschiede anzeigen:

SL/Form.pm
3673 3673

  
3674 3674
  my ($self,$amount,$taxrate,$taxincluded,$roundplaces) = @_;
3675 3675

  
3676
  $roundplaces = 2 unless defined $roundplaces;
3676
  $roundplaces //= 2;
3677
  $taxincluded //= 0;
3677 3678

  
3678 3679
  my $tax;
3679 3680

  
3680
  if ($taxincluded *= 1) {
3681
  if ($taxincluded) {
3681 3682
    # calculate tax (unrounded), subtract from amount, round amount and round tax
3682 3683
    $tax       = $amount - ($amount / ($taxrate + 1)); # equivalent to: taxrate * amount / (taxrate + 1)
3683 3684
    $amount    = $self->round_amount($amount - $tax, $roundplaces);

Auch abrufbar als: Unified diff