Option to ignore old CDRs, RT#81480
[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
11 <FONT CLASS="fsinnerbox-title">
12 Agent Type #<% $agent_type->typenum || "(NEW)" %>
13 </FONT>
14
15 <TABLE CLASS="fsinnerbox">
16
17   <TR>
18     <TH ALIGN="right">Agent Type</TH>
19     <TD><INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="<% $agent_type->atype %>"></TD>
20   </TR>
21
22   <TR>
23     <TH ALIGN="right">Disable</TH>
24     <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y" <% $agent_type->disabled eq 'Y' ? ' CHECKED' : '' %>></TD>
25   </TR>
26
27 <TABLE>
28 <BR>
29
30 <FONT CLASS="fsinnerbox-title">
31 Package definitions that agents of this type can sell
32 </FONT>
33
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?',
41               'disable-able'  => 1,
42
43            )
44 %>
45 </TD></TR></TABLE>
46 <BR>
47
48 <INPUT TYPE="submit" VALUE="<% $agent_type->typenum ? "Apply changes" : "Add agent type" %>">
49
50     </FORM>
51
52 <% include('/elements/footer.html') %>
53
54 <%init>
55
56 die "access denied"
57   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
58
59 my($agent_type);
60 if ( $cgi->param('error') ) {
61   $agent_type = new FS::agent_type ( {
62     map { $_, scalar($cgi->param($_)) } fields('agent')
63   } );
64 } elsif ( $cgi->keywords ) { #editing
65   my( $query ) = $cgi->keywords;
66   $query =~ /^(\d+)$/;
67   $agent_type=qsearchs('agent_type',{'typenum'=>$1});
68 } else { #adding
69   $agent_type = new FS::agent_type {};
70 }
71 my $action = $agent_type->typenum ? 'Edit' : 'Add';
72
73 </%init>