From: Coleman Watts Date: Wed, 6 Aug 2014 11:59:25 +0000 (+0100) Subject: CRM-15048 - Respect custom field text_length during export X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=265093257117dda9731971c4110b2be1638b6aa9;p=civicrm-core.git CRM-15048 - Respect custom field text_length during export --- diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 854831b33f..3336e02f20 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -643,6 +643,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { 'import' => 1, 'custom_field_id' => $id, 'options_per_line' => CRM_Utils_Array::value('options_per_line', $values), + 'text_length' => CRM_Utils_Array::value('text_length', $values, 255), 'data_type' => CRM_Utils_Array::value('data_type', $values), 'html_type' => CRM_Utils_Array::value('html_type', $values), 'is_search_range' => CRM_Utils_Array::value('is_search_range', $values), diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 0d7e74958e..d2d56fa09c 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -1367,10 +1367,14 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c if (isset($query->_fields[$field]['data_type'])) { switch ($query->_fields[$field]['data_type']) { + case 'String': + $length = empty($query->_fields[$field]['text_length']) ? 255 : $query->_fields[$field]['text_length']; + $sqlColumns[$fieldName] = "$fieldName varchar($length)"; + break; + case 'Country': case 'StateProvince': case 'Link': - case 'String': $sqlColumns[$fieldName] = "$fieldName varchar(255)"; break;