From d4c2682fdf5abad31b1e2b17c347b44e6841a256 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 23 Nov 2016 16:28:33 +0530 Subject: [PATCH] CRM-19679 fix custom file upload in multi-record set --- CRM/Profile/Page/MultipleRecordFieldsListing.php | 9 +++++---- .../CRM/Profile/Page/MultipleRecordFieldsListing.tpl | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index 7ad6318131..3b22b56cf5 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -167,7 +167,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { */ public function browse() { $dateFields = NULL; - $cgcount = 0; + $newCgCount = $cgcount = 0; $attributes = $result = $headerAttr = array(); $dateFieldsVals = NULL; if ($this->_pageViewType == 'profileDataView' && $this->_profileId) { @@ -259,7 +259,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $linkAction = array_sum(array_keys($this->links())); } - if (!empty($fieldIDs) && $this->_contactId && empty($this->_headersOnly)) { + if (!empty($fieldIDs) && $this->_contactId) { $DTparams = !empty($this->_DTparams) ? $this->_DTparams : NULL; // commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView) $result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE, $DTparams); @@ -288,7 +288,8 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { // $cgcount is defined before 'if' condition as entity may have no record // and $cgcount is used to build new record url $cgcount = 1; - if ($result && !empty($result)) { + $newCgCount = (!$reached) ? $resultCount + 1 : NULL; + if (!empty($result) && empty($this->_headersOnly)) { $links = self::links(); if ($this->_pageViewType == 'profileDataView') { $pageCheckSum = $this->get('pageCheckSum'); @@ -302,7 +303,6 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { if ($reached) { unset($links[CRM_Core_Action::COPY]); } - $newCgCount = (!$reached) ? $resultCount + 1 : NULL; if (!empty($DTparams)) { $this->_total = $resultCount; $cgcount = $DTparams['offset'] + 1; @@ -452,6 +452,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $this->assign('dateFields', $dateFields); $this->assign('dateFieldsVals', $dateFieldsVals); $this->assign('cgcount', $cgcount); + $this->assign('newCgCount', $newCgCount); $this->assign('contactId', $this->_contactId); $this->assign('contactType', $this->_contactType); $this->assign('customGroupTitle', $this->_customGroupTitle); diff --git a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl index a9f04333a3..9992233745 100644 --- a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl +++ b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl @@ -117,7 +117,7 @@ {if !$reachedMax}