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