This commit was generated by cvs2svn to compensate for changes in r5562,
[freeside.git] / httemplate / graph / money_time.cgi
index f085c22..2b98af8 100644 (file)
@@ -1,4 +1,23 @@
-<%
+<% include('elements/monthly.html',
+                'title'        => $agentname.
+                                  'Sales, Credits and Receipts Summary',
+                'items'        => \@items,
+                'labels'       => \%label,
+                'graph_labels' => \%graph_label,
+                'colors'       => \%color,
+                'links'        => \%link,
+                'start_month'  => $smonth,
+                'start_year'   => $syear,
+                'end_month'    => $emonth,
+                'end_year'     => $eyear,
+                'agentnum'     => $agentnum,
+                'nototal'      => scalar($cgi->param('12mo')),
+             )
+%>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
 
 #find first month
 my $syear = $cgi->param('start_year'); # || 1899+$curyear;
@@ -15,6 +34,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
   die "agentnum $agentnum not found!" unless $agent;
 }
+
 my $agentname = $agent ? $agent->agent.' ' : '';
 
 my @items = qw( invoiced netsales credits payments receipts );
@@ -62,19 +82,4 @@ my %link = (
 );
 # XXX link 12mo?
 
-%><%= include('elements/monthly.html',
-                'title'        => $agentname.
-                                  'Sales, Credits and Receipts Summary',
-                'items'        => \@items,
-                'labels'       => \%label,
-                'graph_labels' => \%graph_label,
-                'colors'       => \%color,
-                'links'        => \%link,
-                'start_month'  => $smonth,
-                'start_year'   => $syear,
-                'end_month'    => $emonth,
-                'end_year'     => $eyear,
-                'agentnum'     => $agentnum,
-                'nototal'      => scalar($cgi->param('12mo')),
-             )
-%>
+</%init>