use GROUP BY instead of DISTINCT ON in the state and country queries for better cross...
[freeside.git] / FS / FS / Record.pm
index a551bb8..cc7f551 100644 (file)
@@ -388,7 +388,7 @@ sub qsearch {
   my %result;
   tie %result, "Tie::IxHash";
   my @stuff = @{ $sth->fetchall_arrayref( {} ) };
-  if($pkey) {
+  if ( $pkey && $stuff[0]->{$pkey} ) {
     %result = map { $_->{$pkey}, $_ } @stuff;
   } else {
     @result{@stuff} = @stuff;