add date_deleted method
[freeside.git] / FS / FS / h_cust_svc.pm
index 718f2c7..8cee68a 100644 (file)
@@ -28,6 +28,17 @@ inherits from FS::h_Common and FS::cust_svc.
 
 =over 4
 
+=item date_deleted
+
+Returns the date this service was deleted, if any.
+
+=cut
+
+sub date_deleted {
+  my $self = shift;
+  $self->h_date('delete');
+}
+
 =item label END_TIMESTAMP [ START_TIMESTAMP ] 
 
 Returns a list consisting of:
@@ -80,13 +91,15 @@ sub h_svc_x {
     "h_$svcdb",
     { 'svcnum' => $self->svcnum, },
     "FS::h_$svcdb"->sql_h_searchs(@_),
-  ) || $self->SUPER::svc_x
-    or die "no history ${svcdb}.svcnum for cust_svc.svcnum ". $self->svcnum;
-
-  carp "Using $svcdb in place of missing h_${svcdb} record."
-   if ($svc_x->isa('FS::' . $svcdb) and $DEBUG);
+  ) || $self->SUPER::svc_x;
 
-  return $svc_x;
+  if ($svc_x) {
+    carp "Using $svcdb in place of missing h_${svcdb} record."
+      if ($svc_x->isa('FS::' . $svcdb) and $DEBUG);
+    return $svc_x;
+  } else {
+    return '';
+  }
 
 }