Fix ajax error on rendering multi custom data tab when field limit reached.
authoreileen <emcnaughton@wikimedia.org>
Thu, 22 Mar 2018 01:38:58 +0000 (14:38 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 22 Mar 2018 01:38:58 +0000 (14:38 +1300)
CRM_Contact_Page_View_CustomData::run() calls CRM_Profile_Page_MultipleRecordFieldsListing::run(). The latter function currently only assigns customGroupId to the tpl if the limit of rows to display has not been reached.

However, if the var is a required parameter for the ajax call that follow
s and without it the page does not render. There is no clue as to why it
is wrapped in the  if and changing it does
not cause problems in the follow on ajax call

CRM_Custom_Page_AJAX::getMultiRecordFieldList

The only other place this is called from is
CRM_Profile_Form::preProcess when
mode is not EDIT and gid is set

CRM/Profile/Page/MultipleRecordFieldsListing.php

index 4db419686f9e967f24bf3d4ddf479d1bc7e2b2ca..d50543595cd163488e5840a38e0f33fed10bec7e 100644 (file)
@@ -199,10 +199,10 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
     elseif ($this->_pageViewType == 'customDataView') {
       // require custom group id for _pageViewType of customDataView
       $customGroupId = $this->_customGroupId;
+      $this->assign('customGroupId', $customGroupId);
       $reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
       if (!$reached) {
         $this->assign('contactId', $this->_contactId);
-        $this->assign('customGroupId', $customGroupId);
         $this->assign('ctype', $this->_contactType);
       }
       $this->assign('reachedMax', $reached);