X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freg_code.html;h=f7d6d20613099b78c9d4662adaf1c2319129031c;hb=1318909d7eb16d736cbfb9f641eecccb00d4636c;hp=dc388db2ebd53efc93e9b78f4c2a3f12a4393065;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0;p=freeside.git
diff --git a/httemplate/search/reg_code.html b/httemplate/search/reg_code.html
index dc388db2e..f7d6d2061 100644
--- a/httemplate/search/reg_code.html
+++ b/httemplate/search/reg_code.html
@@ -1,13 +1,3 @@
-%
-%
-%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',
'title' => 'Unused Registration Codes for '.
$agent->agent,
@@ -23,7 +13,7 @@
sub {
map {
qq!'.
- $_->pkg. ' - '. $_->comment.
+ $_->pkg_comment(nopkgpart => 1).
'
'
} $_[0]->part_pkg
},
@@ -35,3 +25,16 @@
],
)
%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $agentnum = $cgi->param('agentnum');
+$agentnum =~ /^(\d+)$/ or errorpage("illegal agentnum $agentnum");
+$agentnum = $1;
+my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+
+my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
+
+%init>