[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 7a4799ade451508cea6423ac2a90d3b1b1c0f1e0

Mike Robinson miker at 420.am
Thu Apr 26 13:55:12 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  7a4799ade451508cea6423ac2a90d3b1b1c0f1e0 (commit)
       via  6eac2876e787aa44191f9af04ac3124aa92634c5 (commit)
       via  fbccbd7eee2aec970e9637af543826c1e4303475 (commit)
      from  03cd85038089d04b3cd68db559ce24696e0ffbba (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 7a4799ade451508cea6423ac2a90d3b1b1c0f1e0
Author: Mike Robinson <miker at freeside.biz>
Date:   Thu Apr 26 12:21:24 2012 -0500

    pkg_dundate_age condition (#17394)

diff --git a/FS/FS/part_event/Condition/pkg_dundate_age.pm b/FS/FS/part_event/Condition/pkg_dundate_age.pm
new file mode 100644
index 0000000..2ea2a20
--- /dev/null
+++ b/FS/FS/part_event/Condition/pkg_dundate_age.pm
@@ -0,0 +1,43 @@
+package FS::part_event::Condition::pkg_dundate_age;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description {
+  "Skip until specified #days before package suspension delay date";
+}
+
+
+sub option_fields {
+  (
+    'age'     => { 'label'      => 'Time before suspension delay date',
+                   'type'       => 'freq',
+                 },
+  );
+}
+
+sub eventtable_hashref {
+  { 'cust_main' => 0,
+    'cust_bill' => 0,
+    'cust_pkg'  => 1,
+  };
+}
+
+sub condition {
+  my($self, $cust_pkg, %opt) = @_;
+
+  my $age = $self->option_age_from('age', $opt{'time'} );
+
+  $cust_pkg->dundate <= $age;
+}
+
+sub condition_sql {
+  my( $class, $table, %opt ) = @_;
+  return 'true' unless $table eq 'cust_pkg';
+  
+  my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
+  
+  "COALESCE($table.dundate,0) <= ". $age;
+}
+
+1;

commit 6eac2876e787aa44191f9af04ac3124aa92634c5
Author: Mike Robinson <miker at freeside.biz>
Date:   Wed Apr 25 16:59:55 2012 -0500

    Don't default 'payname' to first/last name if paying by check. (#15819)
    
    In this case, 'payname' is the name of the financial institution and
    there is no default.

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 7bc3011..e9394e4 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -729,7 +729,7 @@ sub payment_info {
     $return{payinfo2} = $payinfo2;
     $return{paytype}  = $cust_main->paytype;
     $return{paystate} = $cust_main->paystate;
-
+    $return{payname}  = $cust_main->payname;	# override 'first/last name' default from above, if any.  Is instution-name here.  (#15819)
   }
 
   if ( $conf->config('prepayment_discounts-credit_type') ) {

commit fbccbd7eee2aec970e9637af543826c1e4303475
Author: Mike Robinson <miker at freeside.biz>
Date:   Wed Apr 25 16:17:50 2012 -0500

    E-mail for un-suspension. (#16144)

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 0473864..c195e4f 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3957,6 +3957,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'unsuspend_email_admin',
+    'section'     => '',
+    'description' => 'Destination admin email address to enable unsuspension notices',
+    'type'        => 'text',
+  },
+  
+  {
     'key'         => 'email_report-subject',
     'section'     => '',
     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
diff --git a/FS/FS/Conf_compat17.pm b/FS/FS/Conf_compat17.pm
index 6685935..2e4bb05 100644
--- a/FS/FS/Conf_compat17.pm
+++ b/FS/FS/Conf_compat17.pm
@@ -2458,6 +2458,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'unsuspend_email_admin',
+    'section'     => '',
+    'description' => 'Destination admin email address to enable unsuspension notices',
+    'type'        => 'text',
+  },
+  
+  {
     'key'         => 'email_report-subject',
     'section'     => '',
     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 719189f..652c4d5 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -1176,6 +1176,8 @@ sub unsuspend {
   
   } #if $date 
 
+  my @labels = ();
+
   foreach my $cust_svc (
     qsearch('cust_svc',{'pkgnum'=> $self->pkgnum } )
   ) {
@@ -1195,6 +1197,8 @@ sub unsuspend {
         $dbh->rollback if $oldAutoCommit;
         return $error;
       }
+      my( $label, $value ) = $cust_svc->label;
+      push @labels, "$label: $value";
     }
 
   }
@@ -1283,6 +1287,29 @@ sub unadjourn {
     return $error;
   }
 
+  if ( $conf->config('unsuspend_email_admin') ) {
+ 
+    my $error = send_email(
+      'from'    => $conf->config('invoice_from', $self->cust_main->agentnum),
+                                 #invoice_from ??? well as good as any
+      'to'      => $conf->config('unsuspend_email_admin'),
+      'subject' => 'FREESIDE NOTIFICATION: Customer package unsuspended',       'body'    => [
+        "This is an automatic message from your Freeside installation\n",
+        "informing you that the following customer package has been unsuspended:\n",
+        "\n",
+        'Customer: #'. $self->custnum. ' '. $self->cust_main->name. "\n",
+        'Package : #'. $self->pkgnum. " (". $self->part_pkg->pkg_comment. ")\n",
+        ( map { "Service : $_\n" } @labels ),
+      ],
+    );
+
+    if ( $error ) {
+      warn "WARNING: can't send unsuspension admin email (unsuspending anyway): ".
+           "$error\n";
+    }
+
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 
   ''; #no errors

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                  |    2 +-
 FS/FS/Conf.pm                                 |    7 ++++
 FS/FS/Conf_compat17.pm                        |    7 ++++
 FS/FS/cust_pkg.pm                             |   27 +++++++++++++++
 FS/FS/part_event/Condition/pkg_dundate_age.pm |   43 +++++++++++++++++++++++++
 5 files changed, 85 insertions(+), 1 deletions(-)
 create mode 100644 FS/FS/part_event/Condition/pkg_dundate_age.pm




More information about the freeside-commits mailing list