X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fsvc_phone.cgi;h=49340c6c33115612a02b734321ebb37d51c8af76;hb=5e05724a635a22776f1b973f5d7e77989da4e048;hp=a68a13e398eefac78a8c9bc2bbb67ccdf6525a59;hpb=1053db7f76169cbbc87840539959a4c362aff242;p=freeside.git diff --git a/httemplate/search/svc_phone.cgi b/httemplate/search/svc_phone.cgi index a68a13e39..49340c6c3 100644 --- a/httemplate/search/svc_phone.cgi +++ b/httemplate/search/svc_phone.cgi @@ -1,19 +1,67 @@ -<% +<% include( 'elements/search.html', + 'title' => "Phone number search results", + 'name' => 'phone numbers', + 'query' => $sql_query, + 'count_query' => $count_query, + 'redirect' => $link, + 'header' => [ '#', + 'Service', + 'Country code', + 'Phone number', + FS::UI::Web::cust_header(), + ], + 'fields' => [ 'svcnum', + 'svc', + 'countrycode', + 'phonenum', + \&FS::UI::Web::cust_fields, + ], + 'links' => [ $link, + $link, + $link, + $link, + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } + FS::UI::Web::cust_header() + ), + ], + 'align' => 'rlrr'. FS::UI::Web::cust_aligns(), + 'color' => [ + '', + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + FS::UI::Web::cust_styles(), + ], + ) +%> +<%init> -my $conf = new FS::Conf; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List services'); -my($query)=$cgi->keywords; -$query ||= ''; #to avoid use of unitialized value errors +my $conf = new FS::Conf; my $orderby = 'ORDER BY svcnum'; my %svc_phone = (); my @extra_sql = (); -if ( $query eq 'svcnum' ) { - #$orderby = 'ORDER BY svcnum'; -} elsif ( $query eq 'phonenum' ) { - $orderby = 'ORDER BY phonenum'; +if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { + + push @extra_sql, 'pkgnum IS NULL' + if $cgi->param('magic') eq 'unlinked'; + + if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { + my $sortby = $1; + $orderby = "ORDER BY $sortby"; + } + } elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { - #$orderby = 'ORDER BY svcnum'; push @extra_sql, "svcpart = $1"; } else { $cgi->param('phonenum') =~ /^([\d\- ]+)$/; @@ -26,7 +74,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #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 = ''; if ( @extra_sql ) { @@ -64,31 +114,4 @@ my $link_cust = sub { $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; }; -%><%= include( 'elements/search.html', - 'title' => "Phone number search results", - 'name' => 'phone numbers', - 'query' => $sql_query, - 'count_query' => $count_query, - 'redirect' => $link, - 'header' => [ '#', - 'Service', - 'Country code', - 'Phone number', - FS::UI::Web::cust_header(), - ], - 'fields' => [ 'svcnum', - 'svc', - 'countrycode', - 'phonenum', - \&FS::UI::Web::cust_fields, - ], - 'links' => [ $link, - $link, - $link, - $link, - ( map { $link_cust } - FS::UI::Web::cust_header() - ), - ], - ) -%> +