This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / httemplate / edit / agent_type.cgi
1 <% include("/elements/header.html","$action Agent Type", menubar(
2   'View all agent types' => "${p}browse/agent_type.cgi",
3 ))
4 %>
5
6 <% include('/elements/error.html') %>
7
8 <FORM ACTION="<% popurl(1) %>process/agent_type.cgi" METHOD=POST>
9 <INPUT TYPE="hidden" NAME="typenum" VALUE="<% $agent_type->typenum %>">
10 Agent Type #<% $agent_type->typenum || "(NEW)" %>
11 <BR>
12
13 Agent Type
14 <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<% $agent_type->atype %>">
15 <BR><BR>
16
17 Select which packages agents of this type may sell to customers<BR>
18 <% ntable("#cccccc", 2) %><TR><TD>
19 <% include('/elements/checkboxes-table.html',
20               'source_obj'    => $agent_type,
21               'link_table'    => 'type_pkgs',
22               'target_table'  => 'part_pkg',
23               'name_callback' => sub { $_[0]->pkg_comment(nopkgpart => 1); },
24               'target_link'   => $p.'edit/part_pkg.cgi?',
25               'disable-able'  => 1,
26
27            )
28 %>
29 </TD></TR></TABLE>
30 <BR>
31
32 <INPUT TYPE="submit" VALUE="<% $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
33
34     </FORM>
35
36 <% include('/elements/footer.html') %>
37
38 <%init>
39
40 die "access denied"
41   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
42
43 my($agent_type);
44 if ( $cgi->param('error') ) {
45   $agent_type = new FS::agent_type ( {
46     map { $_, scalar($cgi->param($_)) } fields('agent')
47   } );
48 } elsif ( $cgi->keywords ) { #editing
49   my( $query ) = $cgi->keywords;
50   $query =~ /^(\d+)$/;
51   $agent_type=qsearchs('agent_type',{'typenum'=>$1});
52 } else { #adding
53   $agent_type = new FS::agent_type {};
54 }
55 my $action = $agent_type->typenum ? 'Edit' : 'Add';
56
57 </%init>