Falschen Spaltennamen korrigiert.
[kivitendo-erp.git] / bin / mozilla / rp.pl
index 209e082..da1a265 100644 (file)
@@ -41,6 +41,7 @@ require "bin/mozilla/common.pl";
 use SL::PE;
 use SL::RP;
 use SL::USTVA;
+use SL::Iconv;
 
 1;
 
@@ -146,7 +147,7 @@ sub report {
                          '-labels' => \%project_labels));
 
   # use JavaScript Calendar or not
-  $form->{jsscript} = $jscalendar;
+  $form->{jsscript} = 1;
   $jsscript = "";
   if ($form->{report} eq "ustva") {
     $department = "";
@@ -1946,8 +1947,6 @@ sub e_mail {
 sub send_email {
   $lxdebug->enter_sub();
 
-  $form->{OUT} = "$sendmail";
-
   $form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
     unless $form->{subject};
 
@@ -1955,10 +1954,10 @@ sub send_email {
 
   $form->{"statement_1"} = 1;
 
-  &print_form;
+  $form->{media} = 'email';
+  print_form();
 
-  $form->redirect(
-                 $locale->text('Statement sent to') . " $form->{$form->{ct}}");
+  $form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}");
 
   $lxdebug->leave_sub();
 }
@@ -1982,7 +1981,6 @@ sub print {
   $form->error($locale->text('Nothing selected!')) unless $selected;
 
   if ($form->{media} eq 'printer') {
-    $form->{OUT} = "| $myconfig{printer}";
     $form->{"$form->{ct}_id"} = "";
   } else {
     $form->{"statement_1"} = 1;
@@ -1990,7 +1988,7 @@ sub print {
 
   RP->aging(\%myconfig, \%$form);
 
-  &print_form;
+  print_form();
 
   $form->redirect($locale->text('Statements sent to printer!'))
     if ($form->{media} eq 'printer');
@@ -2009,6 +2007,11 @@ sub print_form {
      " " => "_"
     );
 
+  foreach my $key (keys %replacements) {
+    my $new_key = SL::Iconv::convert("ISO-8859-15", $dbcharset, $key);
+    $replacements{$new_key} = $replacements{$key} if $new_key ne $key;
+  }
+
   $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
 
   $form->{templates} = "$myconfig{templates}";
@@ -2025,8 +2028,10 @@ sub print_form {
     $attachment_suffix = "pdf";
   }
 
-  $form->{IN} = "$form->{type}.$suffix";
-
+  $form->{IN}  = "$form->{type}.$suffix";
+  $form->{OUT} =
+    $form->{media} eq 'email'   ? $sendmail              :
+    $form->{media} eq 'printer' ? "| $myconfig{printer}" : "";
 
   # Save $form->{email} because it will be overwritten.
   $form->{EMAIL_RECIPIENT} = $form->{email};
@@ -2501,7 +2506,7 @@ sub list_payments {
       $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap');
 
       $href =
-        qq|${module}.pl?ction=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
+        qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|;
 
       $column_data{name}      = "<td>$payment->{name}&nbsp;</td>";
       $column_data{reference} =