From c536654185de938aa10adf5e71dc2ada4aaf5087 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 20 Oct 2015 14:47:08 +0530 Subject: [PATCH] CRM-16990 -- Custom fields are NOT being saved for some component custom data (activities, membership ...) --- CRM/Activity/Form/Activity.php | 2 +- CRM/Campaign/Form/Campaign.php | 5 +++-- CRM/Grant/Form/Grant.php | 5 +++-- CRM/Member/Form/Membership.php | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 908f7cef64..bbfaa1be11 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -469,7 +469,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->set('type', 'Activity'); $this->set('subType', $this->_activityTypeId); $this->set('entityId', $this->_activityId); - CRM_Custom_Form_CustomData::preProcess($this); + CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_activityTypeId, 1, 'Activity', $this->_activityId); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index c9eaaf7076..5511f1985e 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -115,11 +115,12 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { // when custom data is included in form. if (!empty($_POST['hidden_custom'])) { + $campaignTypeId = empty($_POST['campaign_type_id']) ? NULL : $_POST['campaign_type_id']; $this->set('type', 'Campaign'); - $this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST)); + $this->set('subType', $campaignTypeId); $this->set('entityId', $this->_campaignId); - CRM_Custom_Form_CustomData::preProcess($this); + CRM_Custom_Form_CustomData::preProcess($this, NULL, $campaignTypeId, 1, 'Campaign', $this->_campaignId); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } diff --git a/CRM/Grant/Form/Grant.php b/CRM/Grant/Form/Grant.php index 5b05b5d053..bb43dd433f 100644 --- a/CRM/Grant/Form/Grant.php +++ b/CRM/Grant/Form/Grant.php @@ -103,10 +103,11 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { + $grantTypeId = empty($_POST['grant_type_id']) ? NULL : $_POST['grant_type_id']; $this->set('type', 'Grant'); - $this->set('subType', CRM_Utils_Array::value('grant_type_id', $_POST)); + $this->set('subType', $grantTypeId); $this->set('entityId', $this->_id); - CRM_Custom_Form_CustomData::preProcess($this); + CRM_Custom_Form_CustomData::preProcess($this, NULL, $grantTypeId, 1, 'Grant', $this->_id); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index fedfa1e9eb..5618efa6e4 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -244,7 +244,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { - CRM_Custom_Form_CustomData::preProcess($this); + CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_memType, 1, 'Membership', $this->_id); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } -- 2.25.1