X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FContactType.php;h=fede1f2ceb4a146eec1400dc6b9eacd2709424ec;hb=4fd26f71c62960fbbb738a549bb595926f1eb70b;hp=79854ecb26ec12cec5eb576324ce4c92bad3cb11;hpb=42bf93368ea81b2fa70fab038f3c884755e1ab88;p=civicrm-core.git diff --git a/api/v3/ContactType.php b/api/v3/ContactType.php index 79854ecb26..fede1f2ceb 100644 --- a/api/v3/ContactType.php +++ b/api/v3/ContactType.php @@ -2,7 +2,7 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.5 | + | CiviCRM version 4.6 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2014 | +--------------------------------------------------------------------+ @@ -50,14 +50,17 @@ */ function civicrm_api3_contact_type_create($params) { civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), array('name', 'parent_id')); - if (!array_key_exists('label', $params)) { - $params['label'] = $params['name']; - } - if (!array_key_exists('is_active', $params)) { - $params['is_active'] = TRUE; + + if (empty($params['id'])) { + if (!array_key_exists('label', $params)) { + $params['label'] = $params['name']; + } + if (!array_key_exists('is_active', $params)) { + $params['is_active'] = TRUE; + } + $params['name'] = CRM_Utils_String::munge($params['name']); } - $params['name'] = CRM_Utils_String::munge($params['name']); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); }