X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_svc.html;h=2c17561f2981b868b356d03bda1b338da4cbe772;hb=d5d685f021759dff69a662953899ed339c27d0a7;hp=568b43b18a89f707a638e442f5c7e099644441e2;hpb=633c48448d9468690b7ad77eb6ff7c660a286658;p=freeside.git diff --git a/httemplate/search/cust_svc.html b/httemplate/search/cust_svc.html index 568b43b18..2c17561f2 100644 --- a/httemplate/search/cust_svc.html +++ b/httemplate/search/cust_svc.html @@ -21,14 +21,28 @@ 'links' => [ $link, $link, # package? - ( map { $link_cust } + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } FS::UI::Web::cust_header() ), ], + 'align' => 'rl'. FS::UI::Web::cust_aligns(), + 'color' => [ + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + FS::UI::Web::cust_styles(), + ], ) %> <%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List services'); + my $addl_from = ' LEFT JOIN part_svc USING ( svcpart ) '. ' LEFT JOIN cust_pkg USING ( pkgnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; @@ -39,6 +53,7 @@ my $orderby = 'ORDER BY svcnum'; #has to be ordered by something if ( length( $cgi->param('search_svc') ) ) { my $string = $cgi->param('search_svc'); + $string =~ s/(^\s+|\s+$)//; #trim leading & trailing whitespace # implement fuzzy searching in subclasses too at some point? # service searching maybe shouldn't be fuzzy... @@ -75,11 +90,13 @@ if ( length( $cgi->param('search_svc') ) ) { push @extra_sql, "svcpart = $1"; } else { - eidiot("No search term specified"); + errorpage("No search term specified"); } #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = ' WHERE '. join(' AND ', @extra_sql ); @@ -100,11 +117,24 @@ my $count_query = "SELECT COUNT(*) FROM cust_svc $addl_from $extra_sql"; my $link = sub { my $cust_svc = shift; - my $url = FS::UI::Web::svc_url( + 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' => 'svcnum=', + 'query' => '', ); + [ $url, 'svcnum' ]; +}; + +my $link_cust = sub { + my $cust_svc = shift; + if ( $cust_svc->custnum ) { + [ "${p}view/cust_main.cgi?", 'custnum' ]; + } else { + ''; + } +}; + +