From: jitendrapurohit Date: Fri, 11 Mar 2016 08:53:29 +0000 (+0530) Subject: CRM-18174 -- DB Error when Exporting Contact Using "Merge Household" and "Select... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0dc2908620fd31daa964998f7ec8006e1b66946f;p=civicrm-core.git CRM-18174 -- DB Error when Exporting Contact Using "Merge Household" and "Select fields" Options --- diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 0bb887c7d5..c17e424ee9 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -98,6 +98,7 @@ class CRM_Export_BAO_Export { */ public static function defaultReturnProperty($exportMode) { // hack to add default return property based on export mode + $property = NULL; if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) { $property = 'contribution_id'; } @@ -119,9 +120,6 @@ class CRM_Export_BAO_Export { elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) { $property = 'activity_id'; } - elseif ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) { - $property = 'contact_id'; - } return $property; } @@ -434,7 +432,9 @@ class CRM_Export_BAO_Export { } } } - $returnProperties[self::defaultReturnProperty($exportMode)] = 1; + if (!empty(self::defaultReturnProperty($exportMode))) { + $returnProperties[self::defaultReturnProperty($exportMode)] = 1; + } } else { $primary = TRUE; @@ -560,7 +560,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c list($select, $from, $where, $having) = $query->query(); if ($mergeSameHousehold == 1) { - if (!$returnProperties['id']) { + if (empty($returnProperties['id'])) { $returnProperties['id'] = 1; }