summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm20
-rw-r--r--fs_selfservice/FS-SelfService/cgi/process_svc_phone.html6
-rw-r--r--fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html6
-rw-r--r--fs_selfservice/FS-SelfService/cgi/selfservice.cgi51
-rw-r--r--httemplate/elements/select-phonenum.html2
5 files changed, 72 insertions, 13 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index ecabe31c7..fb445e555 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1577,7 +1577,25 @@ sub provision_phone {
@_
);
}
-#XXX: finish bulk orders
+
+# bulk case
+ my $error;
+ foreach my $did ( @bulkdid ) {
+ $did =~ s/[^0-9]//g;
+ $error = _provision( 'FS::svc_phone',
+ [qw(phonenum countrycode)],
+ [qw(phonenum countrycode)],
+ {
+ 'pkgnum' => $p->{'pkgnum'},
+ 'svcpart' => $p->{'svcpart'},
+ 'phonenum' => $did,
+ 'countrycode' => $p->{'countrycode'},
+ 'session_id' => $p->{'session_id'},
+ }
+ );
+ return $error if ($error->{'error'} && length($error->{'error'}) > 1);
+ }
+ { 'bulkdid' => [ @bulkdid ], 'svc' => $error->{'svc'} }
}
sub provision_acct {
diff --git a/fs_selfservice/FS-SelfService/cgi/process_svc_phone.html b/fs_selfservice/FS-SelfService/cgi/process_svc_phone.html
new file mode 100644
index 000000000..d6515e7f4
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_svc_phone.html
@@ -0,0 +1,6 @@
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('header', "$svc setup successfully") %>
+
+<FONT SIZE=4><%= $svc %> setup successfully.</FONT>
+
+<%= include('footer') %>
diff --git a/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html b/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html
index 6baa1e6fe..3ca7a1222 100644
--- a/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html
+++ b/fs_selfservice/FS-SelfService/cgi/provision_svc_phone.html
@@ -1,11 +1,17 @@
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('header', 'Setup phone number') %>
+<%=
+if($error) {
+ $OUT .= qq!<div style="color:red; font-size: 115%">$error</div>!;
+}
+%>
<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 %>">
+<INPUT TYPE="hidden" NAME="numavail" VALUE="<%= $numavail %>">
<%= didselector('field' => 'phonenum',
'svcpart' => $svcpart,
'bulknum' => $numavail,
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 3f0562a81..0d3bed8f9 100644
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -16,7 +16,7 @@ use FS::SelfService qw(
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
+ myaccount_passwd list_invoices create_ticket get_ticket did_report
mason_comp
);
@@ -128,8 +128,8 @@ die $@ if $@;
warn Dumper($result) if $DEBUG;
-if ( $result->{error} eq "Can't resume session"
- || $result->{error} eq "Expired session" ) { #ick
+if ( $result->{error} && ( $result->{error} eq "Can't resume session"
+ || $result->{error} eq "Expired session") ) { #ick
my $login_info = login_info();
do_template('login', $login_info);
@@ -679,6 +679,15 @@ sub logout {
FS::SelfService::logout( 'session_id' => $session_id );
}
+sub didreport {
+ my $result = did_report( 'session_id' => $session_id,
+ 'format' => $cgi->param('type'),
+ 'recentonly' => $cgi->param('recentonly'),
+ );
+ die $result->{'error'} if exists $result->{'error'} && $result->{'error'};
+ $result;
+}
+
sub provision {
my $result = list_pkgs( 'session_id' => $session_id );
die $result->{'error'} if exists $result->{'error'} && $result->{'error'};
@@ -715,7 +724,7 @@ sub process_svc_phone {
'countrycode' => '1',
map { $_ => $cgi->param($_) } qw( pkgnum svcpart phonenum )
);
-
+
if ( exists $result->{'error'} && $result->{'error'} ) {
$action = 'provision_svc_phone';
return {
@@ -865,14 +874,32 @@ sub do_template {
)
or die $Text::Template::ERROR;
- #warn "filling in $template with $fill_in\n";
- my $data = $template->fill_in(
- PACKAGE => 'FS::SelfService::_selfservicecgi',
- HASH => $fill_in,
- ) || "Error processing template $source"; # at least print _something_
- print $cgi->header( '-expires' => 'now' );
- print $data;
-}
+ if($result && ref($result) && $result->{'format'} && $result->{'content'}
+ && $result->{'format'} eq 'csv') {
+ print $cgi->header('-expires' => 'now',
+ '-Content-Type' => 'text/csv',
+ '-Content-Disposition' => "attachment;filename=output.csv",
+ ),
+ $result->{'content'};
+ }
+ elsif($result && ref($result) && $result->{'format'} && $result->{'content'}
+ && $result->{'format'} eq 'xls') {
+ print $cgi->header('-expires' => 'now',
+ '-Content-Type' => 'application/vnd.ms-excel',
+ '-Content-Disposition' => "attachment;filename=output.xls",
+ '-Content-Length' => length($result->{'content'}),
+ ),
+ $result->{'content'};
+ }
+ else {
+ my $data = $template->fill_in(
+ PACKAGE => 'FS::SelfService::_selfservicecgi',
+ HASH => $fill_in,
+ ) || "Error processing template $source"; # at least print _something_
+ print $cgi->header( '-expires' => 'now' );
+ print $data;
+ }
+ }
#*FS::SelfService::_selfservicecgi::include = \&Text::Template::fill_in_file;
diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html
index 1c13ae039..986329043 100644
--- a/httemplate/elements/select-phonenum.html
+++ b/httemplate/elements/select-phonenum.html
@@ -66,6 +66,7 @@
var i;
for(i = 0; i < numCheckboxes; i++){
document.getElementById('bulkdid_'+i).style.display = 'block';
+ document.getElementById('checkbox_bulkdid_'+i).checked = false;
var tn = phonenum_sel.options[i+1].value;
document.getElementById('checkbox_bulkdid_'+i).value = tn;
document.getElementById('label_bulkdid_'+i).innerHTML = tn;
@@ -73,6 +74,7 @@
for(i = numCheckboxes; i < <% $opt{'bulknum'} %>; i++){
document.getElementById('bulkdid_'+i).style.display = 'none';
document.getElementById('checkbox_bulkdid_'+i).value = '';
+ document.getElementById('checkbox_bulkdid_'+i).checked = false;
document.getElementById('label_bulkdid_'+i).innerHTML = '';
}
}