summaryrefslogtreecommitdiff
path: root/httemplate/browse/part_pkg.cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-08-17 15:38:22 -0700
committerIvan Kohler <ivan@freeside.biz>2014-08-17 15:38:22 -0700
commita618055d3a8cfc55a449847b433dcdc85df92bcd (patch)
treeb97040ca60379c2e8de10a8d9884dae1e80b3beb /httemplate/browse/part_pkg.cgi
parent601432ca6836e10cc4e15b1c055d77ff7f4a0540 (diff)
parentd87c9f804b0cb7b6798bf770f753fb83022f5e6a (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/browse/part_pkg.cgi')
-rwxr-xr-xhttemplate/browse/part_pkg.cgi17
1 files changed, 15 insertions, 2 deletions
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 63822c7c9..1eb55c88a 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -108,6 +108,14 @@ my $count_cust_pkg = "
WHERE cust_pkg.pkgpart = part_pkg.pkgpart
AND $agentnums_sql
";
+my $count_cust_pkg_cancel = "
+ SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum )
+ LEFT JOIN cust_pkg AS cust_pkg_next
+ ON (cust_pkg.pkgnum = cust_pkg_next.change_pkgnum)
+ WHERE cust_pkg.pkgpart = part_pkg.pkgpart
+ AND $agentnums_sql
+ AND cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0
+";
$select = "
@@ -137,11 +145,16 @@ $select = "
AND ( setup IS NULL OR setup = 0 )
) AS num_on_hold,
- ( $count_cust_pkg
- AND cancel IS NOT NULL AND cancel != 0
+ ( $count_cust_pkg_cancel
+ AND (cust_pkg_next.pkgnum IS NULL
+ OR cust_pkg_next.pkgpart != cust_pkg.pkgpart)
) AS num_cancelled
";
+# About the num_cancelled expression: packages that were changed, but
+# kept the same pkgpart, are considered "moved", not "canceled" (because
+# this is the part_pkg UI). We could show the count of those but it's
+# probably not interesting.
my $html_init = qq!
One or more service definitions are grouped together into a package