X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=150f13a09ea883af2e9c9bbd487fc22f55ab6860;hb=2dacd2790bb5e0990ec5fe89a9d59370b018c25c;hp=69e536c54dde5f984a7afd6673e11e2d323deab6;hpb=ef220490853ca3b41b4b67568af4bf6b6dc5cc30;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 69e536c54..150f13a09 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -52,8 +52,8 @@ require "bin/mozilla/common.pl"; if (-f "bin/mozilla/custom_io.pl") { eval { require "bin/mozilla/custom_io.pl"; }; } -if (-f "bin/mozilla/$form->{login}_io.pl") { - eval { require "bin/mozilla/$form->{login}_io.pl"; }; +if (-f "bin/mozilla/$::form->{login}_io.pl") { + eval { require "bin/mozilla/$::form->{login}_io.pl"; }; } 1; @@ -93,7 +93,7 @@ use SL::AM; use Data::Dumper; sub _check_io_auth { - $auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + $main::auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' . 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | ' . 'purchase_delivery_order_edit | sales_delivery_order_edit'); } @@ -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}; @@ -936,7 +950,7 @@ sub quotation { require "bin/mozilla/$form->{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}) + : 0; + $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} . ' '; }