X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=f3e92dc94c27878685050db2a2bf2f7e4f10217b;hb=b3bde077a6df1550915b1433b2cabb4cf74ab681;hp=69e536c54dde5f984a7afd6673e11e2d323deab6;hpb=20bb56c1d57dde9492fef150edbfe0149a07ff08;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 69e536c54..f3e92dc94 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -197,6 +197,7 @@ sub display_row { # rows for $i (1 .. $numrows) { + my %column_data = (); # undo formatting map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty discount sellprice price_new price_old) unless ($form->{simple_save}); @@ -261,7 +262,7 @@ sub display_row { if ($form->{"id_$i"}) { my $ship_qty = $form->{"ship_$i"} * 1; $ship_qty *= $all_units->{$form->{"partunit_$i"}}->{factor}; - $ship_qty /= $all_units->{$form->{"unit_$i"}}->{factor}; + $ship_qty /= ( $all_units->{$form->{"unit_$i"}}->{factor} || 1 ); $column_data{ship} = $form->format_amount(\%myconfig, $form->round_amount($ship_qty, 2) * 1) . ' ' . $form->{"unit_$i"}; } @@ -336,6 +337,19 @@ sub display_row { if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/) && !$is_delivery_order; # / marge calculations ending +# calculate onhand + if ($form->{"id_$i"}) { + my $part = IC->get_basic_part_info(id => $form->{"id_$i"}); + my $onhand_color = 'color="#ff0000"' if $part->{onhand} < $part->{rop}; + push @ROW2, { value => sprintf "%s %s %s", + $locale->text('On Hand'), + $onhand_color, + $form->format_amount(\%myconfig, $part->{onhand}, 2), + $part->{unit} + }; + } +# / calculate onhand + my @hidden_vars; if ($is_delivery_order) { @@ -358,7 +372,7 @@ sub display_row { $form->{invsubtotal} += $linetotal; # Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse - _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i); + _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i, part_id => $form->{"id_$i"}); push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, }; } @@ -730,7 +744,7 @@ sub check_form { sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_total marge_percent marge_price_factor lastcost price_factor_id partnotes - stock_out stock_in); + stock_out stock_in has_sernumber); my $ic_cvar_configs = CVar->get_configs(module => 'IC'); push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; @@ -881,7 +895,7 @@ sub order { $script =~ s|.pl$||; $locale = new Locale($language, $script); - map { $form->{"select$_"} = "" } ($form->{vc}, currency); + map { $form->{"select$_"} = "" } ($form->{vc}, "currency"); $currency = $form->{currency}; @@ -1435,10 +1449,9 @@ sub print_form { } if ($form->{language} ne "") { - map({ $form->{"unit"}->[$_] = - AM->translate_units($form, $form->{"language"}, - $form->{"unit"}->[$_], $form->{"qty"}->[$_]); } - (0..scalar(@{$form->{"unit"}}) - 1)); + my $template_arrays = $form->{TEMPLATE_ARRAYS} || $form; + map { $template_arrays->{unit}->[$_] = AM->translate_units($form, $form->{language}, $template_arrays->{unit}->[$_], $template_arrays->{qty}->[$_]); } (0..scalar(@{ $template_arrays->{unit} }) - 1); + $form->{language} = "_" . $form->{language}; } @@ -1966,6 +1979,10 @@ sub _render_custom_variables_inputs { } foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { + $cvar->{valid} = $params{part_id} + ? CVar->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{part_id}) + : 1; + $cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"}; } @@ -1977,7 +1994,7 @@ sub _render_custom_variables_inputs { my $num_visible_cvars = 0; foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) { my $description = ''; - if ($cvar->{flag_editable}) { + if ($cvar->{flag_editable} && $cvar->{valid}) { $num_visible_cvars++; $description = $cvar->{description} . ' '; }