diff options
| author | ivan <ivan> | 2011-09-28 01:02:27 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2011-09-28 01:02:27 +0000 | 
| commit | 9c4526fcca8fcf9bd836780611c52afd62247866 (patch) | |
| tree | 17b294c5ff2caf851f894beccf86cdafb2b91c28 | |
| parent | 1ea34a10ac52048e196041de7793c82500335db0 (diff) | |
add self-service customer_info_short call to improve uniserve portal perf, RT#13656
| -rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 64 | ||||
| -rw-r--r-- | FS/FS/ClientAPI_XMLRPC.pm | 3 | ||||
| -rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 1 | 
3 files changed, 68 insertions, 0 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index fc9e12459..74c4b3351 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -443,6 +443,70 @@ sub customer_info {  } +sub customer_info_short { +  my $p = shift; + +  my($context, $session, $custnum) = _custoragent_session_custnum($p); +  return { 'error' => $session } if $context eq 'error'; + +  my %return; + +  my $conf = new FS::Conf; + +  if ( $custnum ) { #customer record + +    my $search = { 'custnum' => $custnum }; +    $search->{'agentnum'} = $session->{'agentnum'} if $context eq 'agent'; +    my $cust_main = qsearchs('cust_main', $search ) +      or return { 'error' => "unknown custnum $custnum" }; + +    $return{small_custview} = +      small_custview( $cust_main, +                      scalar($conf->config('countrydefault')), +                      1, ##nobalance +                    ); + +    $return{name} = $cust_main->first. ' '. $cust_main->get('last'); + +    $return{payby} = $cust_main->payby; + +    #none of these are terribly expensive if we want 'em... +    #for (@cust_main_editable_fields) { +    #  $return{$_} = $cust_main->get($_); +    #} +    # +    #if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { +    #  $return{payinfo} = $cust_main->paymask; +    #  @return{'month', 'year'} = $cust_main->paydate_monthyear; +    #} +    # +    #$return{'invoicing_list'} = +    #  join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list ); +    #$return{'postal_invoicing'} = +    #  0 < ( grep { $_ eq 'POST' } $cust_main->invoicing_list ); + +    if ( $session->{'svcnum'} ) { +      my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $session->{'svcnum'} }); +      $return{'svc_label'} = ($cust_svc->label)[1] if $cust_svc; +    } + +  } elsif ( $session->{'svcnum'} ) { #no customer record + +    #uuh, not supproted yet... die? +    return { 'error' => 'customer_info_short not yet supported as agent' }; + +  } else { + +    return { 'error' => 'Expired session' }; #XXX redirect to login w/this err! + +  } + +  return { 'error'          => '', +           'custnum'        => $custnum, +           %return, +         }; +} +  sub edit_info {    my $p = shift;    my $session = _cache->get($p->{'session_id'}) diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm index 33638f840..b077bf27a 100644 --- a/FS/FS/ClientAPI_XMLRPC.pm +++ b/FS/FS/ClientAPI_XMLRPC.pm @@ -67,6 +67,7 @@ sub ss2clientapi {    'login'                     => 'MyAccount/login',    'logout'                    => 'MyAccount/logout',    'customer_info'             => 'MyAccount/customer_info', +  'customer_info_short'       => 'MyAccount/customer_info_short',    'edit_info'                 => 'MyAccount/edit_info',     #add to ss cgi!    'invoice'                   => 'MyAccount/invoice',    'invoice_pdf'               => 'MyAccount/invoice_pdf', @@ -76,6 +77,8 @@ sub ss2clientapi {    'payment_info'              => 'MyAccount/payment_info',    'payment_info_renew_info'   => 'MyAccount/payment_info_renew_info',    'process_payment'           => 'MyAccount/process_payment', +  'store_payment'             => 'MyAccount/store_payment', +  'process_stored_payment'    => 'MyAccount/process_stored_payment',    'process_payment_order_pkg' => 'MyAccount/process_payment_order_pkg',    'process_payment_change_pkg' => 'MyAccount/process_payment_change_pkg',    'process_payment_order_renew' => 'MyAccount/process_payment_order_renew', diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index ec23ba713..e778f79c2 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -29,6 +29,7 @@ $socket .= '.'.$tag if defined $tag && length($tag);    'login'                     => 'MyAccount/login',    'logout'                    => 'MyAccount/logout',    'customer_info'             => 'MyAccount/customer_info', +  'customer_info_short'       => 'MyAccount/customer_info_short',    'edit_info'                 => 'MyAccount/edit_info',     #add to ss cgi!    'invoice'                   => 'MyAccount/invoice',    'invoice_pdf'               => 'MyAccount/invoice_pdf',  | 
