X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=faf377874f3e4d84ea3e9ce283a67101db730015;hb=19045b18ba6413064a82c5453ac62125b3bb73f4;hp=3364b97df92e0ee68f2cac1c819a2361e4537535;hpb=f9060f8300336b1fc792602a56308e883c27f3aa;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 3364b97df..faf377874 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -45,7 +45,7 @@ use FS::payby; use FS::acct_rt_transaction; use FS::msg_template; -$DEBUG = 0; +$DEBUG = 1; $me = '[FS::ClientAPI::MyAccount]'; use vars qw( @cust_main_editable_fields @location_editable_fields ); @@ -121,6 +121,7 @@ sub skin_info { font title_color title_align title_size menu_bgcolor menu_fontsize ) ), + 'menu_disable' => [ $conf->config('selfservice-menu_disable',$agentnum) ], ( map { $_ => $conf->exists("selfservice-$_", $agentnum ) } qw( menu_skipblanks menu_skipheadings menu_nounderline no_logo ) ), @@ -391,12 +392,13 @@ sub customer_info { $return{balance} = $cust_main->balance; $return{next_bill_date} = $cust_main->next_bill_date; $return{next_bill_date_pretty} = - time2str('%m/%d/%Y', $return{next_bill_date} ); + $return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} ) + : '(none)'; } my @tickets = $cust_main->tickets; # unavoidable false laziness w/ httemplate/view/cust_main/tickets.html - if ( FS::TicketSystem->selfservice_priority ) { + if ( $FS::TicketSystem::system && FS::TicketSystem->selfservice_priority ) { my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1; $return{tickets} = [ sort { @@ -621,7 +623,8 @@ sub billing_history { $return{balance} = $cust_main->balance; $return{next_bill_date} = $cust_main->next_bill_date; $return{next_bill_date_pretty} = - time2str('%m/%d/%Y', $return{next_bill_date} ); + $return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} ) + : '(none)'; my @history = (); @@ -1584,7 +1587,10 @@ sub list_pkgs { pkg_label => $_->pkg_label, status => $_->status, part_svc => - [ map $_->hashref, $_->available_part_svc ], + [ map { $_->hashref } + grep { $_->selfservice_access ne 'hidden' } + $_->available_part_svc + ], cust_svc => [ map { my $ref = { $_->hash, label => [ $_->label ], @@ -1598,7 +1604,9 @@ sub list_pkgs { $ref->{svchash}->{svcpart} = $_->part_svc->svcpart if $_->part_svc->svcdb eq 'svc_phone'; # hack $ref; - } $_->cust_svc + } + grep { $_->part_svc->selfservice_access ne 'hidden' } + $_->cust_svc ], primary_cust_svc => $primary_cust_svc @@ -1780,8 +1788,14 @@ sub svc_status_hash { } -sub set_svc_status_hash { - my $p = shift; +sub set_svc_status_hash { _svc_method_X(shift, 'export_setstatus') } +sub set_svc_status_listadd { _svc_method_X(shift, 'export_setstatus_listadd') } +sub set_svc_status_listdel { _svc_method_X(shift, 'export_setstatus_listdel') } +sub set_svc_status_vacationadd { _svc_method_X(shift, 'export_setstatus_vacationadd') } +sub set_svc_status_vacationdel { _svc_method_X(shift, 'export_setstatus_vacationdel') } + +sub _svc_method_X { + my( $p, $method ) = @_; my($context, $session, $custnum) = _custoragent_session_custnum($p); return { 'error' => $session } if $context eq 'error'; @@ -1790,16 +1804,15 @@ sub set_svc_status_hash { my $svc_x = _customer_svc_x( $custnum, $p->{'svcnum'}, 'svc_acct') or return { 'error' => "Service not found" }; - warn "set_svc_status_hash ". join(' / ', map "$_=>".$p->{$_}, keys %$p ) + warn "$method ". join(' / ', map "$_=>".$p->{$_}, keys %$p ) if $DEBUG; - my $error = $svc_x->export_setstatus($p); #$p? returns error? + my $error = $svc_x->$method($p); #$p? returns error? return { 'error' => $error } if $error; return {}; #? { 'error' => '' } } - sub acct_forward_info { my $p = shift;