Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / fs_selfservice / FS-SelfService / cgi / provision_list.html
1 <FONT SIZE=4>Setup services</FONT><BR><BR>
2
3 <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">
4
5 <%=
6
7 foreach my $pkg (
8     grep {    scalar(@{$_->{part_svc}})
9            || scalar(@{$_->{cust_svc}})
10          } @cust_pkg
11     ) {
12   my $susp = $pkg->{'susp'} || '';
13   my @pkg_actions = ( [ 'customer_change_pkg' => 'change' ] );
14   push @pkg_actions, [ 'process_suspend_pkg' => 'suspend' ] 
15     if $self_suspend_reason and !$susp;
16
17   my $bgcolor = $susp ? '"#ff9900"' : '"#8888ff"';
18   $OUT .= #'<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">'.
19           '<TR><TH BGCOLOR='.$bgcolor.' COLSPAN=2>'.
20           $pkg->{'pkg'}. ($susp && ' (suspended)').
21           '</TH><TH ALIGN="left" BGCOLOR='.$bgcolor.'>';
22   foreach my $action (@pkg_actions) {
23     $OUT .= '(<A style="font-size: smaller;color: #000000" HREF="' .
24             $url . $action->[0] . ';pkgnum=' . $pkg->{'pkgnum'} . ';pkg=' .
25             $pkg->{'pkg'} . '">' . $action->[1] . '</A>) ';
26   }
27   $OUT .= '</TH></TR>';
28
29   my $col1 = "ffffff";
30   my $col2 = "dddddd";
31   my $col = $col1;
32
33   foreach my $cust_svc ( @{ $pkg->{cust_svc} } ) {
34     my $td = qq!<TD BGCOLOR="#$col"!;
35
36     $OUT .= '<TR>'.
37               "$td ALIGN=right>". $cust_svc->{label}[0]. ': </TD>'.
38               "$td><B>". $cust_svc->{label}[1]. '</B>';
39     $OUT .= '<BR><I>password: '. encode_entities($cust_svc->{_password}). '</I>'
40       if exists($cust_svc->{_password});
41     if ( exists($cust_svc->{svchash}) ) {
42         $OUT .= '<BR><I>Email: '. encode_entities($cust_svc->{svchash}->{email}). '</I>'
43           if exists($cust_svc->{svchash}->{email}) 
44               && length($cust_svc->{svchash}->{email});
45         $OUT .= '<BR><I>Forward to: '. encode_entities($cust_svc->{svchash}->{forwarddst}). '</I>'
46           if exists($cust_svc->{svchash}->{forwarddst}) 
47               && length($cust_svc->{svchash}->{forwarddst});
48     }
49     $OUT .= '</TD>'.
50               "$td><FONT SIZE=-1>";
51               
52     #if ( $cust_svc->{label}[2] eq 'svc_acct' ) {
53     #  $OUT .= qq!(<A HREF="${url}changepw;svcnum=$cust_svc->{'svcnum'}">!.
54     #          'change&nbsp;pw) ';
55     #}
56
57     unless ( $cust_svc->{'svcnum'} == $svcnum ) {
58       $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?')">!.
59               'delete</A>)';
60       $OUT .=  qq!<BR>(<A HREF="${url}provision_svc;pkgnum=$pkg->{pkgnum};svcpart=$cust_svc->{'svcpart'};svcnum=$cust_svc->{'svcnum'}">modify</A>)!
61             if ( exists($cust_svc->{svchash}) && $cust_svc->{label}[2] eq 'svc_phone' );
62     }
63     $OUT .= '</FONT></TD></TR>';
64     $col = $col eq $col1 ? $col2 : $col1;
65   }
66
67   $OUT .= '<TR><TD COLSPAN=3 BGCOLOR="#000000"></TD></TR>'
68     if scalar(@{$pkg->{part_svc}}) && scalar(@{$pkg->{cust_svc}});
69
70   $col = $col1;
71
72   foreach my $part_svc ( @{ $pkg->{part_svc} } ) {
73
74     my $td = qq!<TD BGCOLOR="#$col"!;
75
76     my $link;
77
78     if ( $part_svc->{'svcdb'} eq 'svc_external'
79          #&& $conf->exists('svc_external-skip_manual')
80     ) {
81       $link = "${url}process_svc_external;".
82               "pkgnum=$pkg->{'pkgnum'};".
83               "svcpart=$part_svc->{'svcpart'}";
84     } else {
85       $link = "${url}provision_svc;".
86               "pkgnum=$pkg->{'pkgnum'};".
87               "svcpart=$part_svc->{'svcpart'}";
88     }
89
90     $OUT .= "<TR>$td COLSPAN=3 ALIGN=center>".
91             qq!<A HREF="$link">!. 'Setup '. $part_svc->{'svc'}. '</A> '.
92             '('. $part_svc->{'num_avail'}. ' available)'.
93             '</TD></TR>'
94       #self-service only supports these services so far
95       if grep { $part_svc->{'svcdb'} eq $_ } qw( svc_acct svc_external );
96
97     $col = $col eq $col1 ? $col2 : $col1;
98   }
99
100   #$OUT .= '</TABLE><BR>';
101   $OUT .= '<TR><TD BGCOLOR="#eeeeee" COLSPAN=3>&nbsp;</TD></TR>';
102
103 } %>
104
105 </TABLE>