1 <% objToJson( \@return ) %>
4 my( $custnum, $classnum ) = $cgi->param('arg');
6 #XXX i guess i should be agent-virtualized. cause "packages a customer can
7 #order" is such a huge deal
8 my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
10 my %hash = ( 'disabled' => '' );
11 if ( $classnum > 0 ) {
12 $hash{'classnum'} = $classnum;
13 } elsif ( $classnum eq '' || $classnum == 0 ) {
14 $hash{'classnum'} = '';
15 } #else -1, all classes, so don't set classnum
17 my @part_pkg = qsearch({
18 'table' => 'part_pkg',
21 ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( 'null'=>1 ).
22 ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ),
23 'order_by' => 'ORDER BY pkg',
26 my $conf = new FS::Conf;
28 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
30 my $default_start_date = $conf->exists('order_pkg-no_start-date')
32 : $cust_main->next_bill_date;
35 my $start_date = $_->delay_start_date
36 || $default_start_date;
37 $start_date = time2str($date_format, $start_date)
46 #sort { $a->pkg_comment cmp $b->pkg_comment }