X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=9533d6a7350e67ce07af3fadec497affc1dd16f5;hb=33c725fc1419daeb11b818d12ac6cd7ec499c310;hp=30fafea1b73c160cfdd890616ef48c077809762d;hpb=3a7508e3323f211abfbacf176b66a6dc4f538d55;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 30fafea1b..9533d6a73 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -44,13 +44,23 @@ $me = '[FS::ClientAPI::MyAccount]'; use vars qw( @cust_main_editable_fields ); @cust_main_editable_fields = qw( first last company address1 address2 city - county state zip country daytime night fax + county state zip country + daytime night fax mobile ship_first ship_last ship_company ship_address1 ship_address2 ship_city - ship_state ship_zip ship_country ship_daytime ship_night ship_fax + ship_state ship_zip ship_country + ship_daytime ship_night ship_fax ship_mobile + locale payby payinfo payname paystart_month paystart_year payissue payip ss paytype paystate stateid stateid_state ); +BEGIN { #preload to reduce time customer_info takes + if ( $FS::TicketSystem::system ) { + warn "$me: initializing ticket system\n" if $DEBUG; + FS::TicketSystem->init(); + } +} + sub _cache { $cache ||= new FS::ClientAPI_SessionCache( { 'namespace' => 'FS::ClientAPI::MyAccount', @@ -378,6 +388,7 @@ sub customer_info { ); $return{name} = $cust_main->first. ' '. $cust_main->get('last'); + $return{ship_name} = $cust_main->ship_first. ' '. $cust_main->get('ship_last'); for (@cust_main_editable_fields) { $return{$_} = $cust_main->get($_); @@ -422,6 +433,7 @@ sub customer_info { if ( $session->{'svcnum'} ) { my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $session->{'svcnum'} }); $return{'svc_label'} = ($cust_svc->label)[1] if $cust_svc; + $return{'svcnum'} = $session->{'svcnum'}; } } elsif ( $session->{'svcnum'} ) { #no customer record @@ -467,27 +479,29 @@ sub customer_info_short { ); $return{name} = $cust_main->first. ' '. $cust_main->get('last'); + $return{ship_name} = $cust_main->ship_first. ' '. $cust_main->get('ship_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 ); + 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; + $return{'svcnum'} = $session->{'svcnum'}; } } elsif ( $session->{'svcnum'} ) { #no customer record @@ -2134,6 +2148,11 @@ sub myaccount_passwd { } ) or return { 'error' => "Service not found" }; + if ( exists($p->{'old_password'}) ) { + return { 'error' => "Incorrect password." }; + unless $svc_acct->check_password($p->{'old_password'}); + } + $svc_acct->_password($p->{'new_password'}); my $error = $svc_acct->replace();