diff options
Diffstat (limited to 'httemplate/edit/agent.cgi')
-rwxr-xr-x | httemplate/edit/agent.cgi | 114 |
1 files changed, 50 insertions, 64 deletions
diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 5992bfae0..830862ff8 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -1,25 +1,3 @@ -% -% -%my $agent; -%if ( $cgi->param('error') ) { -% $agent = new FS::agent ( { -% map { $_, scalar($cgi->param($_)) } fields('agent') -% } ); -%} elsif ( $cgi->keywords ) { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); -%} else { #adding -% $agent = new FS::agent {}; -%} -%my $action = $agent->agentnum ? 'Edit' : 'Add'; -%my $hashref = $agent->hashref; -% -%my $conf = new FS::Conf; -% -% - - <% include("/elements/header.html","$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', @@ -31,43 +9,42 @@ <FORM ACTION="<%popurl(1)%>process/agent.cgi" METHOD=POST> -<INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $hashref->{agentnum} %>"> -Agent #<% $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)" %> +<INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agent->agentnum %>"> +Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %> <% &ntable("#cccccc", 2, '') %> -<TR> - <TH ALIGN="right">Agent</TH> - <TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<% $hashref->{agent} %>"></TD> -</TR> + <TR> + <TH ALIGN="right">Agent</TH> + <TD><INPUT TYPE="text" NAME="agent" SIZE=32 VALUE="<% $agent->agent %>"></TD> + </TR> <TR> <TH ALIGN="right">Agent type</TH> - <TD><SELECT NAME="typenum" SIZE=1> -% foreach my $agent_type (qsearch('agent_type',{})) { + <TD> + <SELECT NAME="typenum" SIZE=1> +% foreach my $agent_type (qsearch('agent_type',{})) { - <OPTION VALUE="<% $agent_type->typenum %>"<% ( $hashref->{typenum} && ( $hashref->{typenum} == $agent_type->typenum ) ) ? ' SELECTED' : '' %>> + <OPTION VALUE="<% $agent_type->typenum %>"<% ( $agent->typenum && ( $agent->typenum == $agent_type->typenum ) ) ? ' SELECTED' : '' %>> <% $agent_type->getfield('typenum') %>: <% $agent_type->getfield('atype') %> -% } - +% } - </SELECT></TD> + </SELECT> + </TD> </TR> - + <TR> <TD ALIGN="right">Disable</TD> - <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>></TD> - </TR> - - <TR> - <TD ALIGN="right"><!--Frequency--></TD> - <TD><INPUT TYPE="hidden" NAME="freq" VALUE="<% $hashref->{freq} %>"></TD> + <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD> </TR> + + <% include('/elements/tr-select-invoice_template.html', + 'label' => 'Invoice template', + 'field' => 'invoice_template', + 'curr_value' => $agent->invoice_template, + ) + %> - <TR> - <TD ALIGN="right"><!--Program--></TD> - <TD><INPUT TYPE="hidden" NAME="prog" VALUE="<% $hashref->{prog} %>"></TD> - </TR> % if ( $conf->config('ticket_system') ) { % my $default_queueid = $conf->config('ticket_system-default_queueid'); % my $default_queue = FS::TicketSystem->queue($default_queueid); @@ -92,24 +69,33 @@ Agent #<% $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)" %> </TR> % } - - <TR> - <TD ALIGN="right">(DEPRECATED) Agent interface username</TD> - <TD> - <INPUT TYPE="text" NAME="username" VALUE="<% $hashref->{username} %>"> - </TD> - </TR> - - <TR> - <TD ALIGN="right">(DEPRECATED) Agent interface password</TD> - <TD> - <INPUT TYPE="text" NAME="_password" VALUE="<% $hashref->{_password} %>"> - </TD> - </TR> - </TABLE> -<BR><INPUT TYPE="submit" VALUE="<% $hashref->{agentnum} ? "Apply changes" : "Add agent" %>"> - </FORM> - </BODY> -</HTML> +<BR> +<INPUT TYPE="submit" VALUE="<% $agent->agentnum ? "Apply changes" : "Add agent" %>"> + +</FORM> + +<% include('/elements/footer.html') %> + +<%init> + +my $agent; +if ( $cgi->param('error') ) { + $agent = new FS::agent ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); +} else { #adding + $agent = new FS::agent {}; +} +my $action = $agent->agentnum ? 'Edit' : 'Add'; + +my $conf = new FS::Conf; + +</%init> + + |