From: Coleman Watts Date: Fri, 1 Aug 2014 14:49:08 +0000 (+0100) Subject: CRM-15068 - Add api support for custom file fields X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e7dcccf0000d27608e167383106f7e447d1c09dd;p=civicrm-core.git CRM-15068 - Add api support for custom file fields --- diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index 74beeed525..942663c7d5 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -553,6 +553,10 @@ AND cf.id IN ( $fieldIDList ) 'is_multiple' => $dao->is_multiple, ); + if ($cvParam['type'] == 'File') { + $cvParam['file_id'] = $fieldValue['value']; + } + if (!array_key_exists($dao->table_name, $cvParams)) { $cvParams[$dao->table_name] = array(); } diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 68b0eed2d7..db78968623 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -160,10 +160,10 @@ class CRM_Utils_Type { break; case 'Positive': - // the below 2 are for custom fields of this type - // CRM-8925 + // CRM-8925 the 3 below are for custom fields of this type case 'Country': case 'StateProvince': + case 'File': if (CRM_Utils_Rule::positiveInteger($data)) { return $data; }