From 753f36b3c594346b87605319e2f9aefae1f26857 Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Fri, 23 Oct 2015 22:12:29 +0200 Subject: [PATCH] CRM-17430 - This is cleaner. The Domain API now expects domain_version for the version of the domain. ---------------------------------------- * CRM-17430: Altering the domain using the API changes the CiviCRM version to 3 https://issues.civicrm.org/jira/browse/CRM-17430 --- api/v3/Domain.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/api/v3/Domain.php b/api/v3/Domain.php index 0d6cb52bf8..2d2baf69ed 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -129,13 +129,10 @@ function _civicrm_api3_domain_get_spec(&$params) { * @return array */ function civicrm_api3_domain_create($params) { - $params['version'] = $params['domain_version']; - if ($params['version'] == 3) { - // This is an ugly hack to fix CRM-17430. Since CiviCRM version 3 is way - // older than this hack, we can safely assume that the user does not want - // to set his CiviCRM version to 3. - // domain_version is set to 3 by the function below. But if you leave that - // assignment out, a lot of unit tests break. So let's hack around this. + if (isset($params['domain_version'])) { + $params['version'] = $params['domain_version']; + } + else { unset($params['version']); } return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); @@ -150,7 +147,6 @@ function civicrm_api3_domain_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_domain_create_spec(&$params) { - $params['domain_version'] = $params['version']; $params['domain_version']['api.required'] = 1; unset($params['version']); $params['name']['api.required'] = 1; -- 2.25.1