C is for Cookie^WControl
[freeside.git] / httemplate / view / svc_external.cgi
1 <% include("/elements/header.html",'External Service View', menubar(
2   ( ( $custnum )
3     ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
4       )                                                                       
5     : ( "Cancel this (unaudited) external service" =>
6           "${p}misc/cancel-unaudited.cgi?$svcnum" )
7   ),
8   "Main menu" => $p,
9 )) %>
10
11 <A HREF="<%$p%>edit/svc_external.cgi?<%$svcnum%>">Edit this information</A><BR>
12 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
13
14 <TR><TD ALIGN="right">Service number</TD>
15   <TD BGCOLOR="#ffffff"><% $svcnum %></TD></TR>
16 <TR><TD ALIGN="right"><% FS::Msgcat::_gettext('svc_external-id') || 'External&nbsp;ID' %></TD>
17   <TD BGCOLOR="#ffffff"><% $conf->config('svc_external-display_type') eq 'artera_turbo' ? sprintf('%010d', $svc_external->id) : $svc_external->id %></TD></TR>
18 <TR><TD ALIGN="right"><% FS::Msgcat::_gettext('svc_external-title') || 'Title' %></TD>
19   <TD BGCOLOR="#ffffff"><% $svc_external->title %></TD></TR>
20 % foreach (sort { $a cmp $b } $svc_external->virtual_fields) { 
21
22   <% $svc_external->pvf($_)->widget('HTML', 'view', $svc_external->getfield($_)) %>
23 % } 
24
25
26 </TABLE></TD></TR></TABLE>
27 <BR><% joblisting({'svcnum'=>$svcnum}, 1) %>
28
29 <% include('/elements/footer.html') %>
30 <%init>
31
32 die "access denied"
33   unless $FS::CurrentUser::CurrentUser->access_right('View customer services')
34       || $FS::CurrentUser::CurrentUser->access_right('View customer'); #XXX remove me
35
36 my($query) = $cgi->keywords;
37 $query =~ /^(\d+)$/;
38 my $svcnum = $1;
39 my $svc_external = qsearchs({
40   'select'    => 'svc_external.*',
41   'table'     => 'svc_external',
42   'addl_from' => ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
43                  ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
44                  ' LEFT JOIN cust_main USING ( custnum ) ',
45   'hashref'   => { 'svcnum' => $svcnum },
46   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
47 }) or die "svc_external: Unknown svcnum $svcnum";
48
49 my $conf = new FS::Conf;
50
51 #false laziness w/all svc_*.cgi
52 my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } );
53 my $pkgnum = $cust_svc->getfield('pkgnum');
54 my($cust_pkg, $custnum);
55 if ($pkgnum) {
56   $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
57   $custnum = $cust_pkg->custnum;
58 } else {
59   $cust_pkg = '';
60   $custnum = '';
61 }
62 #eofalse
63
64 </%init>