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 %>">
23 <FONT CLASS="fsinnerbox-title">
24 Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %>
27 <TABLE CLASS="fsinnerbox">
30 <TH ALIGN="right">Agent</TH>
31 <TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<% $agent->agent %>"></TD>
35 <TH ALIGN="right">Agent type</TH>
37 <SELECT NAME="typenum" SIZE=1>
38 % foreach my $agent_type ( qsearch('agent_type', { 'disabled'=>'' }) ) {
40 <OPTION VALUE="<% $agent_type->typenum %>"<% ( $agent->typenum && ( $agent->typenum == $agent_type->typenum ) ) ? ' SELECTED' : '' %>>
41 <% $agent_type->getfield('typenum') %>: <% $agent_type->getfield('atype') %>
49 <TH ALIGN="right">Master customer</TH>
51 <% include('/elements/search-cust_main.html',
52 'field_name' => 'agent_custnum',
53 'curr_value' => $agent->agent_custnum,
60 % if ( $conf->exists('selfservice-agent_login') ) {
63 <TH ALIGN="right">Username</TH>
64 <TD><INPUT TYPE="text" NAME="username" SIZE=16 VALUE="<% $agent->username %>"></TD>
68 <TH ALIGN="right">Password</TH>
69 <TD><INPUT TYPE="password" NAME="_password" SIZE=16 VALUE="<% $agent->_password %>"></TD>
74 <INPUT TYPE="hidden" NAME="username" VALUE="<% $agent->username |h %>">
75 <INPUT TYPE="hidden" NAME="_password" VALUE="<% $agent->_password |h %>">
80 <TD ALIGN="right">Disable</TD>
81 <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
84 % if ( $conf->exists('agent-invoice_template') ) {
86 <% include('/elements/tr-select-invoice_template.html',
87 'label' => 'Invoice template',
88 'field' => 'invoice_template',
89 'curr_value' => $agent->invoice_template,
95 <INPUT TYPE="hidden" NAME="invoice_template" VALUE="<% $agent->invoice_template %>">
99 % if ( $conf->config('ticket_system') ) {
100 % my $default_queueid = $conf->config('ticket_system-default_queueid');
101 % my $default_queue = FS::TicketSystem->queue($default_queueid);
102 % $default_queue = "(default) $default_queueid: $default_queue"
103 % if $default_queueid;
104 % my %queues = FS::TicketSystem->queues();
105 % my @queueids = sort { $a <=> $b } keys %queues;
109 <TD ALIGN="right">Ticketing queue</TD>
111 <SELECT NAME="ticketing_queueid">
112 <OPTION VALUE=""><% $default_queue %>
113 % foreach my $queueid ( @queueids ) {
115 <OPTION VALUE="<% $queueid %>" <% $agent->ticketing_queueid == $queueid ? ' SELECTED' : '' %>><% $queueid %>: <% $queues{$queueid} %>
126 <FONT CLASS="fsinnerbox-title"><% mt('Access Groups') |h %></FONT>
127 <TABLE CLASS="fsinnerbox">
130 <TD><% include('/elements/checkboxes-table.html',
131 'source_obj' => $agent,
132 'link_table' => 'access_groupagent',
133 'target_table' => 'access_group',
134 'name_col' => 'groupname',
135 'target_link' => $p. 'edit/access_group.html?',
144 <& /elements/table-commissions.html,
145 'source_obj' => $agent,
146 'link_table' => 'agent_pkg_class',
147 #'target_table' => 'pkg_class',
151 <INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>">
155 <% include('/elements/footer.html') %>
160 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
163 if ( $cgi->param('error') ) {
164 $agent = new FS::agent ( {
165 map { $_, scalar($cgi->param($_)) } fields('agent')
167 } elsif ( $cgi->keywords ) {
168 my($query) = $cgi->keywords;
170 $agent = qsearchs( 'agent', { 'agentnum' => $1 } );
172 $agent = new FS::agent {};
174 my $action = $agent->agentnum ? 'Edit' : 'Add';
176 my $conf = new FS::Conf;