dev/core#503 - More accurate custom field checking before htmlEncode
authorColeman Watts <coleman@civicrm.org>
Fri, 9 Nov 2018 15:42:39 +0000 (10:42 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 9 Nov 2018 18:09:09 +0000 (13:09 -0500)
CRM/Utils/API/AbstractFieldCoder.php

index b2c843326e5ccccad58f8c67767e77af071d4b88..7d427b2b51019df894a637e090cdca08f5f3894a 100644 (file)
@@ -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)) {