summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-12-19 19:10:45 +0000
committerivan <ivan>2009-12-19 19:10:45 +0000
commit81c5822c789cf6357a037bfdef9f4cabc9a0c6a9 (patch)
tree879747af6e2ca61977c55f8cc3bc8b6b14742185
parenta7d270c86521dd85a0bf632a25770d2ceb9722fd (diff)
fix package order to really display only those pacakges available
-rw-r--r--FS/FS/part_pkg.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index cd5f0fea1..46f4e7241 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1352,15 +1352,16 @@ sub _pkgs_sql {
"
(
- 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)
- )
+ ( agentnum IS NOT NULL AND agentnum IN ($agentnums) )
+ OR ( agentnum IS NULL
+ AND EXISTS ( SELECT 1
+ 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)
+ )
+ )
)
";