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,
57 % if ( $conf->exists('selfservice-agent_login') ) {
60 <TH ALIGN="right">Username</TH>
61 <TD><INPUT TYPE="text" NAME="username" SIZE=16 VALUE="<% $agent->username %>"></TD>
65 <TH ALIGN="right">Password</TH>
66 <TD><INPUT TYPE="password" NAME="_password" SIZE=16 VALUE="<% $agent->_password %>"></TD>
71 <INPUT TYPE="hidden" NAME="username" VALUE="<% $agent->username |h %>">
72 <INPUT TYPE="hidden" NAME="_password" VALUE="<% $agent->_password |h %>">
77 <TD ALIGN="right">Disable</TD>
78 <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
81 % if ( $conf->exists('agent-invoice_template') ) {
83 <% include('/elements/tr-select-invoice_template.html',
84 'label' => 'Invoice template',
85 'field' => 'invoice_template',
86 'curr_value' => $agent->invoice_template,
92 <INPUT TYPE="hidden" NAME="invoice_template" VALUE="<% $agent->invoice_template %>">
96 % if ( $conf->config('ticket_system') ) {
97 % my $default_queueid = $conf->config('ticket_system-default_queueid');
98 % my $default_queue = FS::TicketSystem->queue($default_queueid);
99 % $default_queue = "(default) $default_queueid: $default_queue"
100 % if $default_queueid;
101 % my %queues = FS::TicketSystem->queues();
102 % my @queueids = sort { $a <=> $b } keys %queues;
106 <TD ALIGN="right">Ticketing queue</TD>
108 <SELECT NAME="ticketing_queueid">
109 <OPTION VALUE=""><% $default_queue %>
110 % foreach my $queueid ( @queueids ) {
112 <OPTION VALUE="<% $queueid %>" <% $agent->ticketing_queueid == $queueid ? ' SELECTED' : '' %>><% $queueid %>: <% $queues{$queueid} %>
121 <TD ALIGN="right">Access Groups</TD>
122 <TD><% include('/elements/checkboxes-table.html',
123 'source_obj' => $agent,
124 'link_table' => 'access_groupagent',
125 'target_table' => 'access_group',
126 'name_col' => 'groupname',
127 'target_link' => $p. 'edit/access_group.html?',
136 <INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>">
140 <% include('/elements/footer.html') %>
145 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
148 if ( $cgi->param('error') ) {
149 $agent = new FS::agent ( {
150 map { $_, scalar($cgi->param($_)) } fields('agent')
152 } elsif ( $cgi->keywords ) {
153 my($query) = $cgi->keywords;
155 $agent = qsearchs( 'agent', { 'agentnum' => $1 } );
157 $agent = new FS::agent {};
159 my $action = $agent->agentnum ? 'Edit' : 'Add';
161 my $conf = new FS::Conf;