fix uncancellation w/services that have been re-provisioned, RT#17518
authorIvan Kohler <ivan@freeside.biz>
Fri, 11 May 2012 03:30:17 +0000 (20:30 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 11 May 2012 03:30:17 +0000 (20:30 -0700)
FS/FS/cust_pkg.pm
httemplate/misc/cancel_pkg.html
httemplate/misc/process/cancel_pkg.html

index 27c25da..1d4a90c 100644 (file)
@@ -972,7 +972,16 @@ sub uncancel {
     my $svc_error = $svc_x->insert;
     if ( $svc_error && $options{svc_fatal} ) {
       $dbh->rollback if $oldAutoCommit;
-      return $error;
+      return $svc_error;
+    } else {
+      my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum });
+      if ( $cust_svc ) {
+        my $cs_error = $cust_svc->delete;
+        if ( $cs_error ) {
+          $dbh->rollback if $oldAutoCommit;
+          return $cs_error;
+        }
+      }
     }
     push @svc_errors, $svc_error if $svc_error;
   }
index 3a6a4d1..348f0a6 100755 (executable)
       'format'  => $date_format,
   } &>
 
+  <& /elements/tr-checkbox.html,
+       'label'  => mt("Uncancel even if a service can't be re-provisioned"),
+       'field'  => 'svc_not_fatal',
+       'value'  => 'Y',
+  &>
+
 %   $date_init = 1;
 % }
 
index bc3a8cd..b2d7bfa 100755 (executable)
@@ -80,11 +80,14 @@ my $last_bill =
 my $bill =
   $cgi->param('bill')      ? parse_datetime($cgi->param('bill'))      : '';
 
+my $svc_fatal = ( $cgi->param('svc_not_fatal') ne 'Y' );
+
 my $error = $cust_pkg->$method( 'reason'      => $reasonnum,
                                 'date'        => $date,
                                 'resume_date' => $resume_date,
                                 'last_bill'   => $last_bill,
                                 'bill'        => $bill,
+                                'svc_fatal'   => $svc_fatal,
                               );
 
 if ($error) {