}
/**
+ * @todo - this form method needs to have the interaction with the form layer removed from it
+ * as a BAO function. Note that the api now supports membership renewals & it is not clear this function does anything
+ * not done by the membership.create api (with a lot less unit tests)
+ *
* This method will renew / create the membership depending on
* whether the given contact has a membership or not. And will add
* the modified dates for membership and in the log table.
// check is it pending. - CRM-4555
$pending = FALSE;
+ //@todo this is a BAO function & should not inspect the form - the form should do this
+ // & pass required params to the BAO
if (CRM_Utils_Array::value('minimum_fee', $membershipTypeDetails) > 0.0) {
if (((isset($form->_contributeMode) && $form->_contributeMode == 'notify') ||
CRM_Utils_Array::value('is_pay_later', $form->_params) ||
'api.address.get.2' => array('is_billing' => True, 'return' => $addressFields),
'api.email.get.1' => array('location_type_id' => 'Billing',),
'api.email.get.2' => array('is_billing' => True,),
- 'return' => 'api.email.get, api.address.get, api.address.getoptions, email, first_name, last_name, middle_name,' . implode($addressFields, ','),
+ 'return' => 'api.email.get, api.address.get, api.address.getoptions, state_province, email, first_name, last_name, middle_name, ' . implode($addressFields, ','),
)
);
'phone-1-1' => '021 512 755',
'country-1' => '1228',
'state_province-1' => '1021',
+ 'postal_code-1' => '90210',
),
'1' => array(
'first_name' => 'abc1',
'last_name' => 'xyz1',
+ 'postal_code-1' => '90210',
'country-1' => '1228',
'state_province-1' => '1021',
),
'Billing' => array(
'billing_first_name' => 'abc1',
- 'billing_middle_name' => '',
+ 'billing_middle_name' => 'J.',
'billing_last_name' => 'xyz1',
'billing_street_address-5' => '',
'billing_city-5' => '',
- 'billing_state_province_id-5' => '',
+ 'billing_state_province_id-5' => '1021',
'billing_country_id-5' => '',
+ 'billing_postal_code-5' => '90210',
'billing-email-5' => 'abc1.xyz1@yahoo.com',
+ 'email-5' => 'abc1.xyz1@yahoo.com',
),
),
);
'legal_identifier' => '',
'external_identifier' => '',
'sort_name' => 'xyz2, abc2',
- 'display_name' => 'abc2 xyz2',
+ 'display_name' => 'Mr. abc2 xyz2 II',
'nick_name' => '',
'legal_name' => '',
'image_URL' => '',
'hash' => '67eac7789eaee00',
'api_key' => '',
'first_name' => 'abc2',
- 'middle_name' => '',
+ 'middle_name' => 'J.',
'last_name' => 'xyz2',
- 'prefix_id' => '',
- 'suffix_id' => '',
+ 'prefix_id' => '3',
+ 'suffix_id' => '3',
'email_greeting_id' => '1',
'email_greeting_custom' => '',
'email_greeting_display' => 'Dear abc1',
'postal_greeting_display' => 'Dear abc1',
'addressee_id' => '1',
'addressee_custom' => '',
- 'addressee_display' => '{contact.individual_prefix} abc1 xyz1 {contact.individual_suffix}',
+ 'addressee_display' => '{contact.individual_prefix} abc1 J. xyz1 {contact.individual_suffix}',
'job_title' => '',
'gender_id' => '',
'birth_date' => '',
$this->assertFalse(array_key_exists('email-Primary', $result['values'][1]), 'profile 1 doesn not include email');
$this->assertEquals($result['values']['Billing'], array(
'billing_first_name' => 'abc1',
- 'billing_middle_name' => '',
+ 'billing_middle_name' => 'J.',
'billing_last_name' => 'xyz1',
'billing_street_address-5' => '',
'billing_city-5' => '',
- 'billing_state_province_id-5' => '',
+ 'billing_state_province_id-5' => '1021',
'billing_country_id-5' => '',
'billing-email-5' => 'abc1.xyz1@yahoo.com',
+ 'billing_postal_code-5' => '90210',
+ 'billing-email-5' => 'abc1.xyz1@yahoo.com',
+ 'email-5' => 'abc1.xyz1@yahoo.com',
));
}
$this->assertEquals('abc1', $result['values'][1]['first_name']);
$this->assertEquals($result['values']['Billing'], array(
'billing_first_name' => 'abc1',
- 'billing_middle_name' => '',
+ 'billing_middle_name' => 'J.',
'billing_last_name' => 'xyz1',
'billing_street_address-5' => '25 Big Street',
'billing_city-5' => 'big city',
'billing_state_province_id-5' => '',
'billing_country_id-5' => '',
'billing-email-5' => 'big@once.com',
+ 'email-5' => 'big@once.com',
+ 'billing_postal_code-5' => '',
));
}
/**
/*
* Helper function to create an Individual with address/email/phone info. Import UF Group and UF Fields
*/
- function _createIndividualContact() {
- $contactParams = array(
+ function _createIndividualContact($params = array()) {
+ $contactParams = array_merge(array(
'first_name' => 'abc1',
'last_name' => 'xyz1',
- 'contact_type' => 'Individual',
'email' => 'abc1.xyz1@yahoo.com',
'api.address.create' => array(
'location_type_id' => 1,
'state_province' => 'Michigan',
'supplemental_address_1' => 'Hallmark Ct',
'supplemental_address_2' => 'Jersey Village',
+ 'postal_code' => '90210',
),
'api.phone.create' => array(
'location_type_id' => '1',
'phone_type_id' => '1',
'is_primary' => '1',
),
+ ), $params
);
- $contact = $this->callAPISuccess('contact', 'create', $contactParams);
-
- $keys = array_keys($contact['values']);
- $contactId = array_pop($keys);
-
- $this->assertEquals(0, $contact['values'][$contactId]['api.address.create']['is_error'], "In line " . __LINE__ . " error message: " . CRM_Utils_Array::value('error_message', $contact['values'][$contactId]['api.address.create'])
- );
- $this->assertEquals(0, $contact['values'][$contactId]['api.phone.create']['is_error'], "In line " . __LINE__ . " error message: " . CRM_Utils_Array::value('error_message', $contact['values'][$contactId]['api.phone.create'])
- );
+ $contactID = $this->individualCreate($contactParams);
// Create new profile having group_type: Contact,Individual
$op = new PHPUnit_Extensions_Database_Operation_Insert();
// expected result of above created profile with contact Id $contactId
- $profileData[$contactId] = array(
+ $profileData[$contactID] = array(
'first_name' => 'abc1',
'last_name' => 'xyz1',
'email-Primary' => 'abc1.xyz1@yahoo.com',