]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 27 Oct 2011 12:39:33 +0000 (14:39 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Thu, 27 Oct 2011 12:39:33 +0000 (14:39 +0200)
SL/CVar.pm
SL/Template/LaTeX.pm

index bd58cbd7eff9b5dda1fbd26822420053f3565cc2..1b83121bf0340584968cbfdbd90445da4576ba6b 100644 (file)
@@ -575,7 +575,7 @@ sub add_custom_variables_to_report {
           $cfg->{type} eq 'date'      ? $ref->{date_value}
         : $cfg->{type} eq 'timestamp' ? $ref->{timestamp_value}
         : $cfg->{type} eq 'number'    ? $form->format_amount($myconfig, $ref->{number_value} * 1, $cfg->{precision})
-        : $cfg->{type} eq 'customer'  ? SL::DB::Manager::Customer->find_by(id => 1* $ref->{number_value})->name
+        : $cfg->{type} eq 'customer'  ? (SL::DB::Manager::Customer->find_by(id => 1*$ref->{number_value}) || SL::DB::Customer->new)->name
         : $cfg->{type} eq 'bool'      ? ($ref->{bool_value} ? $locale->text('Yes') : $locale->text('No'))
         :                               $ref->{text_value};
     }
index c7d51e0e00bd87e2b35a6c72ab26e2c2964a881f..2df7e8cfbc574f9eaea1afdc36324090764aa485 100644 (file)
@@ -387,13 +387,16 @@ sub convert_to_postscript {
 
   my $latex = $self->_get_latex_path();
   my $old_home = $ENV{HOME};
-  $ENV{HOME}   = $userspath =~ m|^/| ? $userspath : getcwd() . "/" . $userspath;
+  my $old_openin_any = $ENV{openin_any};
+  $ENV{HOME}   = $userspath =~ m|^/| ? $userspath : getcwd();
+  $ENV{openin_any} = "p";
 
   for (my $run = 1; $run <= 2; $run++) {
     system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
            "> $form->{tmpfile}.err");
     if ($?) {
       $ENV{HOME} = $old_home;
+      $ENV{openin_any} = $old_openin_any;
       $self->{"error"} = $form->cleanup($latex);
       return 0;
     }
@@ -403,6 +406,7 @@ sub convert_to_postscript {
 
   system("dvips $form->{tmpfile} -o -q > /dev/null");
   $ENV{HOME} = $old_home;
+  $ENV{openin_any} = $old_openin_any;
 
   if ($?) {
     $self->{"error"} = "dvips : $!";
@@ -432,19 +436,23 @@ sub convert_to_pdf {
 
   my $latex = $self->_get_latex_path();
   my $old_home = $ENV{HOME};
-  $ENV{HOME}   = $userspath =~ m|^/| ? $userspath : getcwd() . "/" . $userspath;
+  my $old_openin_any = $ENV{openin_any};
+  $ENV{HOME}   = $userspath =~ m|^/| ? $userspath : getcwd();
+  $ENV{openin_any} = "p";
 
   for (my $run = 1; $run <= 2; $run++) {
     system("${latex} --interaction=nonstopmode $form->{tmpfile} " .
            "> $form->{tmpfile}.err");
     if ($?) {
       $ENV{HOME}     = $old_home;
+      $ENV{openin_any} = $old_openin_any;
       $self->{error} = $form->cleanup($latex);
       return 0;
     }
   }
 
   $ENV{HOME} = $old_home;
+  $ENV{openin_any} = $old_openin_any;
   $form->{tmpfile} =~ s/tex$/pdf/;
 
   $self->cleanup();