This commit was generated by cvs2svn to compensate for changes in r8593,
[freeside.git] / httemplate / elements / select-part_pkg.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/select-part_pkg.html',
6
7     #strongly recommended (you want your forms to be "sticky" on errors, right?)
8     'curr_value' => 'current_value',
9   
10     #opt
11     'part_pkg'   => \@records,
12
13     #select-table.html options
14   )
15
16 </%doc>
17
18 <% include( '/elements/select-table.html',
19               'table'          => 'part_pkg',
20               'agent_virt'     => 1,
21               'agent_null'     => 1,
22               'name_col'       => 'pkg',
23               'empty_label'    => 'Select package', #should this be the default?
24               'label_callback' => sub { shift->pkg_comment },
25               'hashref'        => \%hash,
26               %opt,
27           )
28 %>
29 <%init>
30  
31 my( %opt ) = @_;
32
33 $opt{'records'} = delete $opt{'part_pkg'}
34   if $opt{'part_pkg'};
35
36 my %hash = ( 'disabled' => '' );
37
38 if ( exists($opt{'classnum'}) && defined($opt{'classnum'}) ) {
39   if ( $opt{'classnum'} > 0 ) {
40     $hash{'classnum'} = $opt{'classnum'};
41   } elsif ( $opt{'classnum'} eq '' || $opt{'classnum'} == 0 ) {
42     $hash{'classnum'} = '';
43   } #else -1 or not specified, all classes, so don't set classnum
44 }
45
46 $opt{'extra_sql'} .= ' AND '. FS::part_pkg->curuser_pkgs_sql;
47
48 </%init>