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", menubar(
58 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
61 <% include( '/elements/small_custview.html', $custnum, '', 1 ) %>
67 function areyousure(href) {
68 if (confirm("Permanently delete this <% $label %>?") == true)
69 window.location.href = href;
73 <% include("/elements/header.html","View $label: $value", menubar(
74 "Cancel this (unaudited) $label" =>
75 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')"
80 Service #<B><% $svcnum %></B>
81 % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
82 | <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A>
85 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
86 % foreach my $f ( @$fields ) {
90 % $field = $f->{'field'},
91 % $type = $f->{'type'} || 'text',
101 <% ( $opt{labels} && exists $opt{labels}->{$field} )
102 ? $opt{labels}->{$field}
107 % #eventually more options for <SELECT>, etc. fields
111 <TD BGCOLOR="#ffffff"><% $svc_x->$field %><TD>
115 % foreach (sort { $a cmp $b } $svc_x->virtual_fields) {
117 <% $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
121 </TABLE></TD></TR></TABLE>
124 <% joblisting({'svcnum'=>$svcnum}, 1) %>
126 <% include('/elements/footer.html') %>