diff options
author | ivan <ivan> | 2008-11-13 02:22:04 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-11-13 02:22:04 +0000 |
commit | 8a00b4c10743a314f4a298879141b60d6096eb3b (patch) | |
tree | 69867a42784bed2688ae56af882e34524ea0fbc6 /httemplate | |
parent | 158129233ebfb53031315689f0b533fea407df09 (diff) |
add ability to view/edit access groups of an agent
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/agent.cgi | 10 | ||||
-rwxr-xr-x | httemplate/edit/agent.cgi | 13 | ||||
-rwxr-xr-x | httemplate/edit/process/agent.cgi | 34 |
3 files changed, 33 insertions, 24 deletions
diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index b25b1faca..7648915e6 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -27,6 +27,7 @@ full offerings (via their type).<BR><BR> <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Master Customer</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">Access Groups</TH> <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Invoice<BR>Template</FONT></TH> <TH CLASS="grid" BGCOLOR="#cccccc">Customers</TH> <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Customer<BR>packages</FONT></TH> @@ -97,6 +98,15 @@ full offerings (via their type).<BR><BR> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> +% foreach my $access_group ( +% map $_->access_group, +% qsearch('access_groupagent', { 'agentnum' => $agent->agentnum }) +% ) { + <A HREF="<%$p%>edit/access_group.html?<% $access_group->groupnum %>"><% $access_group->groupname |h %><BR> +% } + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $agent->invoice_template || '(Default)' %> </TD> diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 0c2520510..215542de3 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -77,6 +77,19 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %> </TR> % } + <TR> + <TD ALIGN="right">Access Groups</TD> + <TD><% include('/elements/checkboxes-table.html', + 'source_obj' => $agent, + 'link_table' => 'access_groupagent', + 'target_table' => 'access_group', + 'name_col' => 'groupname', + 'target_link' => $p. 'edit/access_group.html?', + ) + %> + </TD> + </TR> + </TABLE> <BR> diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index ad550cc37..3cdf40c9b 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -1,30 +1,16 @@ -%if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ) %> -%} else { -<% $cgi->redirect(popurl(3). "browse/agent.cgi") %> -%} +<% include( 'elements/process.html', + 'table' => 'agent', + 'viewall_dir' => 'browse', + 'viewall_ext' => 'cgi', + 'process_m2m' => { 'link_table' => 'access_groupagent', + 'target_table' => 'access_group', + }, + 'edit_ext' => 'cgi', + ) +%> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $agentnum = $cgi->param('agentnum'); - -my $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; - -my $new = new FS::agent ( { - map { - $_, scalar($cgi->param($_)); - } fields('agent') -} ); - -my $error; -if ( $agentnum ) { - $error=$new->replace($old); -} else { - $error=$new->insert; - $agentnum=$new->getfield('agentnum'); -} - </%init> |