5 include( '/elements/select-cust-part_pkg.html',
8 'cust_main' => $cust_main, #or 'custnum' ?
10 #strongly recommended (you want your forms to be "sticky" on errors, right?)
11 'curr_value' => 'current_value',
14 'part_pkg' => \@records,
16 #select-table.html options
21 <% include( '/elements/select-table.html',
22 'table' => 'part_pkg',
24 'empty_label' => 'Select package',
25 'label_callback' => sub { $_[0]->pkgpart. ': '.
36 my $cust_main = $opt{'cust_main'}
37 or die "cust_main not specified";
39 $opt{'records'} = delete $opt{'part_pkg'}
42 my $extra_sql = $opt{'extra_sql'}.
43 ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '.
44 ' WHERE typenum = '. $cust_main->agent->typenum.
45 ' AND type_pkgs.pkgpart = part_pkg.pkgpart )';
47 $opt{'records'} ||= [ qsearch({
48 'table' => 'part_pkg',
49 'hashref' => { 'disabled' => '', },
50 'extra_sql' => "$extra_sql ORDER BY pkg",
51 #'extra_sql' => $extra_sql,
52 #'order_by' => 'ORDER BY pkg',