Restore timezone handling CRM-10573
authorColeman Watts <coleman@civicrm.org>
Thu, 23 May 2013 01:12:56 +0000 (20:12 -0500)
committerColeman Watts <coleman@civicrm.org>
Thu, 23 May 2013 01:12:56 +0000 (20:12 -0500)
CRM/Contact/BAO/Query.php

index 377617fac745c69368aa227de7ac73778be9f90e..b02f972a88f7d759891e79f0a2f889aa42e8fda0 100644 (file)
@@ -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');
     }