User Attribut "role" entfernt.
[kivitendo-erp.git] / bin / mozilla / io.pl
index 37fdda8..5df76ed 100644 (file)
@@ -38,7 +38,6 @@
 
 use Carp;
 use CGI;
-use CGI::Ajax;
 use List::Util qw(min max first);
 
 use SL::CVar;
@@ -113,7 +112,7 @@ sub display_row {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
-  my $cgi      = $main::cgi;
+  my $cgi      = $::request->{cgi};
 
   my $numrows = shift;
 
@@ -359,7 +358,7 @@ sub display_row {
 # 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};
+      my $onhand_color = $part->{onhand} < $part->{rop} ? 'color="#ff0000"' : '';
       push @ROW2, { value => sprintf "<b>%s</b> <font %s>%s %s</font>",
                       $locale->text('On Hand'),
                       $onhand_color,
@@ -415,7 +414,7 @@ sub set_pricegroup {
 
   my $form     = $main::form;
   my $locale   = $main::locale;
-  my $cgi      = $main::cgi;
+  my $cgi      = $::request->{cgi};
 
   _check_io_auth();
 
@@ -952,7 +951,7 @@ sub edit_e_mail {
                                      subject       => $subject,
                                      print_options => print_options('inline' => 1),
                                      HIDDEN        => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
-                                     SHOW_BCC      => $myconfig{role} eq 'admin' });
+                                     SHOW_BCC      => $::auth->assert('email_bcc', 'may fail') });
 
   $main::lxdebug->leave_sub();
 }
@@ -1312,11 +1311,13 @@ sub print_form {
   my $payment_id_saved = $form->{payment_id};
   my $salesman_id_saved = $form->{salesman_id};
   my $cp_id_saved = $form->{cp_id};
+  my $taxzone_id_saved = $form->{taxzone_id};
 
   call_sub("$form->{vc}_details") if ($form->{vc});
 
   $form->{language_id} = $language_saved;
   $form->{payment_id} = $payment_id_saved;
+  $form->{taxzone_id} = $taxzone_id_saved;
 
   $form->{"email"} = $saved_email if ($saved_email);
   $form->{"cc"}    = $saved_cc    if ($saved_cc);
@@ -1339,6 +1340,10 @@ sub print_form {
     $output_longdates = 1;
   }
 
+  # Store the output number format so that the template modules know
+  # how to parse the amounts back if requested.
+  $myconfig{output_numberformat} = $output_numberformat || $myconfig{numberformat};
+
   ($form->{employee}) = split /--/, $form->{employee};
 
   # create the form variables
@@ -1455,7 +1460,7 @@ sub print_form {
     $extension            = 'xls';
   }
 
-  my $email_extension = '_email' if (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}"));
+  my $email_extension = (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}")) ? '_email' : '';
 
   $form->{IN}         = "$form->{formname}${email_extension}$form->{language}${printer_code}.${extension}";
 
@@ -1794,6 +1799,8 @@ sub _render_custom_variables_inputs {
       $description = $cvar->{description} . ' ';
     }
 
+    my $form_key = "ic_cvar_" . $cvar->{name} . "_$params{row}";
+
     push @{ $params{ROW2} }, {
       line_break     => $num_visible_cvars == 1,
       description    => $description,
@@ -1804,7 +1811,7 @@ sub _render_custom_variables_inputs {
          name_prefix       => 'ic_',
          name_postfix      => "_$params{row}",
          valid             => $cvar->{valid},
-         value             => $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"},
+         value             => CVar->parse($::form->{$form_key}, $cvar),
       }
     };
   }