X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FSearch.pm;h=ae219c80110390e5107a86b14194c1ce0f76c773;hp=7216fe604227433588b6ef4125b58988d0d5ada4;hb=8b970de57d50e41b2f64f48dd372ba8473962933;hpb=3ebf876779b2a89e81a767d3cdd6690a88bdd3de diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 7216fe604..ae219c801 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -618,7 +618,7 @@ sub search { my $dbh = dbh; my @where = (); - my $orderby = "ORDER BY cust_main.custnum"; + my $orderby; # initialize these to prevent warnings $params = { @@ -937,7 +937,7 @@ sub search { } } - $orderby .= ", cust_main.$field"; + $orderby ||= "ORDER BY cust_main.$field"; } @@ -1213,8 +1213,7 @@ sub search { } - # set select a customer only once. some joins create multiple customer records. - my $select = 'DISTINCT ON (cust_main.custnum) ' . join(', ', @select); + my $select = join(', ', @select); my $sql_query = { 'table' => 'cust_main',