Skip to content

Commit

Permalink
Dev/Core#90 Apply disabling Full Group By to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Apr 29, 2018
1 parent 26adcf7 commit 66ddb27
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ class CRM_Report_Form extends CRM_Core_Form {
*/

protected $sqlArray;

/**
* Can this report use the sql mode ONLY_FULL_GROUP_BY.
* @var bool
*/
public $optimisedForOnlyFullGroupBy = TRUE;
/**
* Class constructor.
*/
Expand Down Expand Up @@ -2952,7 +2958,11 @@ public function unselectedSectionColumns() {
* @param array $rows
*/
public function buildRows($sql, &$rows) {
if (!$this->optimisedForOnlyFullGroupBy) {
CRM_Core_DAO::disableFullGroupByMode();
}
$dao = CRM_Core_DAO::executeQuery($sql);
CRM_Core_DAO::enableFullGroupByMode();
if (!is_array($rows)) {
$rows = array();
}
Expand Down
1 change: 1 addition & 0 deletions CRM/Report/Form/Contribute/Lybunt.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
* Class constructor.
*/
public function __construct() {
$this->optimisedForOnlyFullGroupBy = FALSE;
$this->_rollup = 'WITH ROLLUP';
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$yearsInPast = 10;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Contribute/SoftCredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
/**
*/
public function __construct() {

$this->optimisedForOnlyFullGroupBy = FALSE;
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
Expand Down
1 change: 1 addition & 0 deletions CRM/Report/Form/Mailing/Opened.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class CRM_Report_Form_Mailing_Opened extends CRM_Report_Form {
* Class constructor.
*/
public function __construct() {
$this->optimisedForOnlyFullGroupBy = FALSE;
$this->_columns = array();

$this->_columns['civicrm_contact'] = array(
Expand Down

0 comments on commit 66ddb27

Please sign in to comment.