diff options
author | mark <mark> | 2012-01-31 21:31:40 +0000 |
---|---|---|
committer | mark <mark> | 2012-01-31 21:31:40 +0000 |
commit | 33622ee94a063863870d9ea208970226eeb7ecd7 (patch) | |
tree | 0917d8d5249b4aaeaf8d24c7c1b9a0db9c82b54c | |
parent | 27de4b6707ddd108b472ec2a3d3907d1a498297f (diff) |
fix advanced cust reports under mysql, #16214
-rw-r--r-- | FS/FS/cust_main/Search.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 25943ccc2..0de3a13e7 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -64,7 +64,8 @@ sub smart_search { my %options = @_; #here is the agent virtualization - my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql; + my $agentnums_sql = + $FS::CurrentUser::CurrentUser->agentnums_sql(table => 'cust_main'); my @cust_main = (); @@ -730,7 +731,8 @@ sub search { $orderby ||= 'ORDER BY custnum'; # here is the agent virtualization - push @where, $FS::CurrentUser::CurrentUser->agentnums_sql; + push @where, + $FS::CurrentUser::CurrentUser->agentnums_sql(table => 'cust_main'); my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : ''; @@ -753,7 +755,7 @@ sub search { 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) { - push @select, "GROUP_CONCAT(pkg SEPARATOR '|') as magic"; + push @select, "GROUP_CONCAT(part_pkg.pkg SEPARATOR '|') as magic"; $addl_from .= " LEFT JOIN part_pkg using ( pkgpart )"; }else{ warn "warning: unknown database type ". $dbh->{Driver}->{Name}. @@ -795,6 +797,7 @@ sub search { my $sql_query = { 'table' => 'cust_main', 'select' => $select, + 'addl_from' => $addl_from, 'hashref' => {}, 'extra_sql' => $extra_sql, 'order_by' => $orderby, |