summaryrefslogtreecommitdiff
path: root/httemplate/search/prepay_credit.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search/prepay_credit.html')
-rw-r--r--httemplate/search/prepay_credit.html27
1 files changed, 16 insertions, 11 deletions
diff --git a/httemplate/search/prepay_credit.html b/httemplate/search/prepay_credit.html
index c79acb005..ab6490d33 100644
--- a/httemplate/search/prepay_credit.html
+++ b/httemplate/search/prepay_credit.html
@@ -1,14 +1,3 @@
-%
-%my $agent = '';
-%my $hashref = {};
-%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
-% $hashref->{agentnum} = $1;
-% $agent = qsearchs('agent', { 'agentnum' => $1 } );
-%}
-%
-%my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
-%$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;
-%
<% include( 'elements/search.html',
'title' => 'Unused Prepaid Cards'.
($agent ? ' for '. $agent->agent : ''),
@@ -61,3 +50,19 @@
],
)
%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $agent = '';
+my $hashref = {};
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+$hashref->{agentnum} = $1;
+$agent = qsearchs('agent', { 'agentnum' => $1 } );
+}
+
+my $count_query = 'SELECT COUNT(*) FROM prepay_credit';
+$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent;
+
+</%init>