CRM-19222 Export: temp table field length at least 255 for strings
authoryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 13 Sep 2016 10:41:43 +0000 (16:11 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Tue, 13 Sep 2016 10:41:43 +0000 (16:11 +0530)
----------------------------------------
* CRM-19222: Data too long on export including custom field
  https://issues.civicrm.org/jira/browse/CRM-19222

CRM/Export/BAO/Export.php

index 6077d1a83d594f5fcc71f13fb83c964996addd69..9e762f92ed9f83b3a441d1a9f3c97e13e4b60239 100644 (file)
@@ -1378,7 +1378,8 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
 
             switch ($query->_fields[$field]['data_type']) {
               case 'String':
-                $length = empty($query->_fields[$field]['text_length']) ? 255 : $query->_fields[$field]['text_length'];
+                // May be option labels, which could be up to 512 characters
+                $length = max(512, CRM_Utils_Array::value('text_length', $query->_fields[$field]));
                 $sqlColumns[$fieldName] = "$fieldName varchar($length)";
                 break;