CRM-13816 - Undefined index notice due to disabled memberships in CRM_Member_BAO_Memb...
authorDonald A. Lobo <lobo@civicrm.org>
Fri, 22 Nov 2013 18:53:13 +0000 (10:53 -0800)
committerDonald A. Lobo <lobo@civicrm.org>
Fri, 22 Nov 2013 18:53:13 +0000 (10:53 -0800)
http://issues.civicrm.org/jira/browse/CRM-13816

CRM/Member/BAO/Membership.php

index dd1ffe8354e6ac2c410214cc4a01720b76053689..5ba8d740fc1dea05300ad38f32a019a7cc9a7938 100644 (file)
@@ -2464,6 +2464,7 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id AND
     $allTypes      = CRM_Member_PseudoConstant::membershipType();
     $contribStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
 
+    // get only memberships with active membership types
     $query = "
 SELECT     civicrm_membership.id                    as membership_id,
            civicrm_membership.is_override           as is_override,
@@ -2479,6 +2480,8 @@ SELECT     civicrm_membership.id                    as membership_id,
            civicrm_membership.contribution_recur_id as recur_id
 FROM       civicrm_membership
 INNER JOIN civicrm_contact ON ( civicrm_membership.contact_id = civicrm_contact.id )
+INNER JOIN civicrm_membership_type ON
+  (civicrm_membership.membership_type_id = civicrm_membership_type.id AND civicrm_membership_type.is_active = 1)
 WHERE      civicrm_membership.is_test = 0";
 
     $params = array();
@@ -2494,20 +2497,6 @@ WHERE      civicrm_membership.is_test = 0";
       // echo ".";
       $processCount++;
 
-      /**
-       $count++;
-       echo $dao->contact_id . ', '. CRM_Utils_System::memory( ) . "<p>\n";
-
-       CRM_Core_Error::debug( 'fBegin', count( $GLOBALS['_DB_DATAOBJECT']['RESULTS'] ) );
-       if ( $count > 2 ) {
-       foreach ( $GLOBALS['_DB_DATAOBJECT']['RESULTS'] as $r ) {
-       CRM_Core_Error::debug( 'r', $r->query );
-       }
-       // CRM_Core_Error::debug( 'f', $GLOBALS['_DB_DATAOBJECT']['RESULTS'] );
-       exit( );
-       }
-       **/
-
       // Put common parameters into array for easy access
       $memberParams = array(
         'id' => $dao->membership_id,