5 % # 'table' => 'svc_something'
8 % # 'column' => 'Label',
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
16 % # # defaults to "edit/$table.cgi?", will have svcnum appended
21 % my $table = $opt{'table'};
23 % my $fields = $opt{'fields'}
24 % #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
25 % || [ grep { $_ ne 'svcnum' } fields($table) ];
28 % if ( $cgi->param('svcnum') ) {
29 % $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
32 % my($query) = $cgi->keywords;
33 % $query =~ /^(\d+)$/ or die "no svcnum";
36 % my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } )
37 % or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
39 % my $cust_svc = $svc_x->cust_svc;
40 % my($label, $value, $svcdb) = $cust_svc->label;
42 % my $pkgnum = $cust_svc->pkgnum;
44 % my($cust_pkg, $custnum);
46 % $cust_pkg = $cust_svc->cust_pkg;
47 % $custnum = $cust_pkg->custnum;
57 <% include("/elements/header.html","View $label: $value") %>
59 <% include( '/elements/small_custview.html', $custnum, '', 1,
60 "${p}view/cust_main.cgi") %>
66 function areyousure(href) {
67 if (confirm("Permanently delete this <% $label %>?") == true)
68 window.location.href = href;
72 <% include("/elements/header.html","View $label: $value", menubar(
73 "Cancel this (unaudited) $label" =>
74 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')"
79 Service #<B><% $svcnum %></B>
80 % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
81 | <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A>
84 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
85 % foreach my $f ( @$fields ) {
89 % $field = $f->{'field'},
90 % $type = $f->{'type'} || 'text',
100 <% ( $opt{labels} && exists $opt{labels}->{$field} )
101 ? $opt{labels}->{$field}
106 % #eventually more options for <SELECT>, etc. fields
110 <TD BGCOLOR="#ffffff"><% $svc_x->$field %><TD>
114 % foreach (sort { $a cmp $b } $svc_x->virtual_fields) {
116 <% $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
120 </TABLE></TD></TR></TABLE>
123 <% joblisting({'svcnum'=>$svcnum}, 1) %>
125 <% include('/elements/footer.html') %>