*/
public function browse() {
$dateFields = NULL;
- $cgcount = 0;
+ $newCgCount = $cgcount = 0;
$attributes = $result = $headerAttr = array();
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$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);
// $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');
if ($reached) {
unset($links[CRM_Core_Action::COPY]);
}
- $newCgCount = (!$reached) ? $resultCount + 1 : NULL;
if (!empty($DTparams)) {
$this->_total = $resultCount;
$cgcount = $DTparams['offset'] + 1;
$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);
{if !$reachedMax}
<div class="action-link">
{if $pageViewType eq 'customDataView'}
- <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$cgcount&multiRecordDisplay=single&mode=add"}"
+ <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$newCgCount&multiRecordDisplay=single&mode=add"}"
class="button action-item"><span><i class="crm-i fa-plus-circle"></i> {ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a>
{else}
<a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"