summaryrefslogtreecommitdiff
path: root/fs_selfservice/FS-SelfService/cgi
diff options
context:
space:
mode:
authorlevinse <levinse>2010-12-21 23:44:54 +0000
committerlevinse <levinse>2010-12-21 23:44:54 +0000
commitfda372ea3d82601724eb4fd064ba95fbfdd68bdb (patch)
tree702009c1b4567c93a6647859092b13b07ac2e14c /fs_selfservice/FS-SelfService/cgi
parentd6741df87df9e3352d7ae47a02d0e3f46154fef9 (diff)
self-service improvements: DIDs, RT10885; re-do all of my changes which were undone by Mark
Diffstat (limited to 'fs_selfservice/FS-SelfService/cgi')
-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
3 files changed, 51 insertions, 12 deletions
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 0000000..d6515e7
--- /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 6baa1e6..3ca7a12 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 3f0562a..0d3bed8 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;