Merge pull request #12647 from compucorp/fix-case-type-issues
[civicrm-core.git] / CRM / Utils / API / AbstractFieldCoder.php
index b2c843326e5ccccad58f8c67767e77af071d4b88..0d28cbffbdb4a4418a3abb5dbd77d8ea900349c0 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -30,7 +30,7 @@
  * of all fields (except for some black-listed skip-fields).
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 
 require_once 'api/Wrapper.php';
@@ -63,6 +63,11 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper {
     if ($skipFields === NULL) {
       return FALSE;
     }
+    // Strip extra numbers from custom fields e.g. custom_32_1 should be custom_32
+    if (strpos($fldName, 'custom_') === 0) {
+      list($fldName, $customId) = explode('_', $fldName);
+      $fldName .= '_' . $customId;
+    }
 
     // Field should be skipped
     if (in_array($fldName, $skipFields)) {