diff options
author | ivan <ivan> | 2009-08-22 00:22:08 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-08-22 00:22:08 +0000 |
commit | beb9681db0ee4c0912c82849267a82dd434784b3 (patch) | |
tree | d1ed900e3b2319d5bfa8e16006c082c2f83b1faf /FS/FS/ClientAPI/MasonComponent.pm | |
parent | a22b55437cb9c2da2670c33b28dd521a1ef1a190 (diff) |
order svc_phone services from self-service too, RT#5085
Diffstat (limited to 'FS/FS/ClientAPI/MasonComponent.pm')
-rw-r--r-- | FS/FS/ClientAPI/MasonComponent.pm | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm index d158ce842..88baf0764 100644 --- a/FS/FS/ClientAPI/MasonComponent.pm +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -6,8 +6,9 @@ use subs qw( _cache ); use FS::Mason qw( mason_interps ); use FS::Conf; use FS::ClientAPI_SessionCache; -use FS::Record qw(qsearchs); +use FS::Record qw( qsearch qsearchs ); use FS::cust_main; +use FS::part_pkg; $DEBUG = 0; $me = '[FS::ClientAPI::MasonComponent]'; @@ -19,13 +20,17 @@ my %allowed_comps = map { $_=>1 } qw( /misc/phonenums.cgi /misc/states.cgi /misc/counties.cgi + /misc/svc_acct-domains.cgi + /misc/part_svc-columns.cgi ); my %session_comps = map { $_=>1 } qw( /elements/location.html + /edit/cust_main/first_pkg/select-part_pkg.html ); my %session_callbacks = ( + '/elements/location.html' => sub { my( $custnum, $argsref ) = @_; my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) @@ -35,6 +40,32 @@ my %session_callbacks = ( @$argsref = ( %args ); return ''; #no error }, + + '/edit/cust_main/first_pkg/select-part_pkg.html' => sub { + my( $custnum, $argsref ) = @_; + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or return "unknown custnum $custnum"; + + my $pkgpart = $cust_main->agent->pkgpart_hashref; + + #false laziness w/ edit/cust_main/first_pkg.html + my @first_svc = ( 'svc_acct', 'svc_phone' ); + + my @part_pkg = + grep { $_->svcpart(\@first_svc) + && ( $pkgpart->{ $_->pkgpart } + || ( $_->agentnum && $_->agentnum == $cust_main->agentnum ) + ) + } + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + + my %args = @$argsref; + $args{part_pkg} = \@part_pkg; + @$argsref = ( %args ); + return ''; #no error + + }, + ); my $outbuf; |