CDR Report: add top sources, top destinations, and longest calls report options,...
[freeside.git] / httemplate / view / svc_domain.cgi
1 % if ( $custnum ) {
2
3 %#  <% include("/elements/header.html","View $svcdomain") %>
4   <% include("/elements/header.html","View domain") %>
5   <% include( '/elements/small_custview.html', $custnum, '', 1,
6      "${p}view/cust_main.cgi") %>
7   <BR>
8
9 % } else {
10
11   <% include("/elements/header.html",'View domain', menubar(
12        "Cancel this (unaudited) domain" =>
13          "javascript:areyousure('${p}misc/cancel-unaudited.cgi?$svcnum', 'Delete $domain and all records?')",
14      ))
15   %>
16
17 % }
18
19 <% include('/elements/error.html') %>
20
21 <% include('svc_domain/basics.html', $svc_domain,
22              'part_svc' => $part_svc,
23              'custnum'  => $custnum,
24           )
25 %>
26 <BR>
27
28 <% include('svc_domain/acct_defaults.html', $svc_domain,
29              'part_svc' => $part_svc,
30           )
31 %>
32 <BR>
33
34 <% include('svc_domain/dns.html', $svc_domain ) %>
35 <BR>
36
37 <% include('elements/svc_export_settings.html', $svc_domain) %>
38
39 <% joblisting({'svcnum'=>$svcnum}, 1) %>
40
41 <% include('/elements/footer.html') %>
42 <%init>
43
44 die "access denied"
45   unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
46
47 my $conf = new FS::Conf;
48
49 my($query) = $cgi->keywords;
50 $query =~ /^(\d+)$/;
51 my $svcnum = $1;
52 my $svc_domain = qsearchs({
53   'select'    => 'svc_domain.*',
54   'table'     => 'svc_domain',
55   'addl_from' => ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
56                  ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
57                  ' LEFT JOIN cust_main USING ( custnum ) ',
58   'hashref'   => {'svcnum'=>$svcnum},
59   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
60                             'null_right' => 'View/link unlinked services'
61                           ),
62 });
63 die "Unknown svcnum" unless $svc_domain;
64
65 my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
66 my $pkgnum = $cust_svc->getfield('pkgnum');
67 my($cust_pkg, $custnum, $display_custnum);
68 if ($pkgnum) {
69   $cust_pkg = qsearchs('cust_pkg', {'pkgnum'=>$pkgnum} );
70   $custnum = $cust_pkg->custnum;
71   $display_custnum = $cust_pkg->cust_main->display_custnum;
72 } else {
73   $cust_pkg = '';
74   $custnum = '';
75 }
76
77 my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
78 die "Unknown svcpart" unless $part_svc;
79
80 my $domain = $svc_domain->domain;
81
82 </%init>