From beb9681db0ee4c0912c82849267a82dd434784b3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 22 Aug 2009 00:22:08 +0000 Subject: [PATCH] order svc_phone services from self-service too, RT#5085 --- FS/FS/ClientAPI/MasonComponent.pm | 33 +++++++++++- FS/FS/ClientAPI/MyAccount.pm | 2 +- FS/FS/Conf.pm | 7 +++ .../FS-SelfService/cgi/misc/part_svc-columns.cgi | 18 +++++++ .../FS-SelfService/cgi/misc/svc_acct-domains.cgi | 18 +++++++ fs_selfservice/FS-SelfService/cgi/order_pkg.html | 46 ++++------------ fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 61 +++++++++++++++++----- .../edit/cust_main/first_pkg/select-part_pkg.html | 14 +++-- httemplate/edit/cust_main/first_pkg/svc_acct.html | 40 ++++++++++++-- 9 files changed, 180 insertions(+), 59 deletions(-) create mode 100755 fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi create mode 100755 fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi 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; diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index b6934f8bd..e1d4c9225 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1110,7 +1110,7 @@ sub order_pkg { my %fields = ( 'svc_acct' => [ qw( username domsvc _password sec_phrase popnum ) ], 'svc_domain' => [ qw( domain ) ], - 'svc_phone' => [ qw( phonenum pin sip_password ) ], + 'svc_phone' => [ qw( phonenum pin sip_password phone_name ) ], 'svc_external' => [ qw( id title ) ], ); diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 1ee0214c2..d8e111b35 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3079,6 +3079,13 @@ worry that config_items is freeside-specific and icky. 'type' => 'checkbox', }, + { + 'key' => 'svc_acct-disable_access_number', + 'section' => 'UI', + 'descritpion' => 'Disable access number selection.', + 'type' => 'checkbox', + }, + { key => "apacheroot", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, { key => "apachemachines", section => "deprecated", description => "DEPRECATED", type => "text" }, diff --git a/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi b/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi new file mode 100755 index 000000000..4ee83ca96 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/part_svc-columns.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi b/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi new file mode 100755 index 000000000..c5413bac6 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/svc_acct-domains.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/order_pkg.html b/fs_selfservice/FS-SelfService/cgi/order_pkg.html index 9cdd4cd6c..4abfd8440 100644 --- a/fs_selfservice/FS-SelfService/cgi/order_pkg.html +++ b/fs_selfservice/FS-SelfService/cgi/order_pkg.html @@ -1,6 +1,6 @@