From: kurund Date: Mon, 15 Apr 2013 21:47:21 +0000 (+0530) Subject: worked on CRM-12235, added missing feature of inline edit for multi-value custom... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fa6bfe1b7f89d5214c442d978e831f80d63c70bf;p=civicrm-core.git worked on CRM-12235, added missing feature of inline edit for multi-value custom data ---------------------------------------- * CRM-12235: Inline edit of multi-record custom fields broken http://issues.civicrm.org/jira/browse/CRM-12235 --- diff --git a/CRM/Contact/Form/Inline/CustomData.php b/CRM/Contact/Form/Inline/CustomData.php index ad9e73ae2e..6bea43e1a5 100644 --- a/CRM/Contact/Form/Inline/CustomData.php +++ b/CRM/Contact/Form/Inline/CustomData.php @@ -61,9 +61,9 @@ class CRM_Contact_Form_Inline_CustomData extends CRM_Contact_Form_Inline { $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE, NULL, $_REQUEST); $this->assign('customGroupId', $this->_groupID); - + $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', $this, FALSE, 1, $_REQUEST); $subType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId, ','); - CRM_Custom_Form_CustomData::preProcess($this, null, $subType, 1, + CRM_Custom_Form_CustomData::preProcess($this, null, $subType, $customRecId, $this->_contactType, $this->_contactId); } diff --git a/CRM/Contact/Page/Inline/CustomData.php b/CRM/Contact/Page/Inline/CustomData.php index 3eb0e48e60..a6a150d8d9 100644 --- a/CRM/Contact/Page/Inline/CustomData.php +++ b/CRM/Contact/Page/Inline/CustomData.php @@ -34,7 +34,7 @@ */ /** - * This page displays custom data during inline edit + * This page displays custom data during inline edit * */ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page { @@ -52,17 +52,19 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page { // get the emails for this contact $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); - + $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); + //custom groups Inline $entityType = CRM_Contact_BAO_Contact::getContactType($contactId); $entitySubType = CRM_Contact_BAO_Contact::getContactSubType($contactId); $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId, $cgId, $entitySubType ); - $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree); - $fields = array_pop($details[$cgId]); + //get the fields of single custom group record + $fields = CRM_Utils_Array::value($customRecId, $details[$cgId]); + $this->assign('customRecId', $customRecId); $this->assign('contactId', $contactId); $this->assign('customGroupId', $cgId); $this->assign_by_ref('cd_edit', $fields); @@ -70,8 +72,7 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page { // check logged in user permission CRM_Contact_Page_View::checkUserPermission($this, $contactId); - // finally call parent + // finally call parent parent::run(); } } - diff --git a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl index 9b70a60cb0..8122e3325b 100644 --- a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl +++ b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl @@ -23,7 +23,7 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -
+
{if $permission EQ 'edit'}
diff --git a/templates/CRM/Contact/Page/View/CustomDataView.tpl b/templates/CRM/Contact/Page/View/CustomDataView.tpl index d3426fa80a..a89fc7553e 100644 --- a/templates/CRM/Contact/Page/View/CustomDataView.tpl +++ b/templates/CRM/Contact/Page/View/CustomDataView.tpl @@ -33,8 +33,11 @@
{$cd_edit.title}
-
- {include file="CRM/Contact/Page/View/CustomDataFieldView.tpl" customGroupId=$customGroupId} + {if $cvID eq 0} + {assign var='cvID' value='-1'} + {/if} +
+ {include file="CRM/Contact/Page/View/CustomDataFieldView.tpl" customGroupId=$customGroupId customRecId=$cvID}
{/foreach}