* For Membership Signup or Renewal.
* @param int $targetContactID
* @param array $params
- * Activity params to override
+ * Activity params to override.
*
* @return bool|NULL
*/
}
/**
- * Get activity subject on basis of component object
+ * Get activity subject on basis of component object.
*
* @param object $entityObj
- * (reference) particular component object.
+ * particular component object.
*
* @return string
*/
'source_record_id' => $membership->id,
'activity_type_id' => $activityType,
'status_id' => 'Scheduled',
+ 'options' => array(
+ 'limit' => 1,
+ 'sort' => 'id DESC',
+ ),
)
)
);
- // 1. Update Schedule Membership Signup/Renwal activity to completed on successful payment of pending membership
+ // 1. Update Schedule Membership Signup/Renewal activity to completed on successful payment of pending membership
// 2. OR Create renewal activity scheduled if its membership renewal will be paid later
if ($scheduledActivityID) {
CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $membership->contact_id, array('id' => $scheduledActivityID));
array(
'subject' => "Status changed from {$allStatus[$oldStatus]} to {$allStatus[$membership->status_id]}",
'source_contact_id' => $membershipLog['modified_id'],
- 'priority_id' => 2,
+ 'priority_id' => 'Normal',
)
);
}
// reset the group contact cache since smart groups might be affected due to this
CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
- $activityParams = array();
$allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
- if (!empty($params['is_pay_later']) ||
- in_array($allStatus[$membership->status_id], array('Pending', 'Grace'))
- ) {
+ $activityParams = array(
+ 'status_id' => CRM_Utils_Array::value('membership_activity_status', $params, 'Completed'),
+ );
+ if (in_array($allStatus[$membership->status_id], array('Pending', 'Grace'))) {
$activityParams['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
}
array(
'subject' => "Status changed from {$allStatus[$oldStatus]} to {$allStatus[$membership->status_id]}",
'source_contact_id' => $membershipLog['modified_id'],
- 'priority_id' => 2,
+ 'priority_id' => 'Normal',
)
);
}
array(
'subject' => "Type changed from {$membershipTypes[$oldType]} to {$membershipTypes[$membership->membership_type_id]}",
'source_contact_id' => $membershipLog['modified_id'],
- 'priority_id' => 2,
+ 'priority_id' => 'Normal',
)
);
}
'join_date' => $currentMembership['join_date'],
'membership_type_id' => $membershipTypeID,
'max_related' => !empty($membershipTypeDetails['max_related']) ? $membershipTypeDetails['max_related'] : NULL,
- 'is_pay_later' => $isPayLater,
+ 'membership_activity_status' => $isPayLater ? 'Scheduled' : 'Completed',
);
if ($contributionRecurID) {
$memParams['contribution_recur_id'] = $contributionRecurID;
);
$this->setUpPendingContribution($this->_ids['price_field_value'][0]);
$this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
- // Case 1: Assert that Membership Signup Activity is created on Pending (Pay later) to Completed Contribution via backoffice
+ // Case 1: Assert that Membership Signup Activity is created on Pending to Completed Contribution via backoffice
$activity = $this->callAPISuccess('Activity', 'get', array(
'activity_type_id' => 'Membership Signup',
'source_record_id' => $this->_ids['membership'],
catch (Civi\Payment\Exception\PaymentProcessorException $e) {
$error = TRUE;
}
- // Case 2: After successful payment for Pending (Pay later) backoffice there are three activities created
+ // Case 2: After successful payment for Pending backoffice there are three activities created
// 2.a Update status of existing Scheduled Membership Signup (created in step 1) to Completed
$activity = $this->callAPISuccess('Activity', 'get', array(
'activity_type_id' => 'Membership Signup',