From b204fd50959de27c875eadd82b7513cd15a85a6e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 29 Jan 2015 09:49:51 +1300 Subject: [PATCH] remove unused variable & improve spelling, commments --- CRM/Member/BAO/Membership.php | 2 +- CRM/Member/BAO/MembershipType.php | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 38f42056a2..e91fe09eda 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -105,7 +105,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { if (empty($membership->contact_id) || empty($membership->status_id)) { // this means we are in renewal mode and are just updating the membership // record or this is an API update call and all fields are not present in the update record - // however the hooks dont care and want all data CRM-7784 + // however the hooks don't care and want all data CRM-7784 $tempMembership = new CRM_Member_DAO_Membership(); $tempMembership->id = $membership->id; $tempMembership->find(TRUE); diff --git a/CRM/Member/BAO/MembershipType.php b/CRM/Member/BAO/MembershipType.php index e26b370969..3677d57687 100644 --- a/CRM/Member/BAO/MembershipType.php +++ b/CRM/Member/BAO/MembershipType.php @@ -163,6 +163,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { $baoString = 'CRM_Member_BAO_' . $name; $dao = new $baoString(); $dao->$field = $membershipTypeId; + /** @noinspection PhpUndefinedMethodInspection */ if ($dao->find(TRUE)) { $check = TRUE; $status[] = $name; @@ -359,7 +360,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { $fixedStartDate = date('Y-m-d', mktime(0, 0, 0, $startMonth, $startDay, $year - 1)); } $actualStartDate = $fixedStartDate; - $fixed_period_rollover = self::isDuringFixedAnnualRolloverPeriod($joinDate, $numRenewTerms, $membershipTypeDetails, $year, $fixedStartDate); + $fixed_period_rollover = self::isDuringFixedAnnualRolloverPeriod($joinDate, $membershipTypeDetails, $year, $fixedStartDate); if (!$startDate) { $startDate = $actualStartDate; @@ -440,13 +441,12 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * May and June will return TRUE and between June and May will return FALSE * * @param string $startDate start date of current membership period - * @param int $numRenewTerms * @param array $membershipTypeDetails * @param int $year - * @param $actualStartDate + * @param $fixedStartDate * @return bool is this in the window where the membership gets an extra part-period added */ - protected static function isDuringFixedAnnualRolloverPeriod($startDate, $numRenewTerms, $membershipTypeDetails, $year, $actualStartDate) { + protected static function isDuringFixedAnnualRolloverPeriod($startDate, $membershipTypeDetails, $year, $fixedStartDate) { $rolloverMonth = substr($membershipTypeDetails['fixed_period_rollover_day'], 0, strlen($membershipTypeDetails['fixed_period_rollover_day']) - 2 @@ -627,17 +627,17 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * array of the details of membership types with Member of Contact id */ public static function getMemberOfContactByMemTypes($membershipTypes) { - $memTypeOrgs = array(); + $memTypeOrganizations = array(); if (empty($membershipTypes)) { - return $memTypeOrgs; + return $memTypeOrganizations; } $result = CRM_Core_DAO::executeQuery("SELECT id, member_of_contact_id FROM civicrm_membership_type WHERE id IN (" . implode(',', $membershipTypes) . ")"); while ($result->fetch()) { - $memTypeOrgs[$result->id] = $result->member_of_contact_id; + $memTypeOrganizations[$result->id] = $result->member_of_contact_id; } - return $memTypeOrgs; + return $memTypeOrganizations; } /** @@ -648,7 +648,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * @return array */ public static function getMembershipTypeOrganization($membershipTypeId = NULL) { - $allmembershipTypes = array(); + $allMembershipTypes = array(); $membershipType = new CRM_Member_DAO_MembershipType(); @@ -658,9 +658,9 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { $membershipType->find(); while ($membershipType->fetch()) { - $allmembershipTypes[$membershipType->id] = $membershipType->member_of_contact_id; + $allMembershipTypes[$membershipType->id] = $membershipType->member_of_contact_id; } - return $allmembershipTypes; + return $allMembershipTypes; } /** @@ -779,6 +779,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * @param array $params */ public static function updateAllPriceFieldValue($membershipTypeId, $params) { + $updateFields = array(); if (!empty($params['minimum_fee'])) { $amount = $params['minimum_fee']; } -- 2.25.1