1 <% include("/elements/header.html","$action Agent Type", menubar(
2 'View all agent types' => "${p}browse/agent_type.cgi",
6 <% include('/elements/error.html') %>
8 <FORM ACTION="<% popurl(1) %>process/agent_type.cgi" METHOD=POST>
9 <INPUT TYPE="hidden" NAME="typenum" VALUE="<% $agent_type->typenum %>">
11 <FONT CLASS="fsinnerbox-title">
12 Agent Type #<% $agent_type->typenum || "(NEW)" %>
15 <TABLE CLASS="fsinnerbox">
18 <TH ALIGN="right">Agent Type</TH>
19 <TD><INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<% $agent_type->atype %>"></TD>
23 <TH ALIGN="right">Disable</TH>
24 <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y" <% $agent_type->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
30 <FONT CLASS="fsinnerbox-title">
31 Package definitions that agents of this type can sell
34 <TABLE CLASS="fsinnerbox"><TR><TD>
35 <% include('/elements/checkboxes-table.html',
36 'source_obj' => $agent_type,
37 'link_table' => 'type_pkgs',
38 'target_table' => 'part_pkg',
39 'name_callback' => sub { encode_entities( $_[0]->pkg_comment(nopkgpart => 1) ); },
40 'target_link' => $p.'edit/part_pkg.cgi?',
48 <INPUT TYPE="submit" VALUE="<% $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
52 <% include('/elements/footer.html') %>
57 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
60 if ( $cgi->param('error') ) {
61 $agent_type = new FS::agent_type ( {
62 map { $_, scalar($cgi->param($_)) } fields('agent')
64 } elsif ( $cgi->keywords ) { #editing
65 my( $query ) = $cgi->keywords;
67 $agent_type=qsearchs('agent_type',{'typenum'=>$1});
69 $agent_type = new FS::agent_type {};
71 my $action = $agent_type->typenum ? 'Edit' : 'Add';