Skip to content

Commit

Permalink
additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Oct 27, 2017
1 parent b07c960 commit 56d2808
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -4703,11 +4703,11 @@ public static function appendAnyValueToSelect($selectClauses, $groupBy) {
*
*/
public static function getGroupByFromOrderBy(&$groupBy, $orderBys) {
if (!CRM_Utils_SQL::disableFullGroupByMode()) {
if (CRM_Utils_SQL::disableFullGroupByMode()) {
foreach ($orderBys as $orderBy) {
$orderBy = str_replace(array(' DESC', ' ASC'), '', $orderBy); // remove sort syntax from ORDER BY clauses if present
// if ORDER BY column is not present in GROUP BY then append it to end
if (!strstr($groupBy, $orderBy)) {
if (preg_match('/(MAX|MIN)\(/i', trim($orderBy)) !== 1 && !strstr($groupBy, $orderBy)) {
$groupBy .= ", {$orderBy}";
}
}
Expand Down
2 changes: 2 additions & 0 deletions CRM/Report/Form/Mailing/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ public function __construct() {
'order_bys' => array(
'start_date' => array(
'title' => ts('Start Date'),
'dbAlias' => 'MAX(mailing_job_civireport.start_date)',
),
'end_date' => array(
'title' => ts('End Date'),
'default_weight' => '1',
'default_order' => 'DESC',
'dbAlias' => 'MAX(mailing_job_civireport.end_date)',
),
),
'grouping' => 'mailing-fields',
Expand Down

0 comments on commit 56d2808

Please sign in to comment.