summaryrefslogtreecommitdiff
path: root/httemplate/view
diff options
context:
space:
mode:
authorivan <ivan>2009-02-09 14:05:31 +0000
committerivan <ivan>2009-02-09 14:05:31 +0000
commita4b8ce8cd1d309de00c64f38049a8dda38798046 (patch)
tree8c36c37a563900083468912ebeb373da39c59cca /httemplate/view
parent9925a640ebd475bf260b4d9e065b3f01e929e20a (diff)
rest of per-agent config for company_name, company_address, logo, etc.. RT#3989
Diffstat (limited to 'httemplate/view')
-rwxr-xr-xhttemplate/view/REAL_logo.cgi14
-rwxr-xr-xhttemplate/view/cust_bill-logo.cgi18
2 files changed, 28 insertions, 4 deletions
diff --git a/httemplate/view/REAL_logo.cgi b/httemplate/view/REAL_logo.cgi
new file mode 100755
index 000000000..c269c7d04
--- /dev/null
+++ b/httemplate/view/REAL_logo.cgi
@@ -0,0 +1,14 @@
+<% $conf->config_binary("logo.png", $agentnum) %>
+<%init>
+
+my $conf = new FS::Conf;
+
+my $agentnum = '';
+my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
+if ( scalar(@agentnums) == 1 ) {
+ $agentnum = $agentnums[0];
+}
+
+http_header('Content-Type' => 'image/png' );
+
+</%init>
diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi
index 9c1c1d71d..09ac9a717 100755
--- a/httemplate/view/cust_bill-logo.cgi
+++ b/httemplate/view/cust_bill-logo.cgi
@@ -1,4 +1,4 @@
-<% $conf->config_binary("logo$templatename.png") %>
+<% $conf->config_binary("logo$templatename.png", $agentnum) %>
<%init>
die "access denied"
@@ -7,9 +7,19 @@ die "access denied"
my $conf = new FS::Conf;
-my($query) = $cgi->keywords;
-$query =~ /^([^\.\/]*)$/;
-my $templatename = $1;
+my $templatename;
+my $agentnum = '';
+if ( $cgi->param('invnum') ) {
+ $templatename = $cgi->param('templatename');
+ my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } )
+ or die 'unknown invnum';
+ $agentnum = $cust_bill->cust_main->agentnum;
+} else {
+ my($query) = $cgi->keywords;
+ $query =~ /^([^\.\/]*)$/ or die 'illegal query';
+ $templatename = $1;
+}
+
if ( $templatename && $conf->exists("logo_$templatename.png") ) {
$templatename = "_$templatename";
} else {