RT#17599: display cancelled services from history [bug fixes, v3 merge]
authorJonathan Prykop <jonathan@freeside.biz>
Tue, 5 Jul 2016 23:35:41 +0000 (18:35 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Fri, 8 Jul 2016 00:06:26 +0000 (19:06 -0500)
FS/FS/cust_pkg.pm
FS/FS/h_svc_acct.pm
FS/FS/h_svc_forward.pm
FS/FS/h_svc_www.pm

index 9bcf455..2275c59 100644 (file)
@@ -1226,7 +1226,13 @@ sub uncancel_svc_summary {
           'uncancel_svcnum' => $svc_x->get('_h_svc_x')->svcnum,
         };
         $svc_x->pkgnum($self->pkgnum); # provisioning services on a canceled package, will be rolled back
-        if ($opt{'no_test_reprovision'} or $svc_x->insert) {
+        my $insert_error;
+        unless ($opt{'no_test_reprovision'}) {
+          # avoid possibly fatal errors from missing linked records
+          eval { $insert_error = $svc_x->insert };
+          $insert_error ||= $@;
+        }
+        if ($opt{'no_test_reprovision'} or $insert_error) {
           # avoid possibly fatal errors from missing linked records
           eval { $out->{'label'} = $svc_x->label };
           eval { $out->{'label'} = $svc_x->get('_h_svc_x')->label } unless defined($out->{'label'});
index f525f82..7416054 100644 (file)
@@ -28,6 +28,7 @@ FS::h_svc_acct - Historical account objects
 
 sub svc_domain {
   my $self = shift;
+  $_[0] ||= $self->history_date;
   qsearchs( 'h_svc_domain',
             { 'svcnum' => $self->domsvc },
             FS::h_svc_domain->sql_h_searchs(@_),
index 25b2039..c0eeb3f 100644 (file)
@@ -32,6 +32,8 @@ FS::h_svc_forward - Historical mail forwarding alias objects
 
 sub srcsvc_acct {
   my $self = shift;
+
+  $_[0] ||= $self->history_date;
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->srcsvc },
@@ -52,6 +54,8 @@ sub srcsvc_acct {
 
 sub dstsvc_acct {
   my $self = shift;
+
+  $_[0] ||= $self->history_date;
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->dstsvc },
index 2a3b6dc..2000221 100644 (file)
@@ -33,6 +33,7 @@ sub domain_record {
 
   carp 'Called FS::h_svc_www->domain_record on svcnum ' . $self->svcnum if $DEBUG;
 
+  $_[0] ||= $self->history_date;
   my $domain_record = qsearchs(
     'h_domain_record',
     { 'recnum' => $self->recnum },