default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / fs_selfservice / FS-SelfService / cgi / cust_bill-logo.cgi
old mode 100644 (file)
new mode 100755 (executable)
index bf82a87..253f853
@@ -1,18 +1,25 @@
+#!/usr/bin/perl -T
 #!/usr/bin/perl -Tw
 
 use strict;
 use CGI;
 use FS::SelfService qw( invoice_logo );
 
-$cgi = new CGI;
+my $cgi = new CGI;
 
-my($query) = $cgi->keywords;
-$query =~ /^([^\.\/]*)$/ or '' =~ /^()$/;
-my $templatename = $1;
-invoice_logo($templatename);
+my %hash = ();
+if ( $cgi->param('invnum') ) {
+  $hash{$_} = scalar($cgi->param($_)) foreach qw( invnum template );
+} else {
+  my($query) = $cgi->keywords;
+  $query =~ /^([^\.\/]*)$/ or '' =~ /^()$/;
+  $hash{'template'} = $1;
+}
 
-print $cgi->header( '-type'    => $content_type,
+my $hashref = invoice_logo(%hash);
+
+print $cgi->header( '-type'    => $hashref->{'content_type'},
                     '-expires' => 'now',
                   ).
-      $logo;
+      $hashref->{'logo'};