-<%
+<% 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\- ]+)$/;
$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()
- ),
- ],
- )
-%>
+</%init>