[freeside-commits] branch master updated. 0924aec8b98b4056357bfdd19f45686a3e9008e2

Mark Wells mark at 420.am
Tue Feb 28 17:36:03 PST 2012


The branch, master has been updated
       via  0924aec8b98b4056357bfdd19f45686a3e9008e2 (commit)
      from  d5cdad7fae9c5e45701a7e83abeb903d31b7983f (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 0924aec8b98b4056357bfdd19f45686a3e9008e2
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Feb 28 17:35:56 2012 -0800

    per-agent agent-ship_address config, #6678

diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index d0d088a..f17752a 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -185,7 +185,6 @@ sub signup_info {
       'signup_service'     => $svc_x,
       'company_name'       => scalar($conf->config('company_name')),
       #per-agent?
-      'agent_ship_address' => scalar($conf->exists('agent-ship_address')),
       'logo'               => scalar($conf->config_binary('logo.png')),
       'prepaid_template_custnum' => $conf->exists('signup_server-prepaid-template-custnum'),
     };
@@ -374,13 +373,6 @@ sub signup_info {
 
     $signup_info->{'company_name'} = $conf->config('company_name', $agentnum);
 
-    if ( $signup_info->{'agent_ship_address'} && $agent->agent_custnum ) {
-      my $cust_main = $agent->agent_cust_main;
-      my $prefix = length($cust_main->ship_last) ? 'ship_' : '';
-      $signup_info->{"ship_$_"} = $cust_main->get("$prefix$_")
-        foreach qw( address1 city county state zip country );
-    }
-
     #some of the above could probably be cached, too
 
     my $signup_info_cache_agent = $cache->get("signup_info_cache_agent$agentnum");
@@ -406,9 +398,19 @@ sub signup_info {
           qw( terms_of_service ) ),
 
         ( map { $_ => scalar($conf->exists($_, $agentnum)) } 
-          qw(cust_main-require_phone) ),
+          qw(cust_main-require_phone agent-ship_address) ),
       };
 
+      if ( $signup_info_cache_agent->{'agent-ship_address'} 
+           && $agent->agent_cust_main ) {
+
+        my $cust_main = $agent->agent_cust_main;
+        my $prefix = length($cust_main->ship_last) ? 'ship_' : '';
+        $signup_info_cache_agent->{"ship_$_"} = $cust_main->get("$prefix$_")
+          foreach qw( address1 city county state zip country );
+
+      }
+
       $cache->set("signup_info_cache_agent$agentnum", $signup_info_cache_agent);
 
     }
@@ -576,7 +578,9 @@ sub new_customer {
   }
 
   my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
-  if ( $conf->exists('agent_ship_address') && $agent->agent_custnum ) {
+  if ( $conf->exists('agent-ship_address', $agentnum) 
+    && $agent->agent_custnum ) {
+
     my $agent_cust_main = $agent->agent_cust_main;
     my $prefix = length($agent_cust_main->ship_last) ? 'ship_' : '';
     $cust_main->set("ship_$_", $agent_cust_main->get("$prefix$_") )
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 38a6894..d84ca00 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2898,6 +2898,7 @@ and customer address. Include units.',
     'section'     => '',
     'description' => "Use the agent's master service address as the service address (only ship_address2 can be entered, if blank on the master address).  Useful for multi-tenant applications.",
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   { 'key'         => 'referral_credit',

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

Summary of changes:
 FS/FS/ClientAPI/Signup.pm |   24 ++++++++++++++----------
 FS/FS/Conf.pm             |    1 +
 2 files changed, 15 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list