1 <% include("/elements/header.html","$action Agent", menubar(
2 'View all agents' => $p. 'browse/agent.cgi',
5 <% include('/elements/error.html') %>
7 <FORM ACTION="<%popurl(1)%>process/agent.cgi" METHOD=POST>
8 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agent->agentnum %>">
9 Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
11 <% &ntable("#cccccc", 2, '') %>
14 <TH ALIGN="right">Agent</TH>
15 <TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<% $agent->agent %>"></TD>
19 <TH ALIGN="right">Agent type</TH>
21 <SELECT NAME="typenum" SIZE=1>
22 % foreach my $agent_type (qsearch('agent_type',{})) {
24 <OPTION VALUE="<% $agent_type->typenum %>"<% ( $agent->typenum && ( $agent->typenum == $agent_type->typenum ) ) ? ' SELECTED' : '' %>>
25 <% $agent_type->getfield('typenum') %>: <% $agent_type->getfield('atype') %>
33 <TH ALIGN="right">Master customer</TH>
35 <% include('/elements/search-cust_main.html',
36 'field_name' => 'agent_custnum',
37 'curr_value' => $agent->agent_custnum,
45 <TD ALIGN="right">Disable</TD>
46 <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
49 % if ( $conf->exists('agent-invoice_template') ) {
51 <% include('/elements/tr-select-invoice_template.html',
52 'label' => 'Invoice template',
53 'field' => 'invoice_template',
54 'curr_value' => $agent->invoice_template,
60 <INPUT TYPE="hidden" NAME="invoice_template" VALUE="<% $agent->invoice_template %>">
64 % if ( $conf->config('ticket_system') ) {
65 % my $default_queueid = $conf->config('ticket_system-default_queueid');
66 % my $default_queue = FS::TicketSystem->queue($default_queueid);
67 % $default_queue = "(default) $default_queueid: $default_queue"
68 % if $default_queueid;
69 % my %queues = FS::TicketSystem->queues();
70 % my @queueids = sort { $a <=> $b } keys %queues;
74 <TD ALIGN="right">Ticketing queue</TD>
76 <SELECT NAME="ticketing_queueid">
77 <OPTION VALUE=""><% $default_queue %>
78 % foreach my $queueid ( @queueids ) {
80 <OPTION VALUE="<% $queueid %>" <% $agent->ticketing_queueid == $queueid ? ' SELECTED' : '' %>><% $queueid %>: <% $queues{$queueid} %>
89 <TD ALIGN="right">Access Groups</TD>
90 <TD><% include('/elements/checkboxes-table.html',
91 'source_obj' => $agent,
92 'link_table' => 'access_groupagent',
93 'target_table' => 'access_group',
94 'name_col' => 'groupname',
95 'target_link' => $p. 'edit/access_group.html?',
104 <INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>">
108 <% include('/elements/footer.html') %>
113 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
116 if ( $cgi->param('error') ) {
117 $agent = new FS::agent ( {
118 map { $_, scalar($cgi->param($_)) } fields('agent')
120 } elsif ( $cgi->keywords ) {
121 my($query) = $cgi->keywords;
123 $agent = qsearchs( 'agent', { 'agentnum' => $1 } );
125 $agent = new FS::agent {};
127 my $action = $agent->agentnum ? 'Edit' : 'Add';
129 my $conf = new FS::Conf;