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;
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');
}
# 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});
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"};
}
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 "<b>%s</b> <font %s>%s %s</font>",
+ $locale->text('On Hand'),
+ $onhand_color,
+ $form->format_amount(\%myconfig, $part->{onhand}, 2),
+ $part->{unit}
+ };
+ }
+# / calculate onhand
+
my @hidden_vars;
if ($is_delivery_order) {
$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"}, };
}
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 };
$script =~ s|.pl$||;
$locale = new Locale($language, $script);
- map { $form->{"select$_"} = "" } ($form->{vc}, currency);
+ map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
$currency = $form->{currency};
require "bin/mozilla/$form->{script}";
- map { $form->{"select$_"} = "" } ($form->{vc}, currency);
+ map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
$currency = $form->{currency};
}
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};
}
}
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}"};
}
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} . ' ';
}