select-table and select-part_pkg updates so we can use select-part_pkg as an edit...
[freeside.git] / httemplate / elements / select-cust-part_pkg.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/select-cust-part_pkg.html',
6
7     #required
8     'cust_main'  => $cust_main, #or 'custnum' ? 
9              
10     #strongly recommended (you want your forms to be "sticky" on errors, right?)
11     'curr_value' => 'current_value',
12   
13     #opt
14     'part_pkg'   => \@records,
15
16     #select-table.html options
17   )
18
19 </%doc>
20
21 <% include( '/elements/select-part_pkg.html',
22               'empty_label'    => 'Select package', #? need here in case removed
23                                                     #from select-part_pkg ??
24               %opt,
25           )
26 %>
27 <%init>
28
29 my( %opt ) = @_;
30
31 my $cust_main = $opt{'cust_main'}
32   or die "cust_main not specified";
33
34 $opt{'extra_sql'} .=
35   ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '.
36   '             WHERE typenum = '. $cust_main->agent->typenum.
37   '             AND type_pkgs.pkgpart = part_pkg.pkgpart )';
38
39 </%init>