+my $pkg_agentnums_sql = $curuser->agentnums_sql(
+ 'null' => 1,
+ 'table' => 'part_pkg',
+ );
+
+my $extra_sql = " WHERE $pkg_agentnums_sql";
+
+foreach my $part_pkg (qsearch({ 'table' => 'part_pkg',
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql,
+ })
+ )
+{