From e4f5c8517fd042ddf2967294e810aa9067239edd Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 14 May 2018 16:24:15 +1200 Subject: [PATCH] Use getter function for entity id as on some forms is protected. Follow up to https://github.com/civicrm/civicrm-core/pull/12095 --- CRM/Custom/Form/CustomData.php | 5 +++-- CRM/Member/Form/Membership.php | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CRM/Custom/Form/CustomData.php b/CRM/Custom/Form/CustomData.php index 0473b33572..757808f188 100644 --- a/CRM/Custom/Form/CustomData.php +++ b/CRM/Custom/Form/CustomData.php @@ -54,17 +54,18 @@ class CRM_Custom_Form_CustomData { */ public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1) { $entityName = $form->getDefaultEntity(); + $entityID = $form->getEntityId(); // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { - self::preProcess($form, $subName, $subType, $groupCount, $entityName, $form->_id); + self::preProcess($form, $subName, $subType, $groupCount, $entityName, $entityID); self::buildQuickForm($form); self::setDefaultValues($form); } // need to assign custom data type and subtype to the template $form->assign('customDataType', $entityName); $form->assign('customDataSubType', $subType); - $form->assign('entityID', $form->_id); + $form->assign('entityID', $entityID); } /** diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 5a7ad1428e..32018d525d 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -111,6 +111,15 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { 'receive_date' => array('default' => 'now'), ); + /** + * Get the entity id being edited. + * + * @return int|null + */ + public function getEntityId() { + return $this->_id; + } + /** * Get selected membership type from the form values. * -- 2.25.1