3 % # 'table' => 'svc_something'
6 % # 'column' => 'Label',
9 % # listref - each item is a literal column name (or method) or (notyet) coderef
10 % # if not specified all columns (except for the primary key) will be viewable
14 % # # defaults to "edit/$table.cgi?", will have svcnum appended
21 <% include("/elements/header.html","View $label: $value") %>
23 <% include( '/elements/small_custview.html', $custnum, '', 1,
24 "${p}view/cust_main.cgi") %>
30 function areyousure(href) {
31 if (confirm("Permanently delete this <% $label %>?") == true)
32 window.location.href = href;
36 <% include("/elements/header.html","View $label: $value", menubar(
37 "Cancel this (unaudited) $label" =>
38 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')"
43 Service #<B><% $svcnum %></B>
44 % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
45 | <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A>
48 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
49 % foreach my $f ( @$fields ) {
53 % $field = $f->{'field'},
54 % $type = $f->{'type'} || 'text',
64 <% ( $opt{labels} && exists $opt{labels}->{$field} )
65 ? $opt{labels}->{$field}
70 % #eventually more options for <SELECT>, etc. fields
74 <TD BGCOLOR="#ffffff"><% $svc_x->$field %><TD>
78 % foreach (sort { $a cmp $b } $svc_x->virtual_fields) {
80 <% $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
84 </TABLE></TD></TR></TABLE>
87 <% joblisting({'svcnum'=>$svcnum}, 1) %>
89 <% include('/elements/footer.html') %>
93 unless $FS::CurrentUser::CurrentUser->access_right('View customer services')
94 || $FS::CurrentUser::CurrentUser->access_right('View customer'); #XXX remove me
98 my $table = $opt{'table'};
100 my $fields = $opt{'fields'}
101 #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
102 || [ grep { $_ ne 'svcnum' } fields($table) ];
105 if ( $cgi->param('svcnum') ) {
106 $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
109 my($query) = $cgi->keywords;
110 $query =~ /^(\d+)$/ or die "no svcnum";
113 my $svc_x = qsearchs({
114 'select' => $opt{'table'}.'.*',
115 'table' => $opt{'table'},
116 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
117 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
118 ' LEFT JOIN cust_main USING ( custnum ) ',
119 'hashref' => { 'svcnum' => $svcnum },
120 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
121 }) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
123 my $cust_svc = $svc_x->cust_svc;
124 my($label, $value, $svcdb) = $cust_svc->label;
126 my $pkgnum = $cust_svc->pkgnum;
128 my($cust_pkg, $custnum);
130 $cust_pkg = $cust_svc->cust_pkg;
131 $custnum = $cust_pkg->custnum;