self-service improvements, RT10883
authorlevinse <levinse>
Tue, 14 Dec 2010 23:27:19 +0000 (23:27 +0000)
committerlevinse <levinse>
Tue, 14 Dec 2010 23:27:19 +0000 (23:27 +0000)
FS/FS/ClientAPI/MyAccount.pm
fs_selfservice/FS-SelfService/cgi/invoices.html [new file with mode: 0644]
fs_selfservice/FS-SelfService/cgi/myaccount.html
fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
fs_selfservice/FS-SelfService/cgi/selfservice.cgi
fs_selfservice/FS-SelfService/cgi/tktcreate.html [new file with mode: 0644]

index 29e374c..3fc51b3 100644 (file)
@@ -879,6 +879,7 @@ sub list_invoices {
   return  { 'error'       => '',
             'invoices'    =>  [ map { { 'invnum' => $_->invnum,
                                         '_date'  => $_->_date,
+                                       'date'   => time2str("%b %o, %Y", $_->_date),
                                       }
                                     } @cust_bill
                               ]
diff --git a/fs_selfservice/FS-SelfService/cgi/invoices.html b/fs_selfservice/FS-SelfService/cgi/invoices.html
new file mode 100644 (file)
index 0000000..c4eece3
--- /dev/null
@@ -0,0 +1,27 @@
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('header', 'All Invoices') %>
+
+<%=
+  if ( @invoices ) {
+    $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
+            '<TR><TH BGCOLOR="#ff6666" COLSPAN=4>All Invoices</TH></TR>';
+    my $col1 = "ffffff";
+    my $col2 = "dddddd";
+    my $col = $col1;
+
+    foreach my $invoice ( @invoices ) {
+      my $td = qq!<TD BGCOLOR="#$col">!;
+      my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
+      $OUT .=
+        "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>".
+        "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
+        '</TR>';
+      $col = $col eq $col1 ? $col2 : $col1;
+    }
+    $OUT .= '</TABLE><BR>';
+  } else {
+    $OUT .= 'You have no invoices.<BR><BR>';
+  }
+%>
+
+<%= include('footer') %>
index 6b4187f..db95f33 100644 (file)
@@ -10,6 +10,10 @@ Hello <%= $name %>!<BR><BR>
     '';
 %>
 
+<%=
+  $OUT .= qq! <B><A HREF="${url}invoices">View All Invoices</A></B> &nbsp; &nbsp; !;
+%>
+
 <%= if ( $balance > 0 ) {
   if (scalar(grep $_, @hide_payment_fields)) {
     $OUT .= qq! <B><A HREF="${url}make_thirdparty_payment&payby_method=CC">Make a payment</A></B><BR><BR>!;
index 9d33036..1f448a1 100644 (file)
@@ -59,6 +59,7 @@ if ( 1 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eve
 push @menu,
   { title=>' ' },
   { title=>'View my usage', url=>'view_usage', size=>'+1', },
+  { title=>'Create a ticket', url=>'tktcreate', size=>'+1', },
 ;
 
 unless ( $access_pkgnum ) {
index d23e6ba..25d61ac 100644 (file)
@@ -16,7 +16,7 @@ use FS::SelfService qw(
   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
+  myaccount_passwd list_invoices create_ticket
   mason_comp
 );
 
@@ -73,7 +73,7 @@ $session_id = $cgi->param('session');
 
 #order|pw_list XXX ???
 $cgi->param('action') =~
-    /^(myaccount|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|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;
 
@@ -199,6 +199,31 @@ sub view_invoice {
 
 }
 
+sub invoices {
+  list_invoices( 'session_id' => $session_id, );
+}
+
+sub tktcreate {
+  my $customer_info = customer_info( 'session_id' => $session_id );
+  return $customer_info if ( $customer_info->{'error'} );
+
+  my $requestor = "";
+  if ( $customer_info->{'invoicing_list'} ) {
+    my @requestor = split( /\s*\,\s*/, $customer_info->{'invoicing_list'} );
+    $requestor = $requestor[0] if scalar(@requestor);
+  }
+
+  return { 'requestor' => $requestor }
+    unless ($cgi->param('subject') && $cgi->param('message') &&
+       length($cgi->param('subject')) && length($cgi->param('message')));
+    
+ create_ticket(        'session_id' => $session_id,
+                       'subject' => $cgi->param('subject'),
+                       'message' => $cgi->param('message'), 
+                       'requestor' => $requestor,
+           );
+}
+
 sub customer_order_pkg {
   my $init_data = signup_info( 'customer_session_id' => $session_id );
   return $init_data if ( $init_data->{'error'} );
diff --git a/fs_selfservice/FS-SelfService/cgi/tktcreate.html b/fs_selfservice/FS-SelfService/cgi/tktcreate.html
new file mode 100644 (file)
index 0000000..de7ff60
--- /dev/null
@@ -0,0 +1,38 @@
+<%= $url = "$selfurl?session=$session_id;action="; ''; %>
+<%= include('header', 'Create a ticket') %>
+
+<%=
+if ( $ticket_id ) {
+    $OUT .= "<B>Created ticket #$ticket_id</B>";
+} else {
+    $OUT .= qq! 
+    <div style='font-weight: bold; color: red; margin-bottom: 6px;'> $error </div>
+    Please fill in both the subject and message
+    <br><br>
+    <FORM ACTION="$selfurl" METHOD=POST>
+    <input type="hidden" name="session" value="$session_id">
+    <input type="hidden" name="action" value="tktcreate">
+    <table>
+       <tr>
+           <td>Your e-mail address</td>
+           <td>$requestor</td>
+       </tr>
+       <tr>
+           <td>Subject</td>
+           <td><input type="text" name="subject" size="53"></td>
+       </tr>
+       <tr>
+           <td valign="top">Message</td>
+           <td><textarea name="message" rows="10" cols="60"></textarea></td>
+       </tr>
+       <tr>
+           <td></td>
+           <td><input type="submit" value="Create"></td>
+       </tr>
+    </table>
+    </form> 
+    !;
+}
+%>
+
+<%= include('footer') %>