* @param $membershipSource
* @param $isPayLater
* @param array $memParams
- * @param array $formDates
* @param null|CRM_Contribute_BAO_Contribution $contribution
* @param array $lineItems
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
- public static function processMembership($contactID, $membershipTypeID, $is_test, $changeToday, $modifiedID, $customFieldsFormatted, $numRenewTerms, $membershipID, $pending, $contributionRecurID, $membershipSource, $isPayLater, $memParams = [], $formDates = [], $contribution = NULL, $lineItems = []) {
+ public static function processMembership($contactID, $membershipTypeID, $is_test, $changeToday, $modifiedID, $customFieldsFormatted, $numRenewTerms, $membershipID, $pending, $contributionRecurID, $membershipSource, $isPayLater, $memParams = [], $contribution = NULL, $lineItems = []) {
$renewalMode = $updateStatusId = FALSE;
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$format = '%Y%m%d';
$currentMembership['join_date'] = CRM_Utils_Date::customFormat($currentMembership['join_date'], $format);
foreach (['start_date', 'end_date'] as $dateType) {
- $currentMembership[$dateType] = $formDates[$dateType] ?? NULL;
- if (empty($currentMembership[$dateType])) {
- $currentMembership[$dateType] = $dates[$dateType] ?? NULL;
- }
+ $currentMembership[$dateType] = $dates[$dateType] ?? NULL;
}
$currentMembership['is_test'] = $is_test;
// Insert renewed dates for CURRENT membership
$memParams['join_date'] = CRM_Utils_Date::isoToMysql($membership->join_date);
- $memParams['start_date'] = $formDates['start_date'] ?? CRM_Utils_Date::isoToMysql($membership->start_date);
- $memParams['end_date'] = $formDates['end_date'] ?? NULL;
- if (empty($memParams['end_date'])) {
- $memParams['end_date'] = $dates['end_date'] ?? NULL;
- }
+ $memParams['start_date'] = CRM_Utils_Date::isoToMysql($membership->start_date);
+ $memParams['end_date'] = $dates['end_date'] ?? NULL;
$memParams['membership_type_id'] = $membershipTypeID;
//set the log start date.
$dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membershipTypeID, NULL, NULL, NULL, $numRenewTerms);
foreach (['join_date', 'start_date', 'end_date'] as $dateType) {
- $memParams[$dateType] = $formDates[$dateType] ?? NULL;
- if (empty($memParams[$dateType])) {
- $memParams[$dateType] = $dates[$dateType] ?? NULL;
- }
+ $memParams[$dateType] = $dates[$dateType] ?? NULL;
}
$status = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate(CRM_Utils_Date::customFormat($dates['start_date'],