X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fagent.cgi;h=c4963e4701a1cc36384759b89026450f954f0d49;hb=a1d1dc9edcb57c0295689203de577c670f947b60;hp=5992bfae0551dc75f782935d013a70e968b3504d;hpb=549f8fa9a054c1d67dcf30dac30e2d709620f752;p=freeside.git diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 5992bfae0..c4963e470 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -1,73 +1,101 @@ -% -% -%my $agent; -%if ( $cgi->param('error') ) { -% $agent = new FS::agent ( { -% map { $_, scalar($cgi->param($_)) } fields('agent') -% } ); -%} elsif ( $cgi->keywords ) { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); -%} else { #adding -% $agent = new FS::agent {}; -%} -%my $action = $agent->agentnum ? 'Edit' : 'Add'; -%my $hashref = $agent->hashref; -% -%my $conf = new FS::Conf; -% -% - - <% include("/elements/header.html","$action Agent", menubar( - 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', )) %> -% if ( $cgi->param('error') ) { -Error: <% $cgi->param('error') %> -% } +<% include('/elements/error.html') %> + +
+ +<% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $agent; +if ( $cgi->param('error') ) { + $agent = new FS::agent ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); +} else { #adding + $agent = new FS::agent {}; +} +my $action = $agent->agentnum ? 'Edit' : 'Add'; + +my $conf = new FS::Conf; -