5 # 'table' => 'svc_something'
11 # listref - each item is a literal column name (or method) or (notyet) coderef
12 # if not specified all columns (except for the primary key) will be viewable
18 my $table = $opt{'table'};
20 my $fields = $opt{'fields'}
21 #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
22 || [ grep { $_ ne 'svcnum' } fields($table) ];
24 my($query) = $cgi->keywords;
27 my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } )
28 or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
30 my $cust_svc = $svc_x->cust_svc;
31 my($label, $value, $svcdb) = $cust_svc->label;
33 my $pkgnum = $cust_svc->pkgnum;
35 my($cust_pkg, $custnum);
37 $cust_pkg = $cust_svc->cust_pkg;
38 $custnum = $cust_pkg->custnum;
46 <% if ( $custnum ) { %>
48 <%= include("/elements/header.html","View $label: $value", menubar(
49 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
52 <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %>
58 function areyousure(href) {
59 if (confirm("Permanently delete this <%= $label %>?") == true)
60 window.location.href = href;
64 <%= include("/elements/header.html","View $label: $value", menubar(
65 "Cancel this (unaudited) $label" =>
66 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')"
71 Service #<B><%= $svcnum %></B>
72 | <A HREF="<%=$p%>edit/<%= $opt{'table'} %>.cgi?<%=$svcnum%>">Edit this <%= $label %></A>
75 <%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
77 <% foreach my $f ( @$fields ) {
81 $field = $f->{'field'},
82 $type = $f->{'type'} || 'text',
91 <%= ( $opt{labels} && exists $opt{labels}->{$field} )
92 ? $opt{labels}->{$field}
98 #eventually more options for <SELECT>, etc. fields
101 <TD BGCOLOR="#ffffff"><%= $svc_x->$field %><TD>
107 <% foreach (sort { $a cmp $b } $svc_x->virtual_fields) { %>
108 <%= $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
111 </TABLE></TD></TR></TABLE>
114 <%= joblisting({'svcnum'=>$svcnum}, 1) %>
116 <%= include('/elements/footer.html') %>