- 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");
+
+ if ( $signup_info_cache_agent ) {
+
+ warn "$me loading cached signup info for agentnum $agentnum\n"
+ if $DEBUG > 1;
+
+ } else {
+
+ warn "$me populating signup info cache for agentnum $agentnum\n"
+ if $DEBUG > 1;
+
+ $signup_info_cache_agent = {
+ #( map { $_ => scalar( $conf->config($_, $agentnum) ) }
+ # qw( company_name ) ),
+ ( map { $_ => scalar( $conf->config("selfservice-$_", $agentnum ) ) }
+ qw( body_bgcolor box_bgcolor menu_bgcolor ) ),
+ ( map { $_ => join("\n", $conf->config("selfservice-$_", $agentnum ) ) }
+ qw( head body_header body_footer ) ),
+ ( map { $_ => join("\n", $conf->config("signup_server-$_", $agentnum ) ) }
+ qw( terms_of_service ) ),
+
+ ( map { $_ => scalar($conf->exists($_, $agentnum)) }
+ 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 $location = $cust_main->ship_location;
+ $signup_info_cache_agent->{"ship_$_"} = $location->get($_)
+ foreach qw( address1 city county state zip country );
+
+ }
+
+ $cache->set("signup_info_cache_agent$agentnum", $signup_info_cache_agent);
+