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>
88 % if ( defined($opt{'html_foot'}) ) {
90 <% ref($opt{'html_foot'})
91 ? &{ $opt{'html_foot'} }($svc_x)
99 <% joblisting({'svcnum'=>$svcnum}, 1) %>
101 <% include('/elements/footer.html') %>
105 unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
109 my $table = $opt{'table'};
111 my $fields = $opt{'fields'}
112 #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
113 || [ grep { $_ ne 'svcnum' } fields($table) ];
116 if ( $cgi->param('svcnum') ) {
117 $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
120 my($query) = $cgi->keywords;
121 $query =~ /^(\d+)$/ or die "no svcnum";
124 my $svc_x = qsearchs({
125 'select' => $opt{'table'}.'.*',
126 'table' => $opt{'table'},
127 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
128 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
129 ' LEFT JOIN cust_main USING ( custnum ) ',
130 'hashref' => { 'svcnum' => $svcnum },
131 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
132 }) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
134 my $cust_svc = $svc_x->cust_svc;
135 my($label, $value, $svcdb) = $cust_svc->label;
137 my $pkgnum = $cust_svc->pkgnum;
139 my($cust_pkg, $custnum);
141 $cust_pkg = $cust_svc->cust_pkg;
142 $custnum = $cust_pkg->custnum;