[freeside-commits] branch master updated. 55ef5977a4319b9b79e265d99306a141a96eb250

Jonathan Prykop jonathan at 420.am
Wed Mar 11 14:51:13 PDT 2015


The branch, master has been updated
       via  55ef5977a4319b9b79e265d99306a141a96eb250 (commit)
      from  cd2cf35ac3da7de5ad8b6055b345ace3a770d647 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 55ef5977a4319b9b79e265d99306a141a96eb250
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Mar 11 16:50:22 2015 -0500

    RT#14671 Usage for current day when billing outstanding usage (for cancelling customers) [added no_delay_cancel]

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 8eb4ce3..5bb3d2a 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -787,7 +787,12 @@ be used.
 
 =item delay_cancel - for internal use, to allow proper handling of
 supplemental packages when the main package is flagged to suspend 
-before cancelling
+before cancelling, probably shouldn't be used otherwise (set the
+corresponding package option instead)
+
+=item no_delay_cancel - for internal use, prevents delay_cancel behavior
+no matter what other options say, for use when changing packages (or any
+other time you're really sure you want an unadulterated cancel)
 
 =back
 
@@ -828,9 +833,10 @@ sub cancel {
   my $date = $options{'date'} if $options{'date'}; # expire/cancel later
   $date = '' if ($date && $date <= $cancel_time);      # complain instead?
 
-  my $delay_cancel = $options{'delay_cancel'};
+  my $delay_cancel = $options{'no_delay_cancel'} ? 0 : $options{'delay_cancel'};
   if ( !$date && $self->part_pkg->option('delay_cancel',1)
        && (($self->status eq 'active') || ($self->status eq 'suspended'))
+       && !$options{'no_delay_cancel'}
   ) {
     my $expdays = $conf->config('part_pkg-delay_cancel-days') || 1;
     my $expsecs = 60*60*24*$expdays;
@@ -931,7 +937,7 @@ sub cancel {
   $error = $new->replace( $self, options => { $self->options } );
   if ( $self->change_to_pkgnum ) {
     my $change_to = FS::cust_pkg->by_key($self->change_to_pkgnum);
-    $error ||= $change_to->cancel || $change_to->delete;
+    $error ||= $change_to->cancel('no_delay_cancel' => 1) || $change_to->delete;
   }
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
@@ -2198,6 +2204,7 @@ sub change {
     unused_credit  => $unused_credit,
     nobill         => $keep_dates,
     change_custnum => ( $self->custnum != $custnum ? $custnum : '' ),
+    no_delay_cancel => 1,
   );
   if ($error) {
     $dbh->rollback if $oldAutoCommit;
@@ -2295,7 +2302,7 @@ sub change_later {
 
         $error = $self->replace       ||
                  $err_or_pkg->replace ||
-                 $change_to->cancel   ||
+                 $change_to->cancel('no_delay_cancel' => 1) ||
                  $change_to->delete;
       } else {
         $error = $err_or_pkg;
@@ -4813,7 +4820,7 @@ sub order {
       $dbh->rollback if $oldAutoCommit;
       return "Unable to transfer all services from package ".$old_pkg->pkgnum;
     }
-    $error = $old_pkg->cancel( quiet=>1 );
+    $error = $old_pkg->cancel( quiet=>1, 'no_delay_cancel'=>1 );
     if ($error) {
       $dbh->rollback;
       return $error;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_pkg.pm |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list