summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
authorlevinse <levinse>2010-12-21 06:26:16 +0000
committerlevinse <levinse>2010-12-21 06:26:16 +0000
commit8ff8367c3806c5eb56b604bf55f67db177cf0bda (patch)
tree86eebd42f80699b955d57f39644d6d6b84017aac /fs_selfservice
parent42638dec45ee1f2f8a2bb4e147d1a8ea171629b5 (diff)
self-service improvements: DIDs, RT10885
Diffstat (limited to 'fs_selfservice')
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm1
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount_menu.html4
-rw-r--r--fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html17
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi37
-rw-r--r--fs_selfservice/FS-SelfService/cgi/ws_list.html28
5 files changed, 76 insertions, 11 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index b992ac941..fe2feb3c1 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -57,6 +57,7 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'charge' => 'MyAccount/charge', #?
'part_svc_info' => 'MyAccount/part_svc_info',
'provision_acct' => 'MyAccount/provision_acct',
+ 'provision_phone' => 'MyAccount/provision_phone',
'provision_external' => 'MyAccount/provision_external',
'unprovision_svc' => 'MyAccount/unprovision_svc',
'myaccount_passwd' => 'MyAccount/myaccount_passwd',
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 1f448a104..4036432aa 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -28,7 +28,7 @@ if ( 1 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eve
#XXXFIXME still a bit sloppy for multi-gateway of differing namespace
my $i = 0;
while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CARD/; $i++ }
- if ( $cust_paybys[$i] =~ /^CARD/ ) {
+ if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CARD/ ) {
push @menu, { title => 'Recharge my account with a credit card',
url => $hide_payment_fields[$i]
? 'make_thirdparty_payment&payby_method=CC'
@@ -39,7 +39,7 @@ if ( 1 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eve
$i = 0;
while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CHEK/; $i++ }
- if ( $cust_paybys[$i] =~ /^CHEK/ ) {
+ if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CHEK/ ) {
push @menu, { title => 'Recharge my account with a check',
url => $hide_payment_fields[$i]
? 'make_thirdparty_payment&payby_method=ECHECK'
diff --git a/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html b/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html
new file mode 100644
index 000000000..6baa1e6fe
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html
@@ -0,0 +1,17 @@
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('header', 'Setup phone number') %>
+
+<FORM name="OneTrueForm" action="<%= $url %>" METHOD="POST">
+<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
+<INPUT TYPE="hidden" NAME="action" VALUE="process_svc_phone">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $svcpart %>">
+<%= didselector('field' => 'phonenum',
+ 'svcpart' => $svcpart,
+ 'bulknum' => $numavail,
+ );
+%>
+<BR><BR><INPUT TYPE="submit" VALUE="Setup">
+</FORM>
+
+<%= include('footer') %>
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 72e49b47c..1f8e55025 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -13,7 +13,7 @@ use FS::SelfService qw(
access_info login_info login customer_info edit_info invoice
payment_info process_payment realtime_collect process_prepay
list_pkgs order_pkg signup_info order_recharge
- part_svc_info provision_acct provision_external
+ part_svc_info provision_acct provision_external provision_phone
unprovision_svc change_pkg suspend_pkg domainselector
list_svcs list_svc_usage list_cdr_usage list_support_usage
myaccount_passwd list_invoices create_ticket get_ticket did_report
@@ -73,7 +73,7 @@ $session_id = $cgi->param('session');
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|tktcreate|tktview|didreport|invoices|view_invoice|make_payment|make_ach_payment|make_term_payment|make_thirdparty_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|customer_order_pkg|process_order_pkg|customer_change_pkg|process_change_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage|view_usage_details|view_cdr_details|view_support_details|change_password|process_change_password|customer_suspend_pkg|process_suspend_pkg)$/
+ /^(myaccount|tktcreate|tktview|didreport|invoices|view_invoice|make_payment|make_ach_payment|make_term_payment|make_thirdparty_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|customer_order_pkg|process_order_pkg|customer_change_pkg|process_change_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_phone|process_svc_external|delete_svc|view_usage|view_usage_details|view_cdr_details|view_support_details|change_password|process_change_password|customer_suspend_pkg|process_suspend_pkg)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -649,6 +649,34 @@ sub provision_svc {
or die 'Unknown svcdb '. $result->{'svcdb'};
$action .= "_$1";
+ $result->{'numavail'} = $cgi->param('numavail');
+
+ $result;
+}
+
+sub process_svc_phone {
+ my @bulkdid = $cgi->param('bulkdid');
+ my $phonenum = $cgi->param('phonenum');
+
+ my $result = provision_phone (
+ 'session_id' => $session_id,
+ 'bulkdid' => [ @bulkdid ],
+ 'countrycode' => '1',
+ map { $_ => $cgi->param($_) } qw( pkgnum svcpart phonenum )
+ );
+
+ if ( exists $result->{'error'} && $result->{'error'} ) {
+ $action = 'provision_svc_phone';
+ return {
+ $cgi->Vars,
+ %{ part_svc_info( 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) } qw( pkgnum svcpart )
+ )
+ },
+ 'error' => $result->{'error'},
+ };
+ }
+
$result;
}
@@ -818,9 +846,10 @@ sub do_template {
package FS::SelfService::_selfservicecgi;
-#use FS::SelfService qw(regionselector expselect popselector);
use HTML::Entities;
-use FS::SelfService qw(regionselector popselector domainselector location_form);
+use FS::SelfService qw(
+ regionselector popselector domainselector location_form didselector
+);
#false laziness w/agent.cgi
use vars qw(@INCLUDE_ARGS);
diff --git a/fs_selfservice/FS-SelfService/cgi/ws_list.html b/fs_selfservice/FS-SelfService/cgi/ws_list.html
index f4beedf33..6b23b7dcb 100644
--- a/fs_selfservice/FS-SelfService/cgi/ws_list.html
+++ b/fs_selfservice/FS-SelfService/cgi/ws_list.html
@@ -19,19 +19,20 @@ sub ws_pkgstatus {
sub pdate {
my($field,$date_format) = (shift,shift);
return "<TD>".Date::Format::time2str($date_format,$field)."</TD>"
- if $field > 0;
+ if $field && $field > 0;
'<TD></TD>';
}
if ( $pkgpart ) {
- $OUT .= qq! <TABLE BORDER="1"><TR><TH>Package</TH><TH>Status</TH> !;
+ $OUT .= qq! <TABLE BORDER="1" style="empty-cells: show"><TR><TH>Package</TH><TH>Status</TH> !;
$OUT .= "<TH>Setup</TH><TH>Last Bill</TH><TH>Next Bill</TH><TH>Adjourn</TH>";
$OUT .= "<TH>Suspend</TH><TH>Expire</TH><TH>Contract End</TH>";
- $OUT .= "<TH>Cancel</TH></TR>";
+ $OUT .= "<TH>Cancel</TH><TH>Services</TH></TR>";
foreach my $pkg ( @cust_pkg ) {
my $part_pkg = $pkg->{part_pkg}[0];
$status = ws_pkgstatus($pkg);
- if($pkg->{pkgpart} == $pkgpart && ($filter eq $status || !$filter) ) {
+ if($pkg->{pkgpart} == $pkgpart &&
+ ( ($filter && $filter eq $status) || !$filter) ) {
$OUT .= "<TR><TD>$part_pkg->{pkg}</TD><TD>$status</TD>";
$OUT .= pdate($pkg->{setup},$date_format);
$OUT .= pdate($pkg->{last_bill},$date_format);
@@ -41,7 +42,24 @@ if ( $pkgpart ) {
$OUT .= pdate($pkg->{expire},$date_format);
$OUT .= pdate($pkg->{contract_end},$date_format);
$OUT .= pdate($pkg->{cancel},$date_format);
- $OUT .= "</TR>";
+
+ $OUT .= "<TD style='font-size: 85%'>";
+ my @cust_svc = @{$pkg->{cust_svc}};
+ foreach my $cust_svc ( @cust_svc ) {
+ my @label = @{$cust_svc->{'label'}};
+ $OUT .= qq!$label[0]: $label[1] <BR><BR>!;
+ }
+ my @part_svc = @{$pkg->{part_svc}};
+ foreach my $part_svc ( @part_svc ) {
+ my $link = qq!<A HREF="${url}provision_svc;!
+ . qq!pkgnum=$pkg->{'pkgnum'};svcpart=$part_svc->{'svcpart'}!
+ . qq!;numavail=$part_svc->{'num_avail'}">Setup !
+ . qq!$part_svc->{'svc'}</A> ($part_svc->{'num_avail'}!
+ . qq! available)<BR><BR>!;
+ $OUT .= $link if $part_svc->{'can_get_dids'};
+ }
+
+ $OUT .= "</TD></TR>";
}
}
$OUT .= "</TABLE>";