$now = CRM_Utils_Date::getToday(NULL, 'YmdHis');
$this->assign('receive_date', CRM_Utils_Array::value('receive_date', $this->_params, date('Y-m-d H:i:s')));
$this->processBillingAddress();
- list($userName) = CRM_Contact_BAO_Contact_Location::getEmailDetails(CRM_Core_Session::singleton()->get('userID'));
+
$this->_params['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_params,
CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee')
);
if (!empty($this->_params['record_contribution']) || $this->_mode) {
// set the source
+ list($userName) = CRM_Contact_BAO_Contact_Location::getEmailDetails(CRM_Core_Session::singleton()->get('userID'));
$this->_params['contribution_source'] = "{$this->membershipTypeName} Membership: Offline membership renewal (by {$userName})";
//create line items
- $lineItem = [];
$this->_params = $this->setPriceSetParameters($this->_params);
$order = new CRM_Financial_BAO_Order();
+--------------------------------------------------------------------+
*/
+use Civi\Api4\Contact;
+
/**
* Test CRM_Member_Form_Membership functions.
*
*/
public function testSubmit() {
$form = $this->getForm();
- $this->createLoggedInUser();
+ $loggedInUserID = $this->createLoggedInUser();
+ $loggedInUserDisplayName = Contact::get()->addWhere('id', '=', $loggedInUserID)->addSelect('display_name')->execute()->first()['display_name'];
$params = $this->getBaseSubmitParams();
$form->_contactID = $this->_individualId;
$form->setRenewalMessage();
$membership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $this->_individualId]);
$this->callAPISuccessGetCount('ContributionRecur', ['contact_id' => $this->_individualId], 0);
- $contribution = $this->callAPISuccess('Contribution', 'get', [
+ $contribution = $this->callAPISuccessGetSingle('Contribution', [
'contact_id' => $this->_individualId,
'is_test' => TRUE,
]);
+ $expectedContributionSource = 'AnnualFixed Membership: Offline membership renewal (by ' . $loggedInUserDisplayName . ')';
+ $this->assertEquals($expectedContributionSource, $contribution['contribution_source']);
$this->callAPISuccessGetCount('LineItem', [
'entity_id' => $membership['id'],
$params = [
'cid' => $this->_individualId,
'price_set_id' => 0,
- 'join_date' => date('m/d/Y', time()),
+ 'join_date' => date('m/d/Y'),
'start_date' => '',
'end_date' => '',
'campaign_id' => '',
$originalMembership = $this->callAPISuccessGetSingle('membership', []);
$params = [
'cid' => $this->_individualId,
- 'join_date' => date('m/d/Y', time()),
+ 'join_date' => date('m/d/Y'),
'start_date' => '',
'end_date' => '',
// This format reflects the 23 being the organisation & the 25 being the type.
$originalMembership = $this->callAPISuccessGetSingle('membership', []);
$params = [
'cid' => $this->_individualId,
- 'join_date' => date('m/d/Y', time()),
+ 'join_date' => date('m/d/Y'),
'start_date' => '',
'end_date' => '',
// This format reflects the 23 being the organisation & the 25 being the type.