Merge pull request #2909 from jake-mw/crm-14472
authorDave Greenberg <dave@civicrm.org>
Mon, 28 Apr 2014 20:49:26 +0000 (13:49 -0700)
committerDave Greenberg <dave@civicrm.org>
Mon, 28 Apr 2014 20:49:26 +0000 (13:49 -0700)
CRM-14472 - query correct table for contribution-type vs. event-type PCPs

CRM/Contact/Page/AJAX.php

index d10afbfdd6e6ff6437404955455f49ebf422915d..102924e7658689f770df2126481a177f6d895f92 100644 (file)
@@ -227,7 +227,12 @@ class CRM_Contact_Page_AJAX {
             SELECT pcp.id as id, CONCAT_WS( ' :: ', {$select} ) as data, sort_name
             FROM civicrm_pcp pcp, civicrm_contribution_page cp, civicrm_contact cc
             {$includeEmailFrom}
-            {$whereClause}
+            {$whereClause} AND pcp.page_type = 'contribute'
+            UNION ALL
+            SELECT pcp.id as id, CONCAT_WS( ' :: ', {$select} ) as data, sort_name
+            FROM civicrm_pcp pcp, civicrm_event cp, civicrm_contact cc
+            {$includeEmailFrom}
+            {$whereClause} AND pcp.page_type = 'event'
             LIMIT 0, {$limit}
             ) t
         ORDER BY sort_name