have the UI use full country names, and state names outside the US...
[freeside.git] / FS / FS / h_cust_svc.pm
index 0cbac4a..af0bf60 100644 (file)
@@ -73,16 +73,23 @@ cancelled before START_TIMESTAMP.
 sub h_svc_x {
   my $self = shift;
   my $svcdb = $self->part_svc->svcdb;
-  #if ( $svcdb eq 'svc_acct' && $self->{'_svc_acct'} ) {
-  #  $self->{'_svc_acct'};
-  #} else {
-    warn "requiring FS/h_$svcdb.pm" if $DEBUG;
-    require "FS/h_$svcdb.pm";
-    qsearchs( "h_$svcdb",
-              { 'svcnum'       => $self->svcnum, },
-              "FS::h_$svcdb"->sql_h_searchs(@_),
-            );
-  #}
+
+  warn "requiring FS/h_$svcdb.pm" if $DEBUG;
+  require "FS/h_$svcdb.pm";
+  my $svc_x = qsearchs(
+    "h_$svcdb",
+    { 'svcnum' => $self->svcnum, },
+    "FS::h_$svcdb"->sql_h_searchs(@_),
+  ) || $self->SUPER::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 '';
+  }
+
 }
 
 =back