Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/277686

Change subject: CRM-18246 Lybunt group clause not being included in temp table 
due to order of operations
......................................................................

CRM-18246 Lybunt group clause not being included in temp table due to order of 
operations

Bug: T123671

Change-Id: Ic21e5df2666ff68a1f089e1f24cbb699071a2a26
---
M CRM/Report/Form/Contribute/Lybunt.php
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/86/277686/1

diff --git a/CRM/Report/Form/Contribute/Lybunt.php 
b/CRM/Report/Form/Contribute/Lybunt.php
index 3e344b3..ae9ded9 100644
--- a/CRM/Report/Form/Contribute/Lybunt.php
+++ b/CRM/Report/Form/Contribute/Lybunt.php
@@ -414,7 +414,13 @@
    * @return string
    */
   public function whereGroupClause($field, $value, $op) {
-    if (empty($this->contactTempTable)) {
+    if ($op == 'notin') {
+      // We do not have an optimisation for this scenario at this stage. Use
+      // parent.
+      return parent::whereGroupClause($field, $value, $op);
+    }
+
+    if (empty($this->groupTempTable)) {
       $group = new CRM_Contact_DAO_Group();
       $group->is_active = 1;
       $group->find();
@@ -654,10 +660,13 @@
    * @return string
    */
   public function buildQuery($applyLimit = TRUE) {
+
+    // Calling where & select before FROM allows us to build temp tables to 
use in from.
+    $this->where();
     $this->select();
     $this->from();
     $this->customDataFrom(empty($this->contactTempTable));
-    $this->where();
+
     $this->groupBy();
     $this->orderBy();
     $limitFilter = '';

-- 
To view, visit https://gerrit.wikimedia.org/r/277686
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic21e5df2666ff68a1f089e1f24cbb699071a2a26
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to