From 5e579516f2155775dfc0fddafff4bbf1f9dc9cda Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 29 Oct 2009 12:24:27 +0100 Subject: [PATCH] display_row: Nachkommastellen korrekt berechnen. --- bin/mozilla/io.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 6ab92cff0..2047ceb9c 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -245,8 +245,7 @@ sub display_row { $column_data{"unit"} = AM->unit_select_html($all_units, "unit_$i", $this_unit, $form->{"id_$i"} ? $form->{"unit_$i"} : undef); # / unit ending - $form->{"sellprice_$i"} =~ /\.(\d+)/; - my $decimalplaces = max 2, length $1; + my $decimalplaces = ($form->{"sellprice_$i"} =~ /\.(\d+)/) ? max 2, length $1 : 2; my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1; my $discount = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100 / $price_factor, 2); @@ -260,8 +259,7 @@ sub display_row { : $cgi->textfield(-name => "description_$i", -size => 30, -value => $form->{"description_$i"})) . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')"); - $form->{"qty_$i"} =~ /\.(\d+)/; - my $qty_dec = length $1; + my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2; $column_data{qty} = $cgi->textfield(-name => "qty_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)); $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)", -value => $locale->text('*/')) -- 2.20.1