summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Search.pm
diff options
context:
space:
mode:
authorivan <ivan>2010-10-31 19:12:52 +0000
committerivan <ivan>2010-10-31 19:12:52 +0000
commita22ee6a5bbf86485d0c65adfbe9b742b9bfbe7f3 (patch)
tree4b94cd174c37de44b8ab11ac20126c170cba4f6b /FS/FS/cust_main/Search.pm
parenta8501e5799817415bc10c736aa4adf7c851b701a (diff)
add search on harcoded geocode customers w/cch, RT#10376
Diffstat (limited to 'FS/FS/cust_main/Search.pm')
-rw-r--r--FS/FS/cust_main/Search.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index a7f876f..b9a30a5 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -672,7 +672,7 @@ sub search {
my $count_query = "SELECT COUNT(*) FROM cust_main $extra_sql";
- my $select = join(', ',
+ my @select = (
'cust_main.custnum',
FS::UI::Web::cust_sql_fields($params->{'cust_fields'}),
);
@@ -684,10 +684,10 @@ sub search {
if ($dbh->{Driver}->{Name} eq 'Pg') {
- $select .= ", array_to_string(array(select pkg from cust_pkg left join part_pkg using ( pkgpart ) where cust_main.custnum = cust_pkg.custnum $pkgwhere),'|') as magic";
+ push @select, "array_to_string(array(select pkg from cust_pkg left join part_pkg using ( pkgpart ) where cust_main.custnum = cust_pkg.custnum $pkgwhere),'|') as magic";
}elsif ($dbh->{Driver}->{Name} =~ /^mysql/i) {
- $select .= ", GROUP_CONCAT(pkg SEPARATOR '|') as magic";
+ push @select, "GROUP_CONCAT(pkg SEPARATOR '|') as magic";
$addl_from .= " LEFT JOIN part_pkg using ( pkgpart )";
}else{
warn "warning: unknown database type ". $dbh->{Driver}->{Name}.
@@ -719,9 +719,13 @@ sub search {
$c->set('geocode', '');
$c->geocode('cch'); #XXX only cch right now
};
-
+ push @select, 'geocode';
+ push @select, 'zip' unless grep { $_ eq 'zip' } @select;
+ push @select, 'ship_zip' unless grep { $_ eq 'ship_zip' } @select;
}
+ my $select = join(', ', @select);
+
my $sql_query = {
'table' => 'cust_main',
'select' => $select,