-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('List packages');
-
-# my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {});
-
-my($query) = $cgi->keywords;
-
-my @where = ();
-
-##
-# parse agent
-##
-
-if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
- push @where,
- "cust_main.agentnum = $1";
-}
-
-##
-# parse status
-##
-
-if ( $cgi->param('magic') eq 'active'
- || $cgi->param('status') eq 'active' ) {
-
- push @where, FS::cust_pkg->active_sql();
-
-} elsif ( $cgi->param('magic') eq 'inactive'
- || $cgi->param('status') eq 'inactive' ) {
-
- push @where, FS::cust_pkg->inactive_sql();
-
-
-} elsif ( $cgi->param('magic') eq 'suspended'
- || $cgi->param('status') eq 'suspended' ) {
-
- push @where, FS::cust_pkg->suspended_sql();
-
-} elsif ( $cgi->param('magic') =~ /^cancell?ed$/
- || $cgi->param('status') =~ /^cancell?ed$/ ) {
-
- push @where, FS::cust_pkg->cancelled_sql();
-
-} elsif ( $cgi->param('status') =~ /^(one-time charge|inactive)$/ ) {
-
- push @where, FS::cust_pkg->inactive_sql();
-
-}
-
-###
-# parse package class
-###