my $sql_query;
-my $orderby = 'ORDER BY svcnum'; #has to be ordered by something
- #for pagination to work
+my $orderby = 'ORDER BY cust_svc.svcnum'; #has to be ordered by something
+ #for pagination to work
if ( length( $cgi->param('search_svc') ) ) {
my $extra_sql = ' WHERE '. join(' AND ', @extra_sql );
$sql_query = {
+ #'select' => 'svcnum',
+ 'select' => 'cust_svc.*',
'table' => 'cust_svc',
'addl_from' => $addl_from,
'hashref' => {},
}
$sql_query->{'select'} = join(', ',
- 'cust_svc.*',
- 'part_svc.*',
+ $sql_query->{'select'},
+ #'part_svc.*',
'cust_main.custnum',
FS::UI::Web::cust_sql_fields(),
);
my $link = sub {
my $cust_svc = shift;
- my $url = svc_url(
- 'm' => $m,
- 'action' => 'view',
- #'part_svc' => $cust_svc->part_svc,
- 'svcdb' => $cust_svc->svcdb, #we have it from the joined search
- #'svc' => $cust_svc, #redundant
- 'query' => '',
- );
+ my $url;
+ if ( $cust_svc->svcpart ) {
+ $url = svc_url(
+ 'm' => $m,
+ 'action' => 'view',
+ 'svcdb' => $cust_svc->svcdb, #we have it from the joined search
+ 'query' => '',
+ );
+ } else { # bizarre unlinked service case
+ $url = $p.'view/svc_Common.html?svcdb='.$cust_svc->svcdb.';svcnum=';
+ }
[ $url, 'svcnum' ];
};