X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_Common.pm;h=d11b58375da02958428469a640eba7504d1d3adf;hb=5b77b3d0c9aa2d0fa15ca5284d7e34ed68f4ee12;hp=dea31ea8515dca0e39485375ec07d7a55f543d1a;hpb=351c9f0e23d1b66d7b62b72afa31e14575722ba0;p=freeside.git

diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index dea31ea85..d11b58375 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1394,11 +1394,17 @@ Parameters:
 
 =item order_by
 
+=item cancelled - if true, only returns svcs attached to cancelled pkgs;
+if defined and false, only returns svcs not attached to cancelled packages
+
 =back
 
 =cut
 
-# svc_broadband::search should eventually use this instead
+### Don't call the 'cancelled' option 'Service Status'
+### There is no such thing
+### See cautionary note in httemplate/browse/part_svc.cgi
+
 sub search {
   my ($class, $params) = @_;
 
@@ -1502,6 +1508,14 @@ sub search {
     push @where, "exportnum = $1";
   }
 
+  if ( defined($params->{'cancelled'}) ) {
+    if ($params->{'cancelled'}) {
+      push @where, "cust_pkg.cancel IS NOT NULL";
+    } else {
+      push @where, "cust_pkg.cancel IS NULL";
+    }
+  }
+
 #  # sector and tower
 #  my @where_sector = $class->tower_sector_sql($params);
 #  if ( @where_sector ) {