4 %if ( $cgi->param('error') ) {
5 % $agent_type = new FS::agent_type ( {
6 % map { $_, scalar($cgi->param($_)) } fields('agent')
8 %} elsif ( $cgi->keywords ) { #editing
9 % my( $query ) = $cgi->keywords;
10 % $query =~ /^(\d+)$/;
11 % $agent_type=qsearchs('agent_type',{'typenum'=>$1});
13 % $agent_type = new FS::agent_type {};
15 %my $action = $agent_type->typenum ? 'Edit' : 'Add';
18 <% include("/elements/header.html","$action Agent Type", menubar(
20 'View all agent types' => "${p}browse/agent_type.cgi",
24 <% include('/elements/error.html') %>
26 <FORM ACTION="<% popurl(1) %>process/agent_type.cgi" METHOD=POST>
27 <INPUT TYPE="hidden" NAME="typenum" VALUE="<% $agent_type->typenum %>">
28 Agent Type #<% $agent_type->typenum || "(NEW)" %>
32 <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<% $agent_type->atype %>">
35 Select which packages agents of this type may sell to customers<BR>
36 <% ntable("#cccccc", 2) %><TR><TD>
37 <% include('/elements/checkboxes-table.html',
38 'source_obj' => $agent_type,
39 'link_table' => 'type_pkgs',
40 'target_table' => 'part_pkg',
41 'name_callback' => sub { $_[0]->pkg. ' - '. $_[0]->comment; },
42 'target_link' => $p.'edit/part_pkg.cgi?',
50 <INPUT TYPE="submit" VALUE="<% $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
54 <% include('/elements/footer.html') %>