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;
11 $agent_type=qsearchs('agent_type',{'typenum'=>$1});
13 $agent_type = new FS::agent_type {};
15 my $action = $agent_type->typenum ? 'Edit' : 'Add';
19 <%= header("$action Agent Type", menubar(
21 'View all agent types' => "${p}browse/agent_type.cgi",
25 <% if ( $cgi->param('error') ) { %>
26 <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
29 <FORM ACTION="<%= popurl(1) %>process/agent_type.cgi" METHOD=POST>
30 <INPUT TYPE="hidden" NAME="typenum" VALUE="<%= $agent_type->typenum %>">
31 Agent Type #<%= $agent_type->typenum || "(NEW)" %>
35 <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<%= $agent_type->atype %>">
38 Select which packages agents of this type may sell to customers<BR>
40 <% foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { %>
43 <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>" <%=
44 qsearchs('type_pkgs',{
45 'typenum' => $agent_type->typenum,
46 'pkgpart' => $part_pkg->pkgpart,
52 <A HREF="<%= $p %>edit/part_pkg.cgi?<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkgpart %>:
53 <%= $part_pkg->pkg %> (<%= $part_pkg->comment %>)</A>
59 <INPUT TYPE="submit" VALUE="<%= $agent_type->typenum ? "Apply changes" : "Add agent type" %>">