[freeside-commits] branch master updated. dba9a62fa32e07d4461e9c081201f69c0cda7015

Jonathan Prykop jonathan at 420.am
Tue Feb 17 16:15:20 PST 2015


The branch, master has been updated
       via  dba9a62fa32e07d4461e9c081201f69c0cda7015 (commit)
       via  0c2cb2d865f84d21032ebc9780118d44df4ddf26 (commit)
      from  7a8ff6a0a75e0a50b6fde0bff3d49e8372853e94 (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 dba9a62fa32e07d4461e9c081201f69c0cda7015
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Feb 17 18:13:04 2015 -0600

    fixed hanging bracket in Conf

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index bb04d94..169f9fe 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2147,8 +2147,6 @@ and customer address. Include units.',
   },
 
   {
-
-  {
     'key'         => 'show_ship_company',
     'section'     => 'UI',
     'description' => 'Turns on display/collection of a "service company name" field for customers.',

commit 0c2cb2d865f84d21032ebc9780118d44df4ddf26
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Feb 17 18:11:21 2015 -0600

    #14671: Usage for current day when billing outstanding usage (for cancelling customers) [various fixes to previous]

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 7678a02..fb3b0ff 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -901,7 +901,6 @@ sub cancel {
         return $error;
       }
     }
-
   } #unless $date
 
   my %hash = $self->hash;
@@ -936,9 +935,13 @@ sub cancel {
 
   foreach my $supp_pkg ( $self->supplemental_pkgs ) {
     if ($delay_cancel) {
-        $error = $supp_pkg->suspend(%options, 'from_main' => 1, 'reason' => undef);
+      $error = $supp_pkg->suspend(
+        'from_main'   => 1, 
+        'from_cancel' => 1,
+        'time'        => $cancel_time
+      );
     } else {
-        $error = $supp_pkg->cancel(%options, 'from_main' => 1);
+      $error = $supp_pkg->cancel(%options, 'from_main' => 1);
     }
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
@@ -946,11 +949,13 @@ sub cancel {
     }
   }
 
-  foreach my $usage ( $self->cust_pkg_usage ) {
-    $error = $usage->delete;
-    if ( $error ) {
-      $dbh->rollback if $oldAutoCommit;
-      return "deleting usage pools: $error";
+  unless ($date) {
+    foreach my $usage ( $self->cust_pkg_usage ) {
+      $error = $usage->delete;
+      if ( $error ) {
+        $dbh->rollback if $oldAutoCommit;
+        return "deleting usage pools: $error";
+      }
     }
   }
 
@@ -1249,6 +1254,9 @@ separately.
 =item from_main - allows a supplemental package to be suspended, rather
 than redirecting the method call to its main package.  For internal use.
 
+=item from_cancel - used when suspending from the cancel method, forces
+this to skip everything besides basic suspension.  For internal use.
+
 =back
 
 If there is an error, returns the error, otherwise returns false.
@@ -1291,7 +1299,7 @@ sub suspend {
   }
 
   # some false laziness with sub cancel
-  if ( !$options{nobill} && !$date &&
+  if ( !$options{nobill} && !$date && !$options{'from_cancel'} &&
        $self->part_pkg->option('bill_suspend_as_cancel',1) ) {
     # kind of a kludge--'bill_suspend_as_cancel' to avoid having to 
     # make the entire cust_main->bill path recognize 'suspend' and 
@@ -1356,17 +1364,19 @@ sub suspend {
 
   unless ( $date ) { # then we are suspending now
 
-    # credit remaining time if appropriate
-    # (if required by the package def, or the suspend reason)
-    my $unused_credit = $self->part_pkg->option('unused_credit_suspend',1)
-                        || ( defined($reason) && $reason->unused_credit );
+    unless ($options{'from_cancel'}) {
+      # credit remaining time if appropriate
+      # (if required by the package def, or the suspend reason)
+      my $unused_credit = $self->part_pkg->option('unused_credit_suspend',1)
+                          || ( defined($reason) && $reason->unused_credit );
 
-    if ( $unused_credit ) {
-      warn "crediting unused time on pkg#".$self->pkgnum."\n" if $DEBUG;
-      my $error = $self->credit_remaining('suspend', $suspend_time);
-      if ($error) {
-        $dbh->rollback if $oldAutoCommit;
-        return $error;
+      if ( $unused_credit ) {
+        warn "crediting unused time on pkg#".$self->pkgnum."\n" if $DEBUG;
+        my $error = $self->credit_remaining('suspend', $suspend_time);
+        if ($error) {
+          $dbh->rollback if $oldAutoCommit;
+          return $error;
+        }
       }
     }
 
@@ -1397,7 +1407,7 @@ sub suspend {
     }
 
     my $conf = new FS::Conf;
-    if ( $conf->config('suspend_email_admin') ) {
+    if ( $conf->config('suspend_email_admin') && !$options{'from_cancel'} ) {
  
       my $error = send_email(
         'from'    => $conf->config('invoice_from', $self->cust_main->agentnum),

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

Summary of changes:
 FS/FS/Conf.pm     |    2 --
 FS/FS/cust_pkg.pm |   50 ++++++++++++++++++++++++++++++--------------------
 2 files changed, 30 insertions(+), 22 deletions(-)




More information about the freeside-commits mailing list