FS RT #30362 - added configuration option to disable package modification in selfservice
[freeside.git] / fs_selfservice / FS-SelfService / cgi / provision_list.html
index 7e70593..b558337 100644 (file)
@@ -1,24 +1,34 @@
 <FONT SIZE=4>Setup services</FONT><BR><BR>
 
-<SCRIPT>
-function areyousure(href, message) {
-    if (confirm(message) == true)
-        window.location.href = href;
-}
-</SCRIPT>
-
 <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">
 
-<%= foreach my $pkg (
-      grep {    scalar(@{$_->{part_svc}})
-             || scalar(@{$_->{cust_svc}})
-           } @cust_pkg
+<%=
+
+foreach my $pkg (
+    grep {    scalar(@{$_->{part_svc}})
+           || scalar(@{$_->{cust_svc}})
+         } @cust_pkg
     ) {
 
+  my $susp = $pkg->{'susp'} || '';
+  my @pkg_actions = ();
+  if ( ! $susp ) {
+    push @pkg_actions, [ 'customer_change_pkg' => 'change' ] unless $pkg->{'immutable'};
+    push @pkg_actions, [ 'process_suspend_pkg' => 'suspend' ]
+      if $self_suspend_reason;
+  }
+
+  my $bgcolor = $susp ? '"#ff9900"' : '"#8888ff"';
   $OUT .= #'<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">'.
-          '<TR><TH BGCOLOR="#6666ff" COLSPAN=3>'.
-          $pkg->{'pkg'}.
-          '</TH></TR>';
+          '<TR><TH BGCOLOR='.$bgcolor.' COLSPAN=2>'.
+          $pkg->{'pkg'}. ($susp && ' (suspended)').
+          '</TH><TH ALIGN="left" BGCOLOR='.$bgcolor.'>';
+  foreach my $action (@pkg_actions) {
+    $OUT .= '(<A style="font-size: smaller;color: #000000" HREF="' .
+            $url . $action->[0] . ';pkgnum=' . $pkg->{'pkgnum'} . ';pkg=' .
+            $pkg->{'pkg'} . '">' . $action->[1] . '</A>) ';
+  }
+  $OUT .= '</TH></TR>';
 
   my $col1 = "ffffff";
   my $col2 = "dddddd";
@@ -32,6 +42,14 @@ function areyousure(href, message) {
               "$td><B>". $cust_svc->{label}[1]. '</B>';
     $OUT .= '<BR><I>password: '. encode_entities($cust_svc->{_password}). '</I>'
       if exists($cust_svc->{_password});
+    if ( exists($cust_svc->{svchash}) ) {
+        $OUT .= '<BR><I>Email: '. encode_entities($cust_svc->{svchash}->{email}). '</I>'
+          if exists($cust_svc->{svchash}->{email}) 
+              && length($cust_svc->{svchash}->{email});
+        $OUT .= '<BR><I>Forward to: '. encode_entities($cust_svc->{svchash}->{forwarddst}). '</I>'
+          if exists($cust_svc->{svchash}->{forwarddst}) 
+              && length($cust_svc->{svchash}->{forwarddst});
+    }
     $OUT .= '</TD>'.
               "$td><FONT SIZE=-1>";
               
@@ -41,9 +59,10 @@ function areyousure(href, message) {
     #}
 
     unless ( $cust_svc->{'svcnum'} == $svcnum ) {
-      $OUT .= qq!(<A HREF="javascript:areyousure('${url}delete_svc;svcnum=$cust_svc->{svcnum}', 'This will perminantly delete the $cust_svc->{label}[1] $cust_svc->{label}[0].  Are you sure?')">!.
+      $OUT .= qq!(<A HREF="javascript:areyousure('${url}delete_svc;svcnum=$cust_svc->{svcnum}', 'This will permanently delete the $cust_svc->{label}[1] $cust_svc->{label}[0].  Are you sure?')">!.
               'delete</A>)';
-
+      $OUT .=  qq!<BR>(<A HREF="${url}provision_svc;pkgnum=$pkg->{pkgnum};svcpart=$cust_svc->{'svcpart'};svcnum=$cust_svc->{'svcnum'}">modify</A>)!
+            if ( exists($cust_svc->{svchash}) && $cust_svc->{label}[2] eq 'svc_phone' );
     }
     $OUT .= '</FONT></TD></TR>';
     $col = $col eq $col1 ? $col2 : $col1;
@@ -58,11 +77,27 @@ function areyousure(href, message) {
 
     my $td = qq!<TD BGCOLOR="#$col"!;
 
+    my $link;
+
+    if ( $part_svc->{'svcdb'} eq 'svc_external'
+         #&& $conf->exists('svc_external-skip_manual')
+    ) {
+      $link = "${url}process_svc_external;".
+              "pkgnum=$pkg->{'pkgnum'};".
+              "svcpart=$part_svc->{'svcpart'}";
+    } else {
+      $link = "${url}provision_svc;".
+              "pkgnum=$pkg->{'pkgnum'};".
+              "svcpart=$part_svc->{'svcpart'}";
+    }
+
     $OUT .= "<TR>$td COLSPAN=3 ALIGN=center>".
-            qq!<A HREF="${url}provision_svc;pkgnum=$pkg->{'pkgnum'};svcpart=$part_svc->{'svcpart'}">!.
-            'Setup '. $part_svc->{'svc'}. '</A> '.
+            qq!<A HREF="$link">!. 'Setup '. $part_svc->{'svc'}. '</A> '.
             '('. $part_svc->{'num_avail'}. ' available)'.
-            '</TD></TR>';
+            '</TD></TR>'
+      #self-service only supports these services so far
+      if grep { $part_svc->{'svcdb'} eq $_ } qw( svc_acct svc_external );
+
     $col = $col eq $col1 ? $col2 : $col1;
   }