[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [957] branches/1.2/LedgerSMB



Revision: 957
          http://svn.sourceforge.net/ledger-smb/?rev=957&view=rev
Author:   einhverfr
Date:     2007-03-19 23:14:33 -0700 (Mon, 19 Mar 2007)

Log Message:
-----------
Fixing printing

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Form.pm
    branches/1.2/LedgerSMB/Sysconfig.pm

Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm	2007-03-20 04:17:58 UTC (rev 956)
+++ branches/1.2/LedgerSMB/Form.pm	2007-03-20 06:14:33 UTC (rev 957)
@@ -88,7 +88,8 @@
 	if (($self->{script} =~ m#(..|\\|/)#)){
 		$self->error("Access Denied");
 	}
-	if (not	first {$_ eq $self->{script}} @{LedgerSMB::Sysconfig::scripts}){
+	if (($self->{script}) and not first {$_ eq $self->{script}} 
+					@{LedgerSMB::Sysconfig::scripts}){
 		$self->error('Access Denied');
 	}
 
@@ -627,7 +628,7 @@
 	my $fileid = time;
 	my $tmpfile = $self->{IN};
 	$tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid};
-	$self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}";
+	$self->{tmpfile} = "${LedgerSMB::Sysconfig::tempdir}/${fileid}_${tmpfile}";
 
     my $temphash;
 	if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') {
@@ -851,19 +852,16 @@
 	# Convert the tex file to postscript
 	if ($self->{format} =~ /(postscript|pdf)/) {
 
-		use Cwd;
-		$self->{cwd} = cwd();
-		$self->{tmpdir} = "$self->{cwd}/${LedgerSMB::Sysconfig::userspath}";
-		$self->{tmpdir} = "${LedgerSMB::Sysconfig::userspath}" if
-			${LedgerSMB::Sysconfig::userspath} =~ /^\//;
+		$self->{tmpdir} = "${LedgerSMB::Sysconfig::tempdir}";
 
-		unless (chdir("${LedgerSMB::Sysconfig::userspath}")) {
+		unless (chdir($self->{tmpdir})) {
 			$err = $!;
 			$self->cleanup;
-			$self->error("chdir : $err");
+			$self->debug;
+			$self->error("chdir : $self->{tmpdir} : $err");
 		}
 
-		$self->{tmpfile} =~ s/${LedgerSMB::Sysconfig::userspath}\///g;
+		$self->{tmpfile} =~ s/$self->{tmpdir}\///g;
 
 		$self->{errfile} = $self->{tmpfile};
 		$self->{errfile} =~ s/tex$/err/;

Modified: branches/1.2/LedgerSMB/Sysconfig.pm
===================================================================
--- branches/1.2/LedgerSMB/Sysconfig.pm	2007-03-20 04:17:58 UTC (rev 956)
+++ branches/1.2/LedgerSMB/Sysconfig.pm	2007-03-20 06:14:33 UTC (rev 957)
@@ -34,6 +34,9 @@
 # templates base directory
 $templates = "templates";
 
+# Temporary files stored at"
+$tempdir = ($ENV{TEMP} || '/tmp');
+
 # member file
 $memberfile = "users/members";
 
@@ -64,6 +67,8 @@
 my %config;
 read_config('ledgersmb.conf' => %config) or die;
 
+# We should clean this code up for 1.3 :-) Chris T.
+
 $logging = $config{''}{logging} if $config{''}{logging};
 $check_max_invoices = $config{''}{check_max_invoices} if
 	$config{''}{check_max_invoices};
@@ -81,6 +86,7 @@
 $localepath = $config{paths}{localepath} if $config{paths}{localepath};
 $spool = $config{paths}{spool} if $config{paths}{spool};
 $templates = $config{paths}{templates} if $config{paths}{templates};
+$tempdir = $config{paths}{tempdir} if $config{paths}{tempdir};
 
 $gzip = $config{programs}{gzip} if $config{programs}{gzip};
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.