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) %>
50 % foreach my $f ( @$fields ) {
54 % $field = $f->{'field'},
55 % $type = $f->{'type'} || 'text',
61 % my $columndef = $part_svc->part_svc_column($field);
62 % unless ($columndef->columnflag eq 'F' && !length($columndef->columnvalue)) {
66 <% ( $opt{labels} && exists $opt{labels}->{$field} )
67 ? $opt{labels}->{$field}
72 % #eventually more options for <SELECT>, etc. fields
74 <TD BGCOLOR="#ffffff"><% $svc_x->$field %><TD>
82 % foreach (sort { $a cmp $b } $svc_x->virtual_fields) {
83 <% $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %>
87 </TABLE></TD></TR></TABLE>
91 % if ( defined($opt{'html_foot'}) ) {
93 <% ref($opt{'html_foot'})
94 ? &{ $opt{'html_foot'} }($svc_x)
101 <% joblisting({'svcnum'=>$svcnum}, 1) %>
103 <% include('/elements/footer.html') %>
107 unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
111 my $table = $opt{'table'};
113 my $fields = $opt{'fields'}
114 #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ];
115 || [ grep { $_ ne 'svcnum' } fields($table) ];
118 if ( $cgi->param('svcnum') ) {
119 $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
122 my($query) = $cgi->keywords;
123 $query =~ /^(\d+)$/ or die "no svcnum";
126 my $svc_x = qsearchs({
127 'select' => $opt{'table'}.'.*',
128 'table' => $opt{'table'},
129 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
130 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
131 ' LEFT JOIN cust_main USING ( custnum ) ',
132 'hashref' => { 'svcnum' => $svcnum },
133 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
134 }) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
136 my $cust_svc = $svc_x->cust_svc;
137 my($label, $value, $svcdb) = $cust_svc->label;
139 my $part_svc = $cust_svc->part_svc;
141 my $pkgnum = $cust_svc->pkgnum;
143 my($cust_pkg, $custnum);
145 $cust_pkg = $cust_svc->cust_pkg;
146 $custnum = $cust_pkg->custnum;