X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=a4032f3b1f00f9caa05820d65acc965824fcde21;hp=c376476c3284fe2e533c1e02e7d6b5ae0ad0e087;hb=3706609762d9cec964f337e74829031b895ddbac;hpb=81e426fe755eaea508041bc2d7b25ac44c777434 diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index c376476c3..a4032f3b1 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -1,7 +1,7 @@ package FS::ClientAPI::Signup; use strict; -use vars qw($DEBUG $me); +use vars qw( $DEBUG $me ); use Data::Dumper; use Tie::RefHash; use FS::Conf; @@ -90,7 +90,7 @@ sub signup_info { ], 'agent' => [ map { my $agent = $_; - map { $_ => $agent->get($_) } @agent_fields; + +{ map { $_ => $agent->get($_) } @agent_fields } } qsearch('agent', { 'disabled' => '' } ) ], @@ -111,6 +111,9 @@ sub signup_info { 'payby' => [ $conf->config('signup_server-payby') ], + 'payby_longname' => [ map { FS::payby->longname($_) } + $conf->config('signup_server-payby') ], + 'card_types' => card_types(), 'paytypes' => [ @FS::cust_main::paytypes ], @@ -338,6 +341,36 @@ sub signup_info { 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) ), + ( map { $_ => join("\n", $conf->config("selfservice-$_", $agentnum ) ) } + qw( head body_header body_footer ) ), + }; + + $cache->set("signup_info_cache_agent$agentnum", $signup_info_cache_agent); + + } + + $signup_info->{$_} = $signup_info_cache_agent->{$_} + foreach keys %$signup_info_cache_agent; + } # else { # delete $signup_info->{'part_pkg'}; @@ -619,14 +652,10 @@ sub new_customer { # " new customer: $bill_error" # if $bill_error; - if ($cust_main->_new_bop_required()) { - $bill_error = $cust_main->realtime_collect( - method => FS::payby->payby2bop( $packet->{payby} ), - depend_jobnum => $placeholder->jobnum, - ); - } else { - $bill_error = $cust_main->collect('realtime' => 1); - } + $bill_error = $cust_main->realtime_collect( + method => FS::payby->payby2bop( $packet->{payby} ), + depend_jobnum => $placeholder->jobnum, + ); #warn "[fs_signup_server] error collecting from new customer: $bill_error" # if $bill_error;