From 12ba37a009cb663476cda6e046a12f00cfacce37 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 22 May 2013 20:12:56 -0500 Subject: [PATCH] Restore timezone handling CRM-10573 --- CRM/Contact/BAO/Query.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 377617fac7..b02f972a88 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -3784,21 +3784,22 @@ WHERE id IN ( $groupIDs ) $this->_qill[$grouping][] = "$allRelationshipType[$value] ( " . implode(", ", $qillNames) . " )"; } - + // Note we do not currently set mySql to handle timezones, so doing this the old-fashioned way + $today = date('Ymd'); //check for active, inactive and all relation status if ($relStatus[2] == 0) { $this->_where[$grouping][] = "( civicrm_relationship.is_active = 1 AND -( civicrm_relationship.end_date IS NULL OR civicrm_relationship.end_date >= CURDATE() ) AND -( civicrm_relationship.start_date IS NULL OR civicrm_relationship.start_date <= CURDATE() ) +( civicrm_relationship.end_date IS NULL OR civicrm_relationship.end_date >= {$today} ) AND +( civicrm_relationship.start_date IS NULL OR civicrm_relationship.start_date <= {$today} ) )"; $this->_qill[$grouping][] = ts('Relationship - Active and Current'); } elseif ($relStatus[2] == 1) { $this->_where[$grouping][] = "( civicrm_relationship.is_active = 0 OR -civicrm_relationship.end_date < CURDATE() OR -civicrm_relationship.start_date > CURDATE() +civicrm_relationship.end_date < {$today} OR +civicrm_relationship.start_date > {$today} )"; $this->_qill[$grouping][] = ts('Relationship - Inactive or not Current'); } -- 2.25.1