1 % if ($error) { warn $error; }
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
10 unless ( $FS::CurrentUser::CurrentUser->access_right('View customer services') ) {
15 my $svcnum = $cgi->param('svcnum');
16 unless ( $svcnum =~ /^\d+$/ ) {
17 warn 'invalid svcnum';
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';
28 my $svc_port = qsearchs('svc_port', { 'svcnum' => $svcnum });
30 warn 'invalid svc_port';
35 my $png = $svc_port->graph_png('start' => $start, 'end' => $end);
36 $error = 'error from graph_png: '.$png if length($png) < 200;
38 http_header('Content-Type' => 'image/png') unless($error);