further work on agents editing own packages: fix fallout on package customization...
[freeside.git] / httemplate / elements / select-part_pkg.html
index cd6d24c..52b1cca 100644 (file)
@@ -33,20 +33,6 @@ my( %opt ) = @_;
 $opt{'records'} = delete $opt{'part_pkg'}
   if $opt{'part_pkg'};
 
-#false laziness w/browse/part_pkg.cgi
-my $agentnums = join(',', $FS::CurrentUser::CurrentUser->agentnums);
-
-$opt{'extra_sql'} .=
-  " AND ( agentnum IS NOT NULL
-          OR 0 < ( SELECT COUNT(*)
-                     FROM type_pkgs
-                       LEFT JOIN agent_type USING ( typenum )
-                       LEFT JOIN agent AS typeagent USING ( typenum )
-                     WHERE type_pkgs.pkgpart = part_pkg.pkgpart
-                       AND typeagent.agentnum IN ($agentnums)
-                 )
-        )
-  ";
-#eofalse
+$opt{'extra_sql'} .= ' AND '. FS::part_pkg->curuser_pkgs_sql;
 
 </%init>