$full[] = [
'contact_id' => $this->ids['Contact'][$id],
'contact_type' => 'Individual',
- 'sort_name' => 'Contact ' . $id . ', Test',
+ 'sort_name' => 'Contact ' . $id . ', Test II',
];
}
}
'name' => 'sort_name_format',
'type' => 'String',
'html_type' => 'textarea',
- 'default' => '{contact.last_name}{, }{contact.first_name}',
+ 'default' => '{contact.last_name}{, }{contact.first_name}{ }{contact.suffix_id:label}',
'add' => '4.1',
'title' => ts('Individual Sort Name Format'),
'is_domain' => 1,
$activityGetParams += ['contact_id' => $contactId];
$activities = CRM_Activity_BAO_Activity::getContactActivitySelector($activityGetParams);
// Assert that we have sensible data to display in the contact tab
- $this->assertEquals('Anderson, Anthony', $activities['data'][0]['source_contact_name']);
+ $this->assertEquals('Anderson, Anthony II', $activities['data'][0]['source_contact_name']);
// Note that because there is a target contact but it is not accessible the output is an empty string not n/a
$this->assertEquals('', $activities['data'][0]['target_contact_name']);
// verify that doing the underlying query shows we get a target contact_id
$activities = CRM_Activity_BAO_Activity::getActivities($params);
//verify target count
$this->assertEquals($targetCount, $activities[1]['target_contact_count']);
- $this->assertEquals([$targetContactIDs[0] => 'Anderson, Anthony'], $activities[1]['target_contact_name']);
- $this->assertEquals('Anderson, Anthony', $activities[1]['source_contact_name']);
- $this->assertEquals('Anderson, Anthony', $activities[1]['assignee_contact_name'][4]);
+ $this->assertEquals([$targetContactIDs[0] => 'Anderson, Anthony II'], $activities[1]['target_contact_name']);
+ $this->assertEquals('Anderson, Anthony II', $activities[1]['source_contact_name']);
+ $this->assertEquals('Anderson, Anthony II', $activities[1]['assignee_contact_name'][4]);
}
/**
$expected = [
'assignee_contact' => [0 => $activity['target_contact_id']],
// it's always Julia
- 'assignee_contact_value' => 'Anderson, Julia',
+ 'assignee_contact_value' => 'Anderson, Julia II',
'target_contact' => [0 => $activity['target_contact_id']],
- 'target_contact_value' => 'Anderson, Julia',
+ 'target_contact_value' => 'Anderson, Julia II',
'source_contact' => $activityMoreInfo['source_contact_sort_name'],
'case_subject' => NULL,
'id' => $activity['id'],
[
'contact_id' => '3',
'contact_type' => '<a href="/index.php?q=civicrm/contact/view&reset=1&cid=3" data-tooltip-url="/index.php?q=civicrm/profile/view&reset=1&gid=7&id=3&snippet=4&is_show_email_task=1" class="crm-summary-link"><i class="crm-i fa-fw fa-user" title=""></i></a>',
- 'sort_name' => 'Anderson, Anthony',
+ 'sort_name' => 'Anderson, Anthony II',
'display_name' => 'Mr. Anthony Anderson II',
'activity_id' => '1',
'activity_date_time' => '2017-01-30 00:00:00',
'target_contact_name' => [],
'assignee_contact_name' => [],
'source_contact_id' => '3',
- 'source_contact_name' => 'Anderson, Anthony',
+ 'source_contact_name' => 'Anderson, Anthony II',
'checkbox' => 'mark_x_1',
'mailingId' => '',
'action' => '<span><a href="/index.php?q=civicrm/contact/view/contribution&action=view&reset=1&id=1&cid=3&context=search&searchContext=activity&key=' . $qfKey . '" class="action-item crm-hover-button" title=\'View Activity\' >View</a></span>',
$this->assertEquals('1', $contact->do_not_trade, 'Check for do_not_trade creation.');
$this->assertEquals('1', $contact->is_opt_out, 'Check for is_opt_out creation.');
$this->assertEquals($params['external_identifier'], $contact->external_identifier, 'Check for external_identifier creation.');
- $this->assertEquals($params['last_name'] . ', ' . $params['first_name'], $contact->sort_name, 'Check for sort_name creation.');
+ $this->assertEquals($params['last_name'] . ', ' . $params['first_name'] . ' Sr.', $contact->sort_name, 'Check for sort_name creation.');
$this->assertEquals($params['contact_source'], $contact->source, 'Check for contact_source creation.');
$this->assertEquals($params['prefix_id'], $contact->prefix_id, 'Check for prefix_id creation.');
$contact = new CRM_Contact_DAO_Contact();
CRM_Contact_BAO_Individual::format($params, $contact);
$this->assertEquals('Mr. Ben Lee Jr.', $contact->display_name);
- $this->assertEquals('Lee, Ben', $contact->sort_name);
+ $this->assertEquals('Lee, Ben Jr.', $contact->sort_name);
// Check with legacy tokens too.
\Civi::settings()->set('display_name_format', '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}');
$contact = new CRM_Contact_DAO_Contact();
CRM_Contact_BAO_Individual::format($params, $contact);
$this->assertEquals('Mr. Ben Lee Jr.', $contact->display_name);
- $this->assertEquals('Lee, Ben', $contact->sort_name);
+ $this->assertEquals('Lee, Ben Jr.', $contact->sort_name);
}
/**
[$select, $from, $where, $having] = $queryObj->query();
$dao = CRM_Core_DAO::executeQuery("$select $from $where $having");
$dao->fetch();
- $this->assertEquals('Anderson, Anthony', $dao->sort_name);
+ $this->assertEquals('Anderson, Anthony II', $dao->sort_name);
}
catch (PEAR_Exception $e) {
$err = $e->getCause();
$contributionID = $this->callAPISuccess('Contribution', 'create', $param)['id'];
// Display sort name during Update multiple contributions.
- $this->assertEquals('Watson, Shane', CRM_Contribute_BAO_Contribution::sortName($contributionID));
+ $this->assertEquals('Watson, Shane II', CRM_Contribute_BAO_Contribution::sortName($contributionID));
}
/**
'do_not_trade' => 1,
'is_opt_out' => 1,
'external_identifier' => 'blah',
- 'sort_name' => 'Smith, Robert',
+ 'sort_name' => 'Smith, Robert II',
'display_name' => 'Robert Smith',
'nick_name' => 'Bob',
'image_URL' => 'https://example.com',
do_not_trade:1
is_opt_out:1
external_identifier:blah
-sort_name:Smith, Robert
+sort_name:Smith, Robert II
display_name:Mr. Robert Smith II
nick_name:Bob
image_URL:https://example.com
do_not_trade:label |Yes
is_opt_out:label |Yes
external_identifier |blah
-sort_name |Smith, Robert
+sort_name |Smith, Robert II
display_name |Mr. Robert Smith II
nick_name |Bob
image_URL |https://example.com
*/
public function testParticipantDetails(): void {
$participant = $this->callAPISuccess('Participant', 'create', ['contact_id' => $this->ids['Contact']['individual_0'], 'event_id' => $this->getEventID()]);
- $params = ['name' => 'Anderson, Anthony', 'title' => 'Annual CiviCRM meet'];
+ $params = ['name' => 'Anderson, Anthony II', 'title' => 'Annual CiviCRM meet'];
$participantDetails = CRM_Event_BAO_Participant::participantDetails($participant['id']);
$row = $this->csv->fetchOne(1);
$this->assertEquals(95, $row['Net Amount']);
$this->assertEquals(5, $row['Soft Credit Amount']);
- $this->assertEquals('Anderson, Anthony', $row['Soft Credit For']);
+ $this->assertEquals('Anderson, Anthony II', $row['Soft Credit For']);
$this->assertEquals($this->contributionIDs[0], $row['Soft Credit For Contribution ID']);
// Ideally we would use a randomised temp table name & use generic temp cleanup for cleanup - but
'No Bulk Emails (User Opt Out)' => '',
'Legal Identifier' => '',
'External Identifier' => '',
- 'Sort Name' => 'Anderson, Anthony',
+ 'Sort Name' => 'Anderson, Anthony II',
'Display Name' => 'Mr. Anthony Anderson II',
'Nickname' => '',
'Legal Name' => '',
'No Bulk Emails (User Opt Out)' => '',
'Legal Identifier' => '',
'External Identifier' => '',
- 'Sort Name' => 'Anderson, Anthony',
+ 'Sort Name' => 'Anderson, Anthony II',
'Display Name' => 'Mr. Anthony Anderson II',
'Nickname' => '',
'Legal Name' => '',
$json = CRM_Financial_Page_AJAX::getFinancialTransactionsList();
$json = str_replace(rtrim(CIVICRM_UF_BASEURL, '/'), 'http://FIX ME', $json);
$this->assertEquals('{"sEcho": 1, "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["","<a href=\"/index.php?q=civicrm/contact/view&reset=1&cid=3\" data-tooltip-url=\"/index.php?q=civicrm/profile/view&reset=1&gid=7&id=3&snippet=4&is_show_email_task=1\" class=\"crm-summary-link\">'
- . '<i class=\"crm-i fa-fw fa-user\" title=\"\"></i></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&cid=3>Anderson, Anthony</a>","$100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
+ . '<i class=\"crm-i fa-fw fa-user\" title=\"\"></i></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&cid=3>Anderson, Anthony II</a>","$100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
. '"Credit Card","Completed","Donation","<span><a href=\"/index.php?q=civicrm/contact/view/contribution&reset=1&id=1&cid=3&action=view&context=contribution&'
. 'selectedChild=contribute\" class=\"action-item crm-hover-button\" title=\'View Contribution\' >View</a></span>"]] }', $json);
}
$json = CRM_Financial_Page_AJAX::getFinancialTransactionsList();
$json = str_replace(rtrim(CIVICRM_UF_BASEURL, '/'), 'http://FIX ME', $json);
$this->assertEquals('{"sEcho": 1, "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["<input type=\'checkbox\' id=\'mark_x_2\' name=\'mark_x_2\' value=\'1\' onclick=enableActions(\'x\')></input>","<a href=\"/index.php?q=civicrm/contact/view&reset=1&cid=3\" data-tooltip-url=\"/index.php?q=civicrm/profile/view&reset=1&gid=7&id=3&snippet=4&is_show_email_task=1\" class=\"crm-summary-link\">'
- . '<i class=\"crm-i fa-fw fa-user\" title=\"\"></i></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&cid=3>Anderson, Anthony</a>","$5.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
+ . '<i class=\"crm-i fa-fw fa-user\" title=\"\"></i></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&cid=3>Anderson, Anthony II</a>","$5.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
. '"Credit Card","Completed","Donation","<span><a href=\"/index.php?q=civicrm/contact/view/contribution&reset=1&id=1&cid=3&action=view&context=contribution&'
. 'selectedChild=contribute\" class=\"action-item crm-hover-button\" title=\'View Contribution\' >View</a><a href=\"#\" class=\"action-item crm-hover-button disable-action\" title=\'Assign Transaction\' onclick = \"assignRemove( 2,\'assign\' );\">Assign</a></span>"]] }', $json);
}
$membership = $this->callAPISuccess('Membership', 'create', $params);
- $this->assertEquals('Anderson, Anthony', CRM_Member_BAO_Membership::sortName($membership['id']));
+ $this->assertEquals('Anderson, Anthony II', CRM_Member_BAO_Membership::sortName($membership['id']));
$this->membershipDelete($membership['id']);
$this->contactDelete($contactId);
'contact_id' => $contactID,
'membership_id' => $membershipID,
'contact_type' => '<a href="/index.php?q=civicrm/contact/view&reset=1&cid=' . $contactID . '" data-tooltip-url="/index.php?q=civicrm/profile/view&reset=1&gid=7&id=' . $contactID . '&snippet=4&is_show_email_task=1" class="crm-summary-link"><i class="crm-i fa-fw fa-user" title=""></i></a>',
- 'sort_name' => 'Anderson, Anthony',
+ 'sort_name' => 'Anderson, Anthony II',
'membership_type' => 'General',
'membership_join_date' => date('Y-m-d'),
'membership_start_date' => date('Y-m-d'),
$rows = $form->controller->get('rows');
$this->assertEquals([
'contact_id' => '3',
- 'sort_name' => 'Anderson, Anthony',
+ 'sort_name' => 'Anderson, Anthony II',
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '1',
'pledge_amount' => 100.00,
'id' => $result['id'],
]);
- $this->assertEquals('Anderson, Anthony', $result['values'][$result['id']]['custom_' . $customField['id']]);
- $this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . "_id"], ' in line ' . __LINE__);
- $this->assertEquals('Anderson, Anthony', $result['values'][$result['id']]['custom_' . $customField['id'] . '_1'], ' in line ' . __LINE__);
- $this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . "_1_id"], ' in line ' . __LINE__);
+ $this->assertEquals('Anderson, Anthony II', $result['values'][$result['id']]['custom_' . $customField['id']]);
+ $this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . '_id']);
+ $this->assertEquals('Anderson, Anthony II', $result['values'][$result['id']]['custom_' . $customField['id'] . '_1']);
+ $this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . '_1_id']);
$this->customFieldDelete($ids['custom_field_id']);
$this->customGroupDelete($ids['custom_group_id']);
}
/**
* Test changes can be retrieved.
+ *
+ * @throws \CRM_Core_Exception
*/
public function testGet(): void {
$contactId = $this->individualCreate();
]);
$this->callAPISuccessGetSingle('email', ['email' => 'dopey@mail.com']);
$diffs = $this->callAPISuccess('Logging', 'get', ['log_conn_id' => 'wooty woot', 'log_date' => $timeStamp], __FUNCTION__, __FILE__);
- $this->assertLoggingIncludes($diffs['values'], ['to' => 'Dwarf, Dopey']);
+ $this->assertLoggingIncludes($diffs['values'], ['to' => 'Dwarf, Dopey II']);
$this->assertLoggingIncludes($diffs['values'], ['to' => 'Mr. Dopey Dwarf II', 'table' => 'civicrm_contact', 'action' => 'Update', 'field' => 'display_name']);
$this->assertLoggingIncludes($diffs['values'], ['to' => 'dopey@mail.com', 'table' => 'civicrm_email', 'action' => 'Insert', 'field' => 'email']);
}
/**
* Test changes can be retrieved without log_date being required.
+ *
+ * @throws \CRM_Core_Exception
*/
public function testGetNoDate(): void {
$contactId = $this->individualCreate();
]);
$this->callAPISuccessGetSingle('email', ['email' => 'dopey@mail.com']);
$diffs = $this->callAPISuccess('Logging', 'get', ['log_conn_id' => 'wooty wop wop']);
- $this->assertLoggingIncludes($diffs['values'], ['to' => 'Dwarf, Dopey']);
+ $this->assertLoggingIncludes($diffs['values'], ['to' => 'Dwarf, Dopey II']);
$this->assertLoggingIncludes($diffs['values'], ['to' => 'Mr. Dopey Dwarf II', 'table' => 'civicrm_contact', 'action' => 'Update', 'field' => 'display_name']);
$this->assertLoggingIncludes($diffs['values'], ['to' => 'dopey@mail.com', 'table' => 'civicrm_email', 'action' => 'Insert', 'field' => 'email']);
}
'options' => ['metadata' => ['sql']],
]);
$this->assertEquals(
- "<a href='/index.php?q=civicrm/contact/view&reset=1&cid=" . $contactID2 . "'>Anderson, Anthony</a> $ 5.00",
+ "<a href='/index.php?q=civicrm/contact/view&reset=1&cid=" . $contactID2 . "'>Anderson, Anthony II</a> $ 5.00",
$rows['values'][0]['civicrm_contribution_soft_credits']
);
}
$rows = $this->callAPISuccess('report_template', 'getrows', $params)['values'];
$expected = [
- 'civicrm_contact_contact_source' => 'Łąchowski-Roberts, Anthony',
- 'civicrm_contact_contact_assignee' => '<a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=4\'>Łąchowski-Roberts, Anthony</a>',
- 'civicrm_contact_contact_target' => '<a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=3\'>Brzęczysław, Anthony</a>; <a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=4\'>Łąchowski-Roberts, Anthony</a>',
+ 'civicrm_contact_contact_source' => 'Łąchowski-Roberts, Anthony II',
+ 'civicrm_contact_contact_assignee' => '<a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=4\'>Łąchowski-Roberts, Anthony II</a>',
+ 'civicrm_contact_contact_target' => '<a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=3\'>Brzęczysław, Anthony II</a>; <a title=\'View Contact Summary for this Contact\' href=\'/index.php?q=civicrm/contact/view&reset=1&cid=4\'>Łąchowski-Roberts, Anthony II</a>',
'civicrm_contact_contact_source_id' => $this->contactIDs[2],
'civicrm_contact_contact_assignee_id' => $this->contactIDs[1],
'civicrm_contact_contact_target_id' => $this->contactIDs[0] . ';' . $this->contactIDs[1],