summaryrefslogtreecommitdiff
path: root/httemplate/search/reg_code.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search/reg_code.html')
-rw-r--r--httemplate/search/reg_code.html24
1 files changed, 14 insertions, 10 deletions
diff --git a/httemplate/search/reg_code.html b/httemplate/search/reg_code.html
index 52a99ff66..87e0fcdd5 100644
--- a/httemplate/search/reg_code.html
+++ b/httemplate/search/reg_code.html
@@ -1,13 +1,4 @@
-<%
-
-my $agentnum = $cgi->param('agentnum');
-$agentnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
-$agentnum = $1;
-my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
-
-my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
-
-%><%= include( 'elements/search.html',
+<% include( 'elements/search.html',
'title' => 'Unused Registration Codes for '.
$agent->agent,
'name' => 'registration codes',
@@ -34,3 +25,16 @@ my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
],
)
%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $agentnum = $cgi->param('agentnum');
+$agentnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
+$agentnum = $1;
+my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+
+my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
+
+<%init>