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');
97 my $table = $opt{'table'};
99 my $fields = $opt{'fields'}
100 #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
101 || [ grep { $_ ne 'svcnum' } fields($table) ];
104 if ( $cgi->param('svcnum') ) {
105 $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
108 my($query) = $cgi->keywords;
109 $query =~ /^(\d+)$/ or die "no svcnum";
112 my $svc_x = qsearchs({
113 'select' => $opt{'table'}.'.*',
114 'table' => $opt{'table'},
115 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
116 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
117 ' LEFT JOIN cust_main USING ( custnum ) ',
118 'hashref' => { 'svcnum' => $svcnum },
119 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
120 }) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
122 my $cust_svc = $svc_x->cust_svc;
123 my($label, $value, $svcdb) = $cust_svc->label;
125 my $pkgnum = $cust_svc->pkgnum;
127 my($cust_pkg, $custnum);
129 $cust_pkg = $cust_svc->cust_pkg;
130 $custnum = $cust_pkg->custnum;