[freeside-commits] branch FREESIDE_3_BRANCH updated. 4559e7e64ea925a799d240d0d44faaaf487e68fc
Ivan
ivan at 420.am
Sun Oct 1 15:17:40 PDT 2017
The branch, FREESIDE_3_BRANCH has been updated
via 4559e7e64ea925a799d240d0d44faaaf487e68fc (commit)
from c8ee52d03f77850cba5555577109044c04a0f543 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4559e7e64ea925a799d240d0d44faaaf487e68fc
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun Oct 1 15:17:39 2017 -0700
sort by referral count, RT#75757
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 84108a0..147a73a 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -1127,8 +1127,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'}) {
@@ -1173,6 +1174,7 @@ sub search {
my $p = $a[!.--$headercount. q!];
$p;
};!;
+ unshift @extra_sort_fields, '';
}
}
@@ -1188,21 +1190,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,
};
#warn Data::Dumper::Dumper($sql_query);
$sql_query;
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 7729da4..30a893a 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -13,6 +13,10 @@
\&FS::UI::Web::cust_fields,
@extra_fields,
],
+ #'sort_fields' => [
+ # FS::UI::Web::cust_sort_fields(),
+ # @extra_sort_fields,
+ #],
'color' => [ FS::UI::Web::cust_colors(),
map '', @extra_fields
],
@@ -103,9 +107,10 @@ $search_hash{'current_balance'} =
###
my $sql_query = FS::cust_main::Search->search(\%search_hash);
-my $count_query = delete($sql_query->{'count_query'});
-my @extra_headers = @{ delete($sql_query->{'extra_headers'}) };
-my @extra_fields = @{ delete($sql_query->{'extra_fields'}) };
+my $count_query = delete($sql_query->{'count_query'});
+my @extra_headers = @{ delete($sql_query->{'extra_headers'}) };
+my @extra_fields = @{ delete($sql_query->{'extra_fields'}) };
+my @extra_sort_fields = @{ delete($sql_query->{'extra_sort_fields'}) };
my $link = [ "${p}view/cust_main.cgi?", 'custnum' ];
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Search.pm | 26 +++++++++++++++-----------
httemplate/search/cust_main.html | 11 ++++++++---
2 files changed, 23 insertions(+), 14 deletions(-)
More information about the freeside-commits
mailing list