From: Tim Otten Date: Tue, 24 Jun 2014 03:14:09 +0000 (-0700) Subject: CRM-14856 - CRM_Profile_Form - Restore behavior of add_to_group_id when there are... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dd78acd95e868d4d49b2540af063bd11667cc9a5;p=civicrm-core.git CRM-14856 - CRM_Profile_Form - Restore behavior of add_to_group_id when there are multiple profiles The behavior is to scan a combined list of UFFields, see if each UFField's parent UFGroup has "add_to_group", and use it if found. If multiple UFGroups define "add_to_group", then the value of the last UFField wins. I don't see this as good behavior -- just compatible behavior. --- diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 7bae7ccda6..e01d56768e 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -749,6 +749,10 @@ class CRM_Profile_Form extends CRM_Core_Form { CRM_Core_BAO_UFGroup::buildProfile($this, $field, $this->_mode); + if ($field['add_to_group_id']) { + $addToGroupId = $field['add_to_group_id']; + } + //build array for captcha if ($field['add_captcha']) { $addCaptcha[$field['group_id']] = $field['add_captcha']; @@ -793,6 +797,12 @@ class CRM_Profile_Form extends CRM_Core_Form { } $this->assign("isCaptcha", $this->_isAddCaptcha); + if ($this->_mode != self::MODE_SEARCH) { + if (isset($addToGroupId)) { + $this->_ufGroup['add_to_group_id'] = $addToGroupId; + } + } + // lets do the defaults, so we can use it for the below state country routines $this->setDefaultsValues();