4.x style
[freeside.git] / httemplate / elements / table-commissions.html
1 <FONT CLASS="fsinnerbox-title"><% mt('Commissions') |h %></FONT>
2 <TABLE CLASS="fsinnerbox">
3
4 % my $pkey = $object->primary_key;
5 % my $pkey_value = $object->$pkey();
6 % my $link_class = 'FS::'.$link_table;
7
8 % #surprising amount of false laziness w/ edit/process/agent.cgi
9 % # (somewhat less now that we're more generic)
10 % my @pkg_class = qsearch($target_table, { 'disabled'=>'' });
11 % foreach my $pkg_class ( '', @pkg_class ) {
12 %   my %thing_pkg_class = ( $pkey    => $pkey_value,
13 %                           classnum => $pkg_class ? $pkg_class->classnum : ''
14 %                         );
15 %   my $thing_pkg_class =
16 %     qsearchs( $link_table, \%thing_pkg_class )
17 %     || $link_class->new( \%thing_pkg_class );
18 %   my $param = 'classnum'. $thing_pkg_class{classnum};
19
20     <TR>
21       <TD><% $pkg_class ? $pkg_class->classname : mt('(no package class)') |h %>: 
22       </TD>
23       <TD><INPUT TYPE      = "text"
24                  NAME      = "<% $param %>"
25                  VALUE     = "<% $cgi->param($param) || $thing_pkg_class->commission_percent |h %>"
26                  SIZE      = 6
27                  MAXLENGTH = 7
28           >%
29       </TD>
30 %     if ( $opt{'show_duration'} ) {
31         <TD>
32           for <INPUT TYPE = "text"
33                         NAME = "<% $param %>_duration"
34                         VALUE = "<% $cgi->param($param.'_duration') || $thing_pkg_class->commission_duration |h %>"
35                  SIZE      = 2
36                  MAXLENGTH = 3
37               >
38           months
39         </TD>
40 %     }
41     </TR>
42
43 % }
44
45 % if ( $opt{'show_duration'} ) {
46
47     <TR>
48       <TD COLSPAN=2>
49       </TD>
50       <TD>
51         <FONT SIZE="-2"><I>blank for no time limit</I></FONT>
52       </TD>
53     </TR>
54
55 % }
56
57 </TABLE>
58
59 <%init>
60
61 my %opt = @_;
62
63 my $object = $opt{'source_obj'};
64 my $link_table = $opt{'link_table'};
65 my $target_table = $opt{'target_table'} || 'pkg_class';
66
67 </%init>