<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
CRM_Core_Action::VIEW => array(
'name' => ts('View'),
'url' => 'civicrm/contact/view',
+ 'class' => 'no-popup',
'qs' => "reset=1&cid=%%id%%{$searchContext}{$extraParams}",
'title' => ts('View Contact Details'),
'ref' => 'view-contact',
CRM_Core_Action::UPDATE => array(
'name' => ts('Edit'),
'url' => 'civicrm/contact/add',
+ 'class' => 'no-popup',
'qs' => "reset=1&action=update&cid=%%id%%{$searchContext}{$extraParams}",
'title' => ts('Edit Contact Details'),
'ref' => 'edit-contact',
if ($value['key'] == 'delete') {
$contextVal = $searchContext;
}
-
$url = "civicrm/contact/view/{$value['key']}";
$qs = "reset=1&action=add&cid=%%id%%{$contextVal}{$extraParams}";
if ($value['key'] == 'activity') {
'qs' => $qs,
'title' => $value['title'],
'ref' => $value['ref'],
+ 'class' => CRM_Utils_Array::value('class', $value),
);
}
}
*/
function &getColumnHeaders($action = NULL, $output = NULL) {
$headers = NULL;
+
+ // unset return property elements that we don't care
+ if (!empty($this->_returnProperties)) {
+ $doNotCareElements = array(
+ 'contact_type',
+ 'contact_sub_type',
+ 'sort_name',
+ );
+ foreach ( $doNotCareElements as $value) {
+ unset($this->_returnProperties[$value]);
+ }
+ }
+
if ($output == CRM_Core_Selector_Controller::EXPORT) {
$csvHeaders = array(ts('Contact Id'), ts('Contact Type'));
foreach ($this->getColHeads($action, $output) as $column) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
foreach ($this->_fields as $name => $field) {
- if (CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($name, $skipFields)
) {
if (strpos($name, '-') !== FALSE) {
$properties = self::makeProperties($this->_returnProperties);
foreach ($properties as $prop) {
- if ($prop == 'contact_type' || $prop == 'contact_sub_type' || $prop == 'sort_name') {
- continue;
- }
-
if (strpos($prop, '-')) {
list($loc, $fld, $phoneType) = CRM_Utils_System::explode('-', $prop, 3);
$title = $this->_query->_fields[$fld]['title'];
}
elseif (isset($this->_query->_fields[$prop]) && isset($this->_query->_fields[$prop]['title'])) {
$title = $this->_query->_fields[$prop]['title'];
- } else {
+ }
+ else {
$title = '';
}
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);
$names = array();
static $skipFields = array('group', 'tag');
foreach ($this->_fields as $key => $field) {
- if (
- CRM_Utils_Array::value('in_selector', $field) &&
+ if (!empty($field['in_selector']) &&
!in_array($key, $skipFields)
) {
if (strpos($key, '-') !== FALSE) {
if ($output != CRM_Core_Selector_Controller::EXPORT) {
$row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contact_id;
- if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues)
- && CRM_Core_Permission::check('access deleted contacts')
+ if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts')
) {
$links = array(
array(
'name' => ts('View'),
'url' => 'civicrm/contact/view',
'qs' => 'reset=1&cid=%%id%%',
+ 'class' => 'no-popup',
'title' => ts('View Contact Details'),
),
array(
);
}
elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) ||
- ($config->mapGeoCoding &&
- CRM_Utils_Array::value('city', $row) &&
+ ($config->mapGeoCoding && !empty($row['city']) &&
CRM_Utils_Array::value('state_province', $row)
)
) {
foreach ($rows as $id => & $row) {
- if (CRM_Utils_Array::value('deleted_contacts', $this->_formValues)
- && CRM_Core_Permission::check('access deleted contacts')
+ if (!empty($this->_formValues['deleted_contacts']) && CRM_Core_Permission::check('access deleted contacts')
) {
$links = array(
array(
);
}
elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) ||
- ($config->mapGeoCoding &&
- CRM_Utils_Array::value('city', $row) &&
+ ($config->mapGeoCoding && !empty($row['city']) &&
CRM_Utils_Array::value('state_province', $row)
)
) {
$sql = str_replace($replaceSQL, $insertSQL, $sql);
- CRM_Core_Error::ignoreException();
+ $errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$result = CRM_Core_DAO::executeQuery($sql);
- CRM_Core_Error::setCallback();
+ unset($errorScope);
if (is_a($result, 'DB_Error')) {
// oops the above query failed, so lets just ignore it
);
foreach ($defaultAddress as $columnName => $column) {
- if (CRM_Utils_Array::value($columnName, $addressOptions)) {
+ if (!empty($addressOptions[$columnName])) {
self::$_columnHeaders[$columnName] = $column;
}
}