[freeside-commits] freeside/FS/FS cust_main.pm, 1.464.2.39, 1.464.2.40 cust_bill.pm, 1.263.2.23, 1.263.2.24
Ivan,,,
ivan at wavetail.420.am
Mon Aug 9 23:28:43 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv32334/FS/FS
Modified Files:
Tag: FREESIDE_1_9_BRANCH
cust_main.pm cust_bill.pm
Log Message:
add logo_file support to welcome_letter and fix leaving temp files around for invoices and letters, RT#9497
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.464.2.39
retrieving revision 1.464.2.40
diff -u -w -d -r1.464.2.39 -r1.464.2.40
--- cust_main.pm 9 Aug 2010 16:20:40 -0000 1.464.2.39
+++ cust_main.pm 10 Aug 2010 06:28:41 -0000 1.464.2.40
@@ -9527,6 +9527,7 @@
=cut
+# a lot like cust_bill::print_latex
sub generate_letter {
my ($self, $template, %options) = @_;
@@ -9590,6 +9591,17 @@
$letter_data{company_name} = $conf->config('company_name', $self->agentnum);
my $dir = $FS::UID::conf_dir."/cache.". $FS::UID::datasrc;
+
+ my $lh = new File::Temp( TEMPLATE => 'letter.'. $self->custnum. '.XXXXXXXX',
+ DIR => $dir,
+ SUFFIX => '.eps',
+ UNLINK => 0,
+ ) or die "can't open temp file: $!\n";
+ print $lh $conf->config_binary('logo.eps', $self->agentnum)
+ or die "can't write temp file: $!\n";
+ close $lh;
+ $letter_data{'logo_file'} = $lh->filename;
+
my $fh = new File::Temp( TEMPLATE => 'letter.'. $self->custnum. '.XXXXXXXX',
DIR => $dir,
SUFFIX => '.tex',
@@ -9599,7 +9611,8 @@
$letter_template->fill_in( OUTPUT => $fh, HASH => \%letter_data );
close $fh;
$fh->filename =~ /^(.*).tex$/ or die "unparsable filename: ". $fh->filename;
- return $1;
+ return ($1, $letter_data{'logo_file'});
+
}
=item print_ps TEMPLATE
@@ -9610,8 +9623,12 @@
sub print_ps {
my $self = shift;
- my $file = $self->generate_letter(@_);
- FS::Misc::generate_ps($file);
+ my($file, $lfile) = $self->generate_letter(@_);
+ my $ps = FS::Misc::generate_ps($file);
+ unlink($file.'.tex');
+ unlink($lfile);
+
+ $ps;
}
=item print TEMPLATE
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.263.2.23
retrieving revision 1.263.2.24
diff -u -w -d -r1.263.2.23 -r1.263.2.24
--- cust_bill.pm 28 Jun 2010 04:11:25 -0000 1.263.2.23
+++ cust_bill.pm 10 Aug 2010 06:28:41 -0000 1.263.2.24
@@ -2993,6 +2993,7 @@
my ($file, $lfile) = $self->print_latex(@_);
my $ps = generate_ps($file);
+ unlink($file.'.tex');
unlink($lfile);
$ps;
@@ -3021,6 +3022,7 @@
my ($file, $lfile) = $self->print_latex(@_);
my $pdf = generate_pdf($file);
+ unlink($file.'.tex');
unlink($lfile);
$pdf;
More information about the freeside-commits
mailing list