[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 62b2133f1011cfdc0f0d06a37a04d5f478a7f602

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


The branch, FREESIDE_2_3_BRANCH has been updated
       via  62b2133f1011cfdc0f0d06a37a04d5f478a7f602 (commit)
      from  a418fce5ab016bebfe456f1fa50053452006c422 (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 62b2133f1011cfdc0f0d06a37a04d5f478a7f602
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Feb 28 17:35:25 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 0840090..624ea1a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2883,6 +2883,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