1 <% include("/elements/header.html","$action Agent", menubar(
2 'View all agents' => $p. 'browse/agent.cgi',
5 <% include('/elements/error.html') %>
8 ACTION = "<%popurl(1)%>process/agent.cgi"
9 onSubmit = "return check_agent_custnum_search(this)"
12 <SCRIPT TYPE="text/javascript">
13 function check_agent_custnum_search(what) {
14 while ( agent_custnum_search_active ) {
15 // javascript needs ambien
21 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agent->agentnum %>">
22 Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
24 <% &ntable("#cccccc", 2, '') %>
27 <TH ALIGN="right">Agent</TH>
28 <TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<% $agent->agent %>"></TD>
32 <TH ALIGN="right">Agent type</TH>
34 <SELECT NAME="typenum" SIZE=1>
35 % foreach my $agent_type (qsearch('agent_type',{})) {
37 <OPTION VALUE="<% $agent_type->typenum %>"<% ( $agent->typenum && ( $agent->typenum == $agent_type->typenum ) ) ? ' SELECTED' : '' %>>
38 <% $agent_type->getfield('typenum') %>: <% $agent_type->getfield('atype') %>
46 <TH ALIGN="right">Master customer</TH>
48 <% include('/elements/search-cust_main.html',
49 'field_name' => 'agent_custnum',
50 'curr_value' => $agent->agent_custnum,
58 <TD ALIGN="right">Disable</TD>
59 <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
62 % if ( $conf->exists('agent-invoice_template') ) {
64 <% include('/elements/tr-select-invoice_template.html',
65 'label' => 'Invoice template',
66 'field' => 'invoice_template',
67 'curr_value' => $agent->invoice_template,
73 <INPUT TYPE="hidden" NAME="invoice_template" VALUE="<% $agent->invoice_template %>">
77 % if ( $conf->config('ticket_system') ) {
78 % my $default_queueid = $conf->config('ticket_system-default_queueid');
79 % my $default_queue = FS::TicketSystem->queue($default_queueid);
80 % $default_queue = "(default) $default_queueid: $default_queue"
81 % if $default_queueid;
82 % my %queues = FS::TicketSystem->queues();
83 % my @queueids = sort { $a <=> $b } keys %queues;
87 <TD ALIGN="right">Ticketing queue</TD>
89 <SELECT NAME="ticketing_queueid">
90 <OPTION VALUE=""><% $default_queue %>
91 % foreach my $queueid ( @queueids ) {
93 <OPTION VALUE="<% $queueid %>" <% $agent->ticketing_queueid == $queueid ? ' SELECTED' : '' %>><% $queueid %>: <% $queues{$queueid} %>
102 <TD ALIGN="right">Access Groups</TD>
103 <TD><% include('/elements/checkboxes-table.html',
104 'source_obj' => $agent,
105 'link_table' => 'access_groupagent',
106 'target_table' => 'access_group',
107 'name_col' => 'groupname',
108 'target_link' => $p. 'edit/access_group.html?',
117 <INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>">
121 <% include('/elements/footer.html') %>
126 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
129 if ( $cgi->param('error') ) {
130 $agent = new FS::agent ( {
131 map { $_, scalar($cgi->param($_)) } fields('agent')
133 } elsif ( $cgi->keywords ) {
134 my($query) = $cgi->keywords;
136 $agent = qsearchs( 'agent', { 'agentnum' => $1 } );
138 $agent = new FS::agent {};
140 my $action = $agent->agentnum ? 'Edit' : 'Add';
142 my $conf = new FS::Conf;