found a bug while runing test case WebTest_Contact_InlineFieldsEditTest : while editi...
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 18 Apr 2013 13:23:33 +0000 (18:53 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 18 Apr 2013 13:23:33 +0000 (18:53 +0530)
CRM/Contact/Form/Inline/CustomData.php
CRM/Contact/Page/Inline/CustomData.php
templates/CRM/Contact/Page/View/CustomDataFieldView.tpl
templates/CRM/Contact/Page/View/CustomDataView.tpl

index 6bea43e1a5fcb2f56abede24d1ba786196d68dd8..f0672a37c43fbd7045118ce28132a929047a3cca 100644 (file)
@@ -62,8 +62,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);
+    $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', $this, FALSE, 1, $_REQUEST);
     $subType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId, ',');
-    CRM_Custom_Form_CustomData::preProcess($this, null, $subType, $customRecId,
+    CRM_Custom_Form_CustomData::preProcess($this, null, $subType, $cgcount,
       $this->_contactType, $this->_contactId);
   }
 
index a6a150d8d9ded92650c1eafdbb46bb1584e10ae6..204e9bc93c7da3ea1d0debd69ccbc3c660b0331b 100644 (file)
@@ -53,6 +53,7 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page {
     $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);
+    $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST);
 
     //custom groups Inline
     $entityType    = CRM_Contact_BAO_Contact::getContactType($contactId);
@@ -62,8 +63,13 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page {
       );
     $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     //get the fields of single custom group record
-    $fields = CRM_Utils_Array::value($customRecId, $details[$cgId]);
-
+    if ($customRecId == 1) {
+      $fields = reset($details[$cgId]);
+    }
+    else {
+      $fields = CRM_Utils_Array::value($customRecId, $details[$cgId]);
+    }
+    $this->assign('cgcount', $cgcount);
     $this->assign('customRecId', $customRecId);
     $this->assign('contactId', $contactId);
     $this->assign('customGroupId', $cgId);
@@ -71,7 +77,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
     parent::run();
   }
index 8122e3325bfbee84ce75a4bfc2ed0aa61a8e0ccc..dd3364d665b5ef81fc8436db758ba7cadafe46a0 100644 (file)
@@ -23,7 +23,7 @@
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-<div id="custom-set-content-{$customGroupId}" {if $permission EQ 'edit'} class="crm-inline-edit" data-edit-params='{ldelim}"cid": "{$contactId}", "class_name": "CRM_Contact_Form_Inline_CustomData", "groupID": "{$customGroupId}", "customRecId": "{$customRecId}"{rdelim}'{/if}>
+<div id="custom-set-content-{$customGroupId}" {if $permission EQ 'edit'} class="crm-inline-edit" data-edit-params='{ldelim}"cid": "{$contactId}", "class_name": "CRM_Contact_Form_Inline_CustomData", "groupID": "{$customGroupId}", "customRecId": "{$customRecId}", "cgcount" : "{$cgcount}"{rdelim}'{/if}>
   <div class="crm-clear crm-inline-block-content" {if $permission EQ 'edit'}title="{ts}Edit{/ts}"{/if}>
     {if $permission EQ 'edit'}
       <div class="crm-edit-help">
index a89fc7553eaad89e1e6d0f913cc5056380cc6104..dff13c1544f33fa99f5bc9579f7fea751a3d22a0 100644 (file)
@@ -26,6 +26,7 @@
 {* Custom Data view mode*}
 {assign var="customGroupCount" value = 1}
 {foreach from=$viewCustomData item=customValues key=customGroupId}
+  {assign var="cgcount" value=1}
   {assign var="count" value=$customGroupCount%2}
   {if ($count eq $side) or $skipTitle }
     {foreach from=$customValues item=cd_edit key=cvID}
           {assign var='cvID' value='-1'}
         {/if}
         <div class="crm-summary-block" id="custom-set-block-{$customGroupId}-{$cvID}">
-          {include file="CRM/Contact/Page/View/CustomDataFieldView.tpl" customGroupId=$customGroupId customRecId=$cvID}
+          {include file="CRM/Contact/Page/View/CustomDataFieldView.tpl" customGroupId=$customGroupId customRecId=$cvID cgcount=$cgcount}
         </div>
       </div>
+      {assign var="cgcount" value=$cgcount+1}
     {/foreach}
   {/if}
   {assign var="customGroupCount" value = $customGroupCount+1}