CRM-17684: check where end date is past to determine auto-renew subscription has...
authoryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 13 Jun 2016 09:59:06 +0000 (15:29 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 13 Jun 2016 09:59:06 +0000 (15:29 +0530)
----------------------------------------
* CRM-17684: Find Memberships with no auto-renew
  https://issues.civicrm.org/jira/browse/CRM-17684

CRM/Member/BAO/Query.php

index b1b2ec27df0129e25974d9483b08a1433aa6366a..dda4410cc9aa7f1037ade5e7b9a0053506f49b3a 100644 (file)
@@ -307,7 +307,7 @@ class CRM_Member_BAO_Query {
         } 
         elseif ($value == 5) {
           $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NOT NULL";
-          $query->_where[$grouping][] = " ccr.end_date IS NOT NULL";
+          $query->_where[$grouping][] = " ccr.end_date IS NOT NULL AND ccr.end_date < NOW()";
           $query->_qill[$grouping][] = ts("Membership is Auto-Renew and Ended");
         }
         $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1;
@@ -423,7 +423,7 @@ class CRM_Member_BAO_Query {
         'membership_recur_id' => 1,
         'member_campaign_id' => 1,
         'member_is_override' => 1,
-        'member_auto_renew' => '1',
+        'member_auto_renew' => 1,
       );
 
       if ($includeCustomFields) {