<?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$
*
*/
if ($queryMode != CRM_Contact_BAO_Query::MODE_CONTACTS) {
$componentReturnProperties = CRM_Contact_BAO_Query::defaultReturnProperties($queryMode);
if ($queryMode == CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
- // Following is not automatically populated because contribution search doesn't require them by default
- $componentReturnProperties['contribution_soft_credit_name'] = 1;
- $componentReturnProperties['contribution_soft_credit_amount'] = 1;
- $componentReturnProperties['contribution_soft_credit_type'] = 1;
- $componentReturnProperties['contribution_soft_credit_contribution_id'] = 1;
+ // soft credit columns are not automatically populated, because contribution search doesn't require them by default
+ $componentReturnProperties =
+ array_merge(
+ $componentReturnProperties,
+ CRM_Contribute_BAO_Query::softCreditReturnProperties(TRUE));
}
$returnProperties = array_merge($returnProperties, $componentReturnProperties);
switch ($exportMode) {
case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
- if (!CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled()) {
- // apply group-by only when no soft credit columns are included
- $groupBy = 'GROUP BY civicrm_contribution.id';
+ $groupBy = 'GROUP BY civicrm_contribution.id';
+ if (CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled()) {
+ // especial group by when soft credit columns are included
+ $groupBy = 'GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.scredit_id';
}
break;
elseif ($field == 'pledge_next_pay_amount') {
$row[$field] = $dao->pledge_next_pay_amount + $dao->pledge_outstanding_amount;
}
- elseif (in_array(substr($field, 0, -3), array('gender', 'prefix', 'suffix', 'communication_style'))) {
- $row[$field] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $field, $dao->$field);
- }
elseif (is_array($value) && $field == 'location') {
// fix header for location type case
foreach ($value as $ltype => $val) {