X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fsvc_www.cgi;h=de1f5dd78ee8d0995513b2df20429c73161862ab;hp=1f05c2377aea1c804a11a76b90f0b5879409aa5b;hb=ae7a7aedd844e581638d435e432e08a76f8097d1;hpb=b8cfd0780aa40bb07f3215bf9cb58011f5e32a35 diff --git a/httemplate/search/svc_www.cgi b/httemplate/search/svc_www.cgi index 1f05c2377..de1f5dd78 100755 --- a/httemplate/search/svc_www.cgi +++ b/httemplate/search/svc_www.cgi @@ -4,7 +4,7 @@ my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors -my(@svc_www, $orderby); +my $orderby; if ( $query eq 'svcnum' ) { $orderby = 'ORDER BY svcnum'; } else { @@ -15,28 +15,46 @@ my $count_query = 'SELECT COUNT(*) FROM svc_www'; my $sql_query = { 'table' => 'svc_www', 'hashref' => {}, + 'select' => join(', ', + 'svc_www.*', + map "cust_main.$_", qw(custnum last first company) + ), 'extra_sql' => $orderby, + 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum )'. + 'LEFT JOIN cust_pkg USING ( pkgnum )'. + 'LEFT JOIN cust_main USING ( custnum )', }; my $link = [ "${p}view/svc_www.cgi?", 'svcnum', ]; #my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ]; my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ]; +#smaller false laziness w/svc_*.cgi here +my $link_cust = sub { + my $svc_x = shift; + $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; +}; -%> -<%= include( 'elements/search.html', - 'title' => 'Virtual Host Search Results', - 'name' => 'virtual hosts', - 'query' => $sql_query, - 'count_query' => $count_query, - 'header' => [ '#', 'Zone', 'User', ], - 'fields' => [ 'svcnum', - sub { $_[0]->domain_record->zone }, - sub { $_[0]->svc_acct->email }, - ], - 'links' => [ $link, - '', - $ulink, - ], - ) +%><%= include( 'elements/search.html', + 'title' => 'Virtual Host Search Results', + 'name' => 'virtual hosts', + 'query' => $sql_query, + 'count_query' => $count_query, + 'redirect' => $link, + 'header' => [ '#', + 'Zone', + 'User', + 'Customer', + ], + 'fields' => [ 'svcnum', + sub { $_[0]->domain_record->zone }, + sub { $_[0]->svc_acct->email }, + \&FS::svc_Common::cust_name, + ], + 'links' => [ $link, + '', + $ulink, + $link_cust, + ], + ) %>