invoice_sections_with_taxes per-agent, RT#79636
[freeside.git] / httemplate / view / port_graph.html
1 % if ($error) { warn $error; }
2 % else {
3 <% $png %>
4 % }
5 <%init>
6
7 # NOTE: the weird warn/die stuff here is because this file is accessed as 
8 # IMG SRC="port_graph.html" - easier than hacking an uglier solution
9
10 unless ( $FS::CurrentUser::CurrentUser->access_right('View customer services') ) {
11     warn "access denied";
12     die;
13 }
14
15 my $svcnum = $cgi->param('svcnum');
16 unless ( $svcnum =~ /^\d+$/ ) {
17     warn 'invalid svcnum';
18     die;
19 }
20
21 my $start = $cgi->param('start');
22 my $end = $cgi->param('end');
23 unless ( $start =~ /^\d+$/ && $end =~ /^\d+$/ ) {
24     warn 'invalid start and/or end times';
25     die;
26 }
27
28 my $svc_port = qsearchs('svc_port', { 'svcnum' => $svcnum });
29 unless($svc_port) {
30     warn 'invalid svc_port';
31     die;
32 }
33
34 my $error = '';
35 my $png = $svc_port->graph_png('start' => $start, 'end' => $end);
36 $error = 'error from graph_png: '.$png if length($png) < 200;
37
38 http_header('Content-Type' => 'image/png') unless($error);
39
40 </%init>