diff options
author | ivan <ivan> | 2002-04-17 00:25:58 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-04-17 00:25:58 +0000 |
commit | 644260c472b6aaf40ab4cea714bed5e6bfe708c1 (patch) | |
tree | f3899cb70abb045d7c4dbdad92d534399941c1d9 /httemplate/search | |
parent | d33826efa91645efc00dc8a20e8d0bda8f87ecbd (diff) |
better ordering in search results
Diffstat (limited to 'httemplate/search')
-rwxr-xr-x | httemplate/search/cust_main.cgi | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 63aa924b1..2e255cfa2 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -57,19 +57,19 @@ if ( $cgi->param('browse') my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { $sortby=\*custnum_sort; - $orderby = 'ORDER BY custnum'; + $orderby = "ORDER BY custnum"; } elsif ( $query eq 'last' ) { $sortby=\*last_sort; - $orderby = 'ORDER BY last'; + $orderby = "ORDER BY LOWER(last || ' ' || first)"; } elsif ( $query eq 'company' ) { $sortby=\*company_sort; - $orderby = 'ORDER BY company'; + $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; } else { die "unknown browse field $query"; } } else { $sortby = \*last_sort; #?? - $orderby = 'ORDER BY last'; #?? + $orderby = "ORDER BY LOWER(last || ' ' || first)"; #?? if ( $cgi->param('otaker_on') ) { $cgi->param('otaker') =~ /^(\w{1,32})$/ or eidiot "Illegal otaker\n"; $search{otaker} = $1; @@ -387,13 +387,16 @@ END # sub last_sort { - $a->getfield('last') cmp $b->getfield('last'); + lc($a->getfield('last')) cmp lc($b->getfield('last')) + || lc($a->first) cmp lc($b->first); } sub company_sort { return -1 if $a->company && ! $b->company; return 1 if ! $a->company && $b->company; - $a->getfield('company') cmp $b->getfield('company'); + lc($a->company) cmp lc($b->company) + || lc($a->getfield('last')) cmp lc($b->getfield('last')) + || lc($a->first) cmp lc($b->first);; } sub custnum_sort { |