From d5148d71053bbe35dc894d41f73fec988dc910b4 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 5 Feb 2019 19:04:21 +1300 Subject: [PATCH] dev/core#651 Fix group by on export soft credits (possible recent regression, clearly wrong). As pointed out by the reporter the group by is being calculated as if it were a string but it's an array, this fixes. This code has been touched recently so it might be a recent regression. 5.10 is the first release in a long time where export is working in some mysql / output configs after a big refactor to get rid of wide temp tables --- CRM/Export/BAO/Export.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index cc7a41749e..5ef3763257 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -124,7 +124,7 @@ class CRM_Export_BAO_Export { * Group By Clause */ public static function getGroupBy($processor, $returnProperties, $query) { - $groupBy = ''; + $groupBy = NULL; $exportMode = $processor->getExportMode(); $queryMode = $processor->getQueryMode(); if (!empty($returnProperties['tags']) || !empty($returnProperties['groups']) || @@ -140,7 +140,7 @@ class CRM_Export_BAO_Export { $groupBy = 'civicrm_contribution.id'; if (CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled()) { // especial group by when soft credit columns are included - $groupBy = array('contribution_search_scredit_combined.id', 'contribution_search_scredit_combined.scredit_id'); + $groupBy = ['contribution_search_scredit_combined.id', 'contribution_search_scredit_combined.scredit_id']; } break; @@ -157,7 +157,7 @@ class CRM_Export_BAO_Export { $groupBy = "civicrm_activity.id "; } - return $groupBy ? ' GROUP BY ' . $groupBy : ''; + return $groupBy ? ' GROUP BY ' . implode(', ', (array) $groupBy) : ''; } /** -- 2.25.1