[freeside-commits] branch master updated. 46762f49fe399c99d2a42a9f7974ca059852fc75

Ivan ivan at 420.am
Tue Nov 17 17:32:46 PST 2015


The branch, master has been updated
       via  46762f49fe399c99d2a42a9f7974ca059852fc75 (commit)
      from  f32ac83068c6211f829f1688a1a9cdec71bc6ec7 (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 46762f49fe399c99d2a42a9f7974ca059852fc75
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Nov 17 17:32:45 2015 -0800

    magicmail option to use agent_custid, RT#38840

diff --git a/FS/FS/part_export/magicmail.pm b/FS/FS/part_export/magicmail.pm
index a39a4f5..ba76609 100644
--- a/FS/FS/part_export/magicmail.pm
+++ b/FS/FS/part_export/magicmail.pm
@@ -53,20 +53,22 @@ L</Error Methods>.  Use L</error> to retrieve this message.
 use vars qw( %info );
 
 tie my %options, 'Tie::IxHash',
-  'client_id'       => { label => 'API Client ID',
-                         default => '' },
-  'client_password' => { label => 'API Client Password',
-                         default => '' },
-  'account_prefix'  => { label => 'Account Prefix',
-                         default => 'FREESIDE' },
-  'package'         => { label => 'Package',
-                         default => 'EMAIL' },
-  'port'            => { label => 'Port',
-                         default => 443 },
-  'autopurge'       => { type => 'checkbox',
-                         label => 'Auto purge user/account on unprovision' },
-  'debug'           => { type => 'checkbox',
-                         label => 'Enable debug warnings' },
+  'client_id'        => { label => 'API Client ID',
+                          default => '' },
+  'client_password'  => { label => 'API Client Password',
+                          default => '' },
+  'account_prefix'   => { label => 'Account Prefix',
+                          default => 'FREESIDE' },
+  'package'          => { label => 'Package',
+                          default => 'EMAIL' },
+  'port'             => { label => 'Port',
+                          default => 443 },
+  'autopurge'        => { type => 'checkbox',
+                          label => 'Auto purge user/account on unprovision' },
+  'use_agent_custid' => { type => 'checkbox',
+                          label => 'Use agent_custid for Magicmail account_id when available' },
+  'debug'            => { type => 'checkbox',
+                          label => 'Enable debug warnings' },
 ;
 
 %info = (
@@ -397,7 +399,11 @@ Returns MagicMail account_id for this customer under this export.
 sub cust_account_id {
   my ($self, $in) = @_;
   my $cust_main = ref($in) eq 'FS::cust_main' ? $in : $in->cust_main;
-  return $self->option('account_prefix') . $cust_main->custnum;
+  return $self->option('account_prefix').
+         ( ($self->option('use_agent_custid') && $cust_main->agent_custid)
+             ? $cust_main->agent_custid
+             : $cust_main->custnum
+         );
 }
 
 =head2 cust_magic_services

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

Summary of changes:
 FS/FS/part_export/magicmail.pm |   36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)




More information about the freeside-commits mailing list