summaryrefslogtreecommitdiff
path: root/httemplate/view/svc_www.cgi
blob: f51c7604cef5a6abc0bddaeceeb58aebe3cb20b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<% include("/elements/header.html", "Website View", menubar(
    ( ( $custnum )
      ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
        )                                                                       
      : ( "Cancel this (unaudited) website" =>
            "${p}misc/cancel-unaudited.cgi?$svcnum" )
    ),
  ))
%>

<A HREF="<% $p %>edit/svc_www.cgi?<% $svcnum %>">Edit this information</A><BR>

<% ntable("#cccccc", 2) %>

  <TR>
    <TD ALIGN="right">Service number</TD>
    <TD BGCOLOR="#ffffff"><% $svcnum %></TD>
  </TR>
  <TR>
    <TD ALIGN="right">Website name</TD>
    <TD BGCOLOR="#ffffff"><A HREF="http://<% $www %>"><% $www %></A></TD>
  </TR>

% if (  $part_svc->part_svc_column('usersvc')->columnflag ne 'F'
%       || $part_svc->part_svc_column('usersvc')->columnvalue !~ /^\s*$/) {

    <TR>
      <TD ALIGN="right">Account</TD>
      <TD BGCOLOR="#ffffff">
%       if ( $usersvc ) {
          <A HREF="<% $p %>view/svc_acct.cgi?<% $usersvc %>"><% $email %></A>
%       } else {
          </i>(none)</i>
%       }
      </TD>
    </TR>

% }

  <TR>
    <TD ALIGN="right">Config lines</TD>
    <TD BGCOLOR="#ffffff"><PRE><% join("\n", $svc_www->config) |h %></PRE></TD>
  </TR>

% foreach (sort { $a cmp $b } $svc_www->virtual_fields) {
    <% $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)) %>
% }

</TABLE>

<BR>
<& /elements/table-tickets.html, object => $cust_svc &>

<% joblisting({'svcnum'=>$svcnum}, 1) %>

<% include('/elements/footer.html') %>
<%init>

die "access denied"
 unless $FS::CurrentUser::CurrentUser->access_right('View customer services');

my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
my $svcnum = $1;
my $svc_www = qsearchs({
  'select'    => 'svc_www.*',
  'table'     => 'svc_www',
  'addl_from' => ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
                 ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
                 ' LEFT JOIN cust_main USING ( custnum ) ',
  'hashref'   => { 'svcnum' => $svcnum },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
                            'null_right' => 'View/link unlinked services'
                          ),
}) or die "svc_www: Unknown svcnum $svcnum";

#false laziness w/all svc_*.cgi
my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
my $pkgnum = $cust_svc->getfield('pkgnum');
my($cust_pkg, $custnum, $display_custnum);
if ($pkgnum) {
  $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
  $custnum = $cust_pkg->custnum;
  $display_custnum = $cust_pkg->cust_main->display_custnum;
} else {
  $cust_pkg = '';
  $custnum = '';
}
#eofalse

my $part_svc=qsearchs('part_svc',{'svcpart'=>$cust_svc->svcpart})
  or die "svc_www: Unknown svcpart" . $cust_svc->svcpart;

my $usersvc = $svc_www->usersvc;
my $svc_acct = '';
my $email = '';
if ( $usersvc ) {
  $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } )
    or die "svc_www: Unknown usersvc $usersvc";
  $email = $svc_acct->email;
}

my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } )
  or die "svc_www: Unknown recnum ". $svc_www->recnum;

my $www = $domain_record->zone;

</%init>