[freeside-commits] branch master updated. 07f2ee893fc57164ae3672f1a494d395c4eb1d26

Jonathan Prykop jonathan at 420.am
Thu Jan 29 17:39:28 PST 2015


The branch, master has been updated
       via  07f2ee893fc57164ae3672f1a494d395c4eb1d26 (commit)
      from  8f695e657e4f97cbf9ebbf99c3c2dd24bb9aea2f (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 07f2ee893fc57164ae3672f1a494d395c4eb1d26
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Jan 29 19:39:01 2015 -0600

    RT#30613: Can't Send E-mail [Upgrade improvements]

diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 5d092ed..f84e4e5 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -46,22 +46,6 @@ sub upgrade_config {
 
   my $conf = new FS::Conf;
 
-  if ($conf->config('invoice_from') =~ /\<(.*)\>/) {
-    my $realemail = $1;
-    $realemail =~ s/^\s*//; # remove leading spaces
-    $realemail =~ s/\s*$//; # remove trailing spaces
-    my $realname = $conf->config('invoice_from');
-    $realname =~ s/\<.*\>//; # remove email address
-    $realname =~ s/^\s*//; # remove leading spaces
-    $realname =~ s/\s*$//; # remove trailing spaces
-    # properly quote names that contain punctuation
-    if (($realname =~ /[^[:alnum:][:space:]]/) && ($realname !~ /^\".*\"$/)) {
-      $realname = '"' . $realname . '"';
-    }
-    $conf->set('invoice_from_name', $realname);
-    $conf->set('invoice_from', $realemail);
-  }
-
   $conf->touch('payment_receipt')
     if $conf->exists('payment_receipt_email')
     || $conf->config('payment_receipt_msgnum');
@@ -79,8 +63,15 @@ sub upgrade_config {
     }
   }
 
+  my @agents = qsearch('agent', {});
+
   upgrade_overlimit_groups($conf);
-  map { upgrade_overlimit_groups($conf,$_->agentnum) } qsearch('agent', {});
+  map { upgrade_overlimit_groups($conf,$_->agentnum) } @agents;
+
+  upgrade_invoice_from($conf);
+  foreach my $agent (@agents) {
+    upgrade_invoice_from($conf,$agent->agentnum);
+  }
 
   my $DIST_CONF = '/usr/local/etc/freeside/default_conf/';#DIST_CONF in Makefile
   $conf->set($_, scalar(read_file( "$DIST_CONF/$_" )) )
@@ -183,6 +174,28 @@ sub upgrade_overlimit_groups {
     }
 }
 
+sub upgrade_invoice_from {
+  my ($conf, $agentnum) = @_;
+  if (
+      (!$conf->config('invoice_from_name',$agentnum)) && 
+      ($conf->config('invoice_from',$agentnum) =~ /\<(.*)\>/)
+  ) {
+    my $realemail = $1;
+    $realemail =~ s/^\s*//; # remove leading spaces
+    $realemail =~ s/\s*$//; # remove trailing spaces
+    my $realname = $conf->config('invoice_from',$agentnum);
+    $realname =~ s/\<.*\>//; # remove email address
+    $realname =~ s/^\s*//; # remove leading spaces
+    $realname =~ s/\s*$//; # remove trailing spaces
+    # properly quote names that contain punctuation
+    if (($realname =~ /[^[:alnum:][:space:]]/) && ($realname !~ /^\".*\"$/)) {
+      $realname = '"' . $realname . '"';
+    }
+    $conf->set('invoice_from_name', $realname, $agentnum);
+    $conf->set('invoice_from', $realemail, $agentnum);
+  }
+}
+
 =item upgrade
 
 =cut


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

Summary of changes:
 FS/FS/Upgrade.pm |   47 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list