Merge pull request #2367 from kurund/CRM-14082
[civicrm-core.git] / api / v3 / Profile.php
index 099aa01ac1ff385c84b066dad598dbb09e6de7a7..4b7c479b2ba08da7c639b46737101fbfe55b618f 100644 (file)
@@ -580,8 +580,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
         if(isset($profileFields[$profileID][$entityfield])) {
           unset($profileFields[$profileID][$entityfield]);
         }
-        // we will make the mixed case version (e.g. of 'Primary') an alias
-        $profileFields[$profileID][$fieldName]['api.aliases'][] = $entityfield;
+        if(!in_array($entityfield, $profileFields[$profileID][$fieldName]['api.aliases'])) {
+          // we will make the mixed case version (e.g. of 'Primary') an alias
+          $profileFields[$profileID][$fieldName]['api.aliases'][] = $entityfield;
+        }
       }
       /**
        * putting this on hold -this would cause the api to set the default - but could have unexpected behaviour