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]';
/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 } )
@$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;
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 ) ],
);
'type' => 'checkbox',
},
+ {
+ 'key' => 'svc_acct-disable_access_number',
+ 'section' => 'UI',
+ 'descritpion' => 'Disable access number selection.',
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
--- /dev/null
+#!/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;
+
--- /dev/null
+#!/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;
+
<SCRIPT TYPE="text/javascript">
function enable_order_pkg () {
- if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) {
+ if ( document.OrderPkgForm.pkgpart_svcpart.selectedIndex > 0 ) {
document.OrderPkgForm.submit.disabled = false;
} else {
document.OrderPkgForm.submit.disabled = true;
<INPUT TYPE="hidden" NAME="action" VALUE="process_order_pkg">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>">
<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
-<TR>
- <TD COLSPAN=2><SELECT NAME="pkgpart" onChange="enable_order_pkg()">
- <OPTION VALUE="">
-
- <%=
- foreach my $part_pkg ( @part_pkg ) {
- $OUT .= '<OPTION VALUE="'. $part_pkg->{'pkgpart'}. '"';
- $OUT .= ' SELECTED' if $pkgpart && $part_pkg->{'pkgpart'} == $pkgpart;
- $OUT .= '>'. $part_pkg->{'pkg'};
- }
- %>
- </SELECT></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Username</TD>
- <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Password</TD>
- <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $_password %>"></TD>
-</TR>
-<TR>
- <TD ALIGN="right">Re-enter Password</TD>
- <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $_password2 %>"></TD>
-</TR>
-<%=
- if ( $security_phrase ) {
- $OUT .= <<ENDOUT;
<TR>
- <TD ALIGN="right">Security Phrase</TD>
- <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
+ <TD COLSPAN=2>
+ <TABLE><TR><TD> <%= $pkg_selector %>
+
</TD>
</TR>
-ENDOUT
- } else {
- $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
- }
-%>
+
<%=
+ if ( 0 ) {
if ( @svc_acct_pop ) {
$OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
popselector( 'popnum' => $popnum,
} else {
$OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop);
}
+ }
+ '';
%>
</TABLE>
-<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" disabled>
+<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" DISABLED>
</FORM>
unprovision_svc change_pkg domainselector
list_svcs list_svc_usage list_cdr_usage list_support_usage
myaccount_passwd
+ mason_comp
);
$template_dir = '.';
my $customer_info = customer_info( 'session_id' => $session_id );
return $customer_info if ( $customer_info->{'error'} );
+ my $pkgselect = mason_comp(
+ 'session_id' => $session_id,
+ 'comp' => '/edit/cust_main/first_pkg/select-part_pkg.html',
+ 'args' => [ 'password_verify' => 1,
+ 'onchange' => 'enable_order_pkg()',
+ 'relurls' => 1,
+ 'empty_label' => 'Select package',
+ ],
+ );
+
+ $pkgselect = $pkgselect->{'error'} || $pkgselect->{'output'};
+
return {
( map { $_ => $init_data->{$_} }
qw( part_pkg security_phrase svc_acct_pop ),
),
%$customer_info,
+ 'pkg_selector' => $pkgselect,
};
}
my $results = '';
- unless ( length($cgi->param('_password')) ) {
- my $init_data = signup_info( 'customer_session_id' => $session_id );
- $results = { 'error' => $init_data->{msgcat}{empty_password} };
- $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ my @params = (qw( custnum pkgpart ));
+ my $svcdb = '';
+ if ( $cgi->param('pkgpart_svcpart') =~ /^(\d+)_(\d+)$/ ) {
+ $cgi->param('pkgpart', $1);
+ $cgi->param('svcpart', $2);
+ push @params, 'svcpart';
+ $svcdb = $cgi->param('svcdb');
+ push @params, 'domsvc' if $svcdb eq 'svc_acct';
+ } else {
+ $svcdb = 'svc_acct';
}
- if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
- my $init_data = signup_info( 'customer_session_id' => $session_id );
- $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} };
- $results = { 'error' => $init_data->{error} } if($init_data->{error});
- $cgi->param('_password', '');
- $cgi->param('_password2', '');
+
+ if ( $svcdb eq 'svc_acct' ) {
+
+ push @params, qw( username _password _password2 sec_phrase popnum );
+
+ unless ( length($cgi->param('_password')) ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{empty_password} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ }
+ if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ $cgi->param('_password', '');
+ $cgi->param('_password2', '');
+ }
+
+ } elsif ( $svcdb eq 'svc_phone' ) {
+
+ push @params, qw( phonenum sip_password pin phone_name );
+
+ } else {
+ die "$svcdb not handled on process_order_pkg yet";
}
$results ||= order_pkg (
'session_id' => $session_id,
- map { $_ => $cgi->param($_) }
- qw( custnum pkgpart username _password _password2 sec_phrase popnum )
+ map { $_ => $cgi->param($_) } @params
);
<% include('/elements/xmlhttp.html',
- 'url' => $p.'misc/svc_acct-domains.cgi',
+ 'url' => $url_prefix.'misc/svc_acct-domains.cgi',
'subs' => [ $opt{'prefix'}. 'get_domains' ],
)
%>
<% include('/elements/xmlhttp.html',
- 'url' => $p.'misc/part_svc-columns.cgi',
+ 'url' => $url_prefix.'misc/part_svc-columns.cgi',
'subs' => [ $opt{'prefix'}. 'get_part_svc' ],
)
%>
+<INPUT TYPE="hidden" NAME="svcdb" VALUE="">
+
<SCRIPT TYPE="text/javascript">
function selopt(what,value,text,selected) {
function <% $opt{'prefix'} %>pkgpart_svcpart_changed_too(what,selected) {
+ <% $opt{'onchange'} %>;
+
pkgpart_svcpart = what.options[what.selectedIndex].value;
var svcdb = pkgpart_svcpart2svcdb[pkgpart_svcpart];
+ what.form.svcdb.value = svcdb;
+
if ( svcdb == 'svc_acct' ) {
// go get the new domains
}
$opt{saved_domsvc} = 0 unless $opt{saved_domsvc};
+my $url_prefix = $opt{'relurls'} ? '' : $p;
+
my @part_pkg = @{$opt{'part_pkg'}};
my @first_svc = ( 'svc_acct', 'svc_phone' );
}
my @options = ( '', map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg );
-my %labels = ( '' => '(none)',
+my %labels = ( '' => ( $opt{'empty_label'} || '(none)' ),
map { $pkgpart_svcpart{ $_->pkgpart } => $_->pkg_comment }
@part_pkg
);
VALUE = "<% $opt{'password'} %>"
SIZE = <% $pmax2 %>
MAXLENGTH = <% $passwordmax %>>
- (blank to generate)
+% unless ( $opt{'password_verify'} ) {
+ (blank to generate)
+% }
</TD>
</TR>
- <TR>
- <TD ALIGN="right">Access number</TD>
- <TD><% FS::svc_acct_pop::popselector($opt{'popnum'}) %></TD>
- </TR>
+% if ( $opt{'password_verify'} ) {
+ <TR>
+ <TD ALIGN="right">Re-enter Password</TD>
+ <TD>
+ <INPUT TYPE = "text"
+ NAME = "_password2"
+ VALUE = "<% $opt{'password2'} %>"
+ SIZE = <% $pmax2 %>
+ MAXLENGTH = <% $passwordmax %>>
+ </TD>
+ </TR>
+% }
+
+% if ( $conf->exists('security_phrase') ) {
+ <TR>
+ <TD ALIGN="right">Security Phrase</TD>
+ <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="<% $opt{'sec_phrase'} %>">
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">
+% }
+
+% if ( $conf->exists('svc_acct-disable_access_number') ) {
+ <INPUT TYPE="hidden" NAME="popnum" VALUE="">
+% } else {
+ <TR>
+ <TD ALIGN="right">Access number</TD>
+%# XXX should gain "area code" selection and labels on the dropdowns
+ <TD><% FS::svc_acct_pop::popselector($opt{'popnum'}) %></TD>
+ </TR>
+% }
</TABLE>