summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Search.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-10-01 15:17:37 -0700
committerIvan Kohler <ivan@freeside.biz>2017-10-01 15:17:37 -0700
commite786870dfc0f7d1f1b84c18a8de8f5dc402ed40a (patch)
treedbe3b5b2e6efcad5393e0b1a79fb6605db5cf670 /FS/FS/cust_main/Search.pm
parent041ede06710837b92b2d17a0f4b63ab0710a6f25 (diff)
sort by referral count, RT#75757
Diffstat (limited to 'FS/FS/cust_main/Search.pm')
-rw-r--r--FS/FS/cust_main/Search.pm26
1 files changed, 15 insertions, 11 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 27559d7..68471ec 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -1081,8 +1081,9 @@ sub search {
FS::UI::Web::cust_sql_fields($params->{'cust_fields'}),
);
- my(@extra_headers) = ();
- my(@extra_fields) = ();
+ my @extra_headers = ();
+ my @extra_fields = ();
+ my @extra_sort_fields = ();
if ($params->{'flattened_pkgs'}) {
@@ -1127,6 +1128,7 @@ sub search {
my $p = $a[!.--$headercount. q!];
$p;
};!;
+ unshift @extra_sort_fields, '';
}
}
@@ -1142,21 +1144,23 @@ sub search {
unshift @extra_headers, 'Referrals';
unshift @extra_fields, 'num_referrals';
+ unshift @extra_sort_fields, 'num_referrals';
}
my $select = join(', ', @select);
my $sql_query = {
- 'table' => 'cust_main',
- 'select' => $select,
- 'addl_from' => $addl_from,
- 'hashref' => {},
- 'extra_sql' => $extra_sql,
- 'order_by' => $orderby,
- 'count_query' => $count_query,
- 'extra_headers' => \@extra_headers,
- 'extra_fields' => \@extra_fields,
+ 'table' => 'cust_main',
+ 'select' => $select,
+ 'addl_from' => $addl_from,
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql,
+ 'order_by' => $orderby,
+ 'count_query' => $count_query,
+ 'extra_headers' => \@extra_headers,
+ 'extra_fields' => \@extra_fields,
+ 'extra_sort_fields' => \@extra_sort_fields,
};
$sql_query;