Skip to content

Commit

Permalink
Merge pull request #22665 from colemanw/memberCleanup
Browse files Browse the repository at this point in the history
[REF] Cleanup docblocks & unused vars in Membership BAO
  • Loading branch information
demeritcowboy authored Feb 23, 2022
2 parents 9ed895d + 1591730 commit 2107ac8
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,11 @@ public static function add(&$params) {
* @param array $values
* Output values of the object.
* @param bool $active
* Do you want only active memberships to.
* be returned
* Return only memberships with an 'is_current_member' status.
*
* @return CRM_Member_BAO_Membership|null
* The found object or null
* @return CRM_Member_BAO_Membership[]|null
*/
public static function &getValues(&$params, &$values, $active = FALSE) {
public static function getValues($params, &$values, $active = FALSE) {
if (empty($params)) {
return NULL;
}
Expand Down Expand Up @@ -644,7 +642,6 @@ public static function deleteMembership($membershipId, $preserveContrib = FALSE)

$transaction = new CRM_Core_Transaction();

$results = NULL;
//delete activity record
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');

Expand Down Expand Up @@ -685,11 +682,11 @@ public static function deleteMembership($membershipId, $preserveContrib = FALSE)
* @param int $ownerMembershipId
* @param int $contactId
*
* @return null
* @return void
*/
public static function deleteRelatedMemberships($ownerMembershipId, $contactId = NULL) {
if (!$ownerMembershipId && !$contactId) {
return FALSE;
return;
}

$membership = new CRM_Member_DAO_Membership();
Expand All @@ -715,7 +712,7 @@ public static function deleteRelatedMemberships($ownerMembershipId, $contactId =
* @param string $status
* Active or inactive.
*
* @return array
* @return array|null
* array of memberships based on status
*/
public static function activeMembers($memberships, $status = 'active') {
Expand Down Expand Up @@ -2188,13 +2185,12 @@ public function processPriceSet($membershipId, $lineItem) {
* @param bool $all
* if more than one payment associated with membership id need to be returned.
*
* @return int|int[]
* @return int|int[]|null
* contribution id
* @todo we should get this off the line item
*
*/
public static function getMembershipContributionId($membershipId, $all = FALSE) {

$membershipPayment = new CRM_Member_DAO_MembershipPayment();
$membershipPayment->membership_id = $membershipId;
if ($all && $membershipPayment->find()) {
Expand Down Expand Up @@ -2293,21 +2289,17 @@ public static function updateAllMembershipStatus($params = []) {
AND {$membershipStatusClause}
AND civicrm_membership.owner_membership_id IS NULL ";

$allMembershipTypes = CRM_Member_BAO_MembershipType::getAllMembershipTypes();

$dao2 = CRM_Core_DAO::executeQuery($query, $queryParams);

while ($dao2->fetch()) {
$processCount++;

// CRM-7248: added excludeIsAdmin param to the following fn call to prevent moving to admin statuses
//get the membership status as per id.
$newStatus = civicrm_api3('membership_status', 'calc',
[
'membership_id' => $dao2->membership_id,
'ignore_admin_only' => TRUE,
], TRUE
);
$newStatus = civicrm_api3('membership_status', 'calc', [
'membership_id' => $dao2->membership_id,
'ignore_admin_only' => TRUE,
]);
$statusId = $newStatus['id'] ?? NULL;

//process only when status change.
Expand Down

0 comments on commit 2107ac8

Please sign in to comment.