From dd78acd95e868d4d49b2540af063bd11667cc9a5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 23 Jun 2014 20:14:09 -0700 Subject: [PATCH] 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. --- CRM/Profile/Form.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(); -- 2.25.1