From 0b94b406e29444793f12cc84403db97c208c8fc1 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 16 Nov 2018 12:31:39 +1300 Subject: [PATCH] Always create temp table at the start. The saving of not creating an empty file occassionally doesn't warrant the code complexity --- CRM/Export/BAO/Export.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 5699194a4a..d7103de352 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -235,8 +235,6 @@ class CRM_Export_BAO_Export { $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); self::$relationshipTypes = $processor->getRelationshipTypes(); - $queryMode = $processor->getQueryMode(); - if ($fields) { foreach ($fields as $key => $value) { $fieldName = CRM_Utils_Array::value(1, $value); @@ -445,7 +443,6 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c } $componentDetails = array(); - $setHeader = TRUE; $rowCount = self::EXPORT_ROW_COUNT; $offset = 0; @@ -469,7 +466,9 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c } } + $exportTempTable = self::createTempTable($sqlColumns); $limitReached = FALSE; + while (!$limitReached) { $limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}"; $iterationDAO = CRM_Core_DAO::executeQuery($limitQuery); @@ -533,13 +532,6 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c } } - if ($setHeader) { - $exportTempTable = self::createTempTable($sqlColumns); - } - - //build header only once - $setHeader = FALSE; - // If specific payment fields have been selected for export, payment // data will already be in $row. Otherwise, add payment related // information, if appropriate. -- 2.25.1