Neu-Aufbau Lx-Office Bildschirm
[kivitendo-erp.git] / bin / mozilla / io.pl
index 94d536c..83da8b5 100644 (file)
@@ -229,7 +229,6 @@ sub display_row {
     }
     my $this_unit = $form->{"unit_$i"};
     $this_unit    = $form->{"selected_unit_$i"} if AM->convert_unit($this_unit, $form->{"selected_unit_$i"}, $all_units);
-    $this_unit  ||= "kg";
 
     if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
       my @values = ('', map { $_->{id}                      } @{ $form->{ALL_PRICE_FACTORS} });
@@ -1166,7 +1165,7 @@ sub print_options {
 
   push @MEDIA, grep $_,
       opthash("screen",              $form->{OP}{screen},              $locale->text('Screen')),
-    (scalar @{ $form->{printers} } && $main::latex_templates) ?
+    ($form->{printers} && scalar @{ $form->{printers} } && $main::latex_templates) ?
       opthash("printer",             $form->{OP}{printer},             $locale->text('Printer')) : undef,
     ($main::latex_templates && !$options{no_queue}) ?
       opthash("queue",               $form->{OP}{queue},               $locale->text('Queue')) : undef
@@ -1977,11 +1976,7 @@ sub relink_accounts {
   }
   $form->{"taxaccounts"} = "";
 
-  for (my $i = 1; $i <= $form->{"rowcount"}; $i++) {
-    if ($form->{"id_$i"}) {
-      IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1);
-    }
-  }
+  IC->retrieve_accounts(\%myconfig, $form, map { $_ => $form->{"id_$_"} } 1 .. $form->{rowcount});
 
   $main::lxdebug->leave_sub();
 }
@@ -2076,8 +2071,8 @@ sub _update_custom_variables {
 
   my $form     = $main::form;
 
-  $form->{CVAR_CONFIGS}       ||= { };
-  $form->{CVAR_CONFIGS}->{IC}   = CVar->get_configs(module => 'IC');
+  $form->{CVAR_CONFIGS}         = { } unless ref $form->{CVAR_CONFIGS} eq 'HASH';
+  $form->{CVAR_CONFIGS}->{IC} ||= CVar->get_configs(module => 'IC');
 
   $main::lxdebug->leave_sub();
 }
@@ -2094,10 +2089,11 @@ sub _render_custom_variables_inputs {
     return;
   }
 
+  my $valid = CVar->custom_variables_validity_by_trans_id(trans_id => $params{part_id});
+
   my $num_visible_cvars = 0;
   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});
+    $cvar->{valid} = $params{part_id} && $valid->($cvar->{id});
 
     my $description = '';
     if ($cvar->{flag_editable} && $cvar->{valid}) {