<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
if ($rowCount) {
$cacheKey = $this->buildPrevNextCache($sort);
$result = $this->_query->getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds);
+
+ // CRM-13996: result is empty when selector columns are sorted. hence we need to run the query again
+ if ( $result->N == 0) {
+ $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, $includeContactIds);
+ }
}
else {
$result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, $includeContactIds);
$groupID = CRM_Utils_Array::key('1', $this->_formValues['group']);
$pseudoconstants = array();
- if (!empty($this->_fields)) {
- // get all the pseudoconstant values
- foreach ($this->_fields as $name => $values) {
- if (isset($this->_fields[$name]['pseudoconstant'])) {
- $pseudoconstants[$name] =
- array(
- 'dbName' => $this->_fields[$name]['name'],
- 'values' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name),
- );
- }
- }
- }
-
// for CRM-3157 purposes
- if (in_array('country', $names)) {
- $pseudoconstants['country'] = array(
- 'dbName' => 'country_id',
- 'values' => CRM_Core_PseudoConstant::country()
- );
- }
-
- if (in_array('state_province', $names)) {
- $pseudoconstants['state_province'] = array(
- 'dbName' => 'state_province_id',
- 'values' => CRM_Core_PseudoConstant::stateProvince()
- );
- }
-
if (in_array('world_region', $names)) {
$pseudoconstants['world_region'] = array(
'dbName' => 'world_region_id',
$seenIDs = array();
while ($result->fetch()) {
$row = array();
+ $this->_query->convertToPseudoNames($result);
// the columns we are interested in
foreach ($names as $property) {
$greeting = $property . '_display';
$row[$property] = $result->$greeting;
}
+ elseif ($property == 'state_province') {
+ $row[$property] = $result->state_province_name;
+ }
elseif (isset($pseudoconstants[$property])) {
$row[$property] = CRM_Utils_Array::value(
$result->{$pseudoconstants[$property]['dbName']},
$sql = str_replace($replaceSQL, $insertSQL, $sql);
-
CRM_Core_Error::ignoreException();
$result = CRM_Core_DAO::executeQuery($sql);
CRM_Core_Error::setCallback();