From 2bf55c308479337eea5fdcafa0e0dee01f61092f Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Mon, 16 Dec 2013 21:43:52 -0500 Subject: [PATCH] CRM-13995 fix export when merging households --- CRM/Export/BAO/Export.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 1fa49ff04c..358414c705 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -846,13 +846,25 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $fieldValue = CRM_Utils_Array::value($relationValue, $imProviders); } } + // CRM-13995 + elseif (in_array($relationField, array( + 'email_greeting', 'postal_greeting', 'addressee'))) { + //special case for greeting replacement + $fldValue = "{$relationField}_display"; + $fieldValue = $relDAO->$fldValue; + } + elseif ( is_object($relDAO) && $relationField == 'state_province' ) { + $fieldValue = CRM_Core_PseudoConstant::stateProvince($relDAO->state_province_id); + } else { $fieldValue = ''; } $field = $field . '_'; + if (is_object($relDAO) && $relationField == 'id') { $row[$field . $relationField] = $relDAO->contact_id; - } else if ( is_object( $relDAO ) && is_array( $relationValue ) && $relationField == 'location' ) { + } + elseif ( is_object( $relDAO ) && is_array( $relationValue ) && $relationField == 'location' ) { foreach ($relationValue as $ltype => $val) { foreach (array_keys($val) as $fld) { $type = explode('-', $fld); @@ -894,12 +906,6 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $relationQuery[$field]->_options ); } - elseif (in_array($relationField, array( - 'email_greeting', 'postal_greeting', 'addressee'))) { - //special case for greeting replacement - $fldValue = "{$relationField}_display"; - $row[$field . $relationField] = $relDAO->$fldValue; - } else { //normal relationship fields // CRM-3157: localise country, region (both have ‘country’ context) and state_province (‘province’ context) -- 2.25.1