[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi selfservice.cgi, 1.46.2.4, 1.46.2.5 ws_list.html, 1.1.2.3, 1.1.2.4

Erik Levinson levinse at wavetail.420.am
Sun Dec 19 19:14:56 PST 2010


Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail.420.am:/tmp/cvs-serv30218/fs_selfservice/FS-SelfService/cgi

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	selfservice.cgi ws_list.html 
Log Message:
self-service improvements: DIDs, RT10885

Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.46.2.4
retrieving revision 1.46.2.5
diff -u -w -d -r1.46.2.4 -r1.46.2.5
--- selfservice.cgi	17 Dec 2010 01:16:03 -0000	1.46.2.4
+++ selfservice.cgi	20 Dec 2010 03:14:53 -0000	1.46.2.5
@@ -16,7 +16,7 @@
   part_svc_info provision_acct provision_external
   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
 );
 
@@ -73,7 +73,7 @@
 
 #order|pw_list XXX ???
 $cgi->param('action') =~
-    /^(myaccount|tktcreate|tktview|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_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;
 
@@ -83,9 +83,9 @@
 my $result = eval "&$action();";
 die $@ if $@;
 
-if ( $result->{error} eq "Can't resume session"
-  || $result->{error} eq "Expired session" ) { #ick
-
+#fixed "Use of uninitialized value in string eq"; very annoying when developing
+if ( $result->{error} && ($result->{error} eq "Can't resume session"
+			    || $result->{error} eq "Expired session") ) {
   my $login_info = login_info();
   do_template('login', $login_info);
   exit;
@@ -619,6 +619,15 @@
   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'};
@@ -778,12 +787,33 @@
     or die $Text::Template::ERROR;
 
   #warn "filling in $template with $fill_in\n";
+
+    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 {
   print $cgi->header( '-expires' => 'now' ),
         $template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi',
                             HASH    => $fill_in
                           );
 }
 
+}
+
 #*FS::SelfService::_selfservicecgi::include = \&Text::Template::fill_in_file;
 
 package FS::SelfService::_selfservicecgi;

Index: ws_list.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/ws_list.html,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -w -d -r1.1.2.3 -r1.1.2.4
--- ws_list.html	17 Dec 2010 19:32:36 -0000	1.1.2.3
+++ ws_list.html	20 Dec 2010 03:14:53 -0000	1.1.2.4
@@ -55,6 +55,8 @@
 	$pkgparts{$pkg->{pkgpart}}{pkg} = $part_pkg->{pkg};
     }
 
+    $OUT .= "<TABLE><TR><TD>";
+
     $OUT .= qq! <TABLE BORDER="1"><TR><TH>Package</TH><TH>Status</TH></TR> !;
     my($pkgpart,$counts);
     while(($pkgpart,$count) = each %pkgparts){
@@ -68,8 +70,10 @@
     }
     $OUT .= "</TABLE>";
 
+    $OUT .= qq!</TD><TD VALIGN="TOP" STYLE="padding-left: 11px;">!;
+
     if ( @login_svcpart ) {
-	$OUT .= "<BR><BR><BR><B>Self-service accounts</B><BR>";
+	$OUT .= "<B>Self-service accounts</B><BR>";
 	foreach my $pkg ( @cust_pkg ) {
 	    @cust_svc = @{$pkg->{cust_svc}};
 	    @part_svc = @{$pkg->{part_svc}};
@@ -98,6 +102,25 @@
 
 	} # foreach cust_pkg
     } # login_svcpart
+
+    my $hasPhone = 0;
+    foreach my $pkg ( @cust_pkg ) {
+	@cust_svc = @{$pkg->{cust_svc}};
+	foreach my $cust_svc ( @cust_svc ) {
+	    @label = @{$cust_svc->{'label'}};
+	    $hasPhone = 1 if $label[2] eq 'svc_phone';
+	}
+    }
+    if ( $hasPhone ) {
+	$link = "${url}didreport;type=";
+	$OUT .= "<BR><BR><BR>Download currently allocated DIDs:<BR>";
+	$OUT .= qq! &nbsp; <A HREF="${link}csv">CSV</A> | 
+	    <A HREF="${link}xls">Excel</A>!;
+	$OUT .= "<BR><BR>Download recently allocated DIDs:<BR>";
+	$OUT .= qq! &nbsp; <A HREF="${link}csv;recentonly=1">CSV</A> | 
+	    <A HREF="${link}xls;recentonly=1">Excel</A>!;
 }
 
+    $OUT .= "</TD></TR></TABLE>";
+}
 %>



More information about the freeside-commits mailing list