本文整理汇总了PHP中CRM_Contact_DAO_Contact::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_DAO_Contact::fetch方法的具体用法?PHP CRM_Contact_DAO_Contact::fetch怎么用?PHP CRM_Contact_DAO_Contact::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_DAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_DAO_Contact::fetch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateRecords
/**
* Updates contacts affected by the option value passed.
*
* @param int $optionValueId
* The option value id.
* @param int $action
* The action describing whether prefix/suffix was UPDATED or DELETED.
*
* @return bool
*/
public static function updateRecords(&$optionValueId, $action)
{
//finding group name
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
$optionValue->find(TRUE);
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->id = $optionValue->option_group_id;
$optionGroup->find(TRUE);
// group name
$gName = $optionGroup->name;
// value
$value = $optionValue->value;
// get the proper group name & affected field name
// todo: this may no longer be needed for individuals - check inputs
$individuals = array('gender' => 'gender_id', 'individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'communication_style' => 'communication_style_id');
$contributions = array('payment_instrument' => 'payment_instrument_id');
$activities = array('activity_type' => 'activity_type_id');
$participant = array('participant_role' => 'role_id');
$eventType = array('event_type' => 'event_type_id');
$aclRole = array('acl_role' => 'acl_role_id');
$all = array_merge($individuals, $contributions, $activities, $participant, $eventType, $aclRole);
$fieldName = '';
foreach ($all as $name => $id) {
if ($gName == $name) {
$fieldName = $id;
}
}
if ($fieldName == '') {
return TRUE;
}
if (array_key_exists($gName, $individuals)) {
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->{$fieldName} = $value;
$contactDAO->find();
while ($contactDAO->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $contactDAO->id;
$contact->find(TRUE);
// make sure dates doesn't get reset
$contact->birth_date = CRM_Utils_Date::isoToMysql($contact->birth_date);
$contact->deceased_date = CRM_Utils_Date::isoToMysql($contact->deceased_date);
$contact->{$fieldName} = 'NULL';
$contact->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $contributions)) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->{$fieldName} = $value;
$contribution->find();
while ($contribution->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contribution->{$fieldName} = 'NULL';
$contribution->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $activities)) {
$activity = new CRM_Activity_DAO_Activity();
$activity->{$fieldName} = $value;
$activity->find();
while ($activity->fetch()) {
$activity->delete();
}
return TRUE;
}
//delete participant role, type and event type option value
if (array_key_exists($gName, $participant)) {
$participantValue = new CRM_Event_DAO_Participant();
$participantValue->{$fieldName} = $value;
if ($participantValue->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete event type option value
if (array_key_exists($gName, $eventType)) {
$event = new CRM_Event_DAO_Event();
$event->{$fieldName} = $value;
if ($event->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete acl_role option value
if (array_key_exists($gName, $aclRole)) {
//.........这里部分代码省略.........
示例2: buildNoteTree
/**
* Recursive function to get all descendent notes of the note with given ID.
*
* @param int $parentId
* ID of the note to start from.
* @param int $maxDepth
* Maximum number of levels to descend into the tree; if not given, will include all descendents.
* @param bool $snippet
* If TRUE, returned values will be pre-formatted for display in a table of notes.
* @param array $tree
* (Reference) Variable to store all found descendents.
* @param int $depth
* Depth of current iteration within the descendent tree (used for comparison against maxDepth).
*
* @return array
* Nested associative array beginning with direct children of given note.
*/
private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
{
if ($maxDepth && $depth > $maxDepth) {
return FALSE;
}
// get direct children of given parentId note
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
$note->entity_id = $parentId;
$note->orderBy('modified_date asc');
$note->find();
while ($note->fetch()) {
// foreach child, call this function, unless the child is private/hidden
if (!self::getNotePrivacyHidden($note)) {
CRM_Core_DAO::storeValues($note, $tree[$note->id]);
// get name of user that created this note
$contact = new CRM_Contact_DAO_Contact();
$createdById = $note->contact_id;
$contact->id = $createdById;
$contact->find();
$contact->fetch();
$tree[$note->id]['createdBy'] = $contact->display_name;
$tree[$note->id]['createdById'] = $createdById;
$tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
// paper icon view for attachments part
$paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
$tree[$note->id]['attachment'] = $paperIconAttachmentInfo ? implode('', $paperIconAttachmentInfo) : '';
if ($snippet) {
$tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
$tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
}
self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
}
}
return $tree;
}
示例3: addParticipant
private function addParticipant()
{
$contact = new CRM_Contact_DAO_Contact();
$contact->query("SELECT id FROM civicrm_contact");
while ($contact->fetch()) {
$contacts[] = $contact->id;
}
shuffle($contacts);
$randomContacts = array_slice($contacts, 20, 50);
$participant = "\nINSERT INTO civicrm_participant\n (contact_id, event_id, status_id, role_id, register_date, source, fee_level, is_test, fee_amount, fee_currency)\nVALUES\n ( " . $randomContacts[0] . ", 1, 1, 1, '2009-01-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[1] . ", 2, 2, 2, '2008-05-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[2] . ", 3, 3, 3, '2008-05-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD') ,\n ( " . $randomContacts[3] . ", 1, 4, 4, '2008-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[4] . ", 2, 1, 1, '2008-01-10', 'Check', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[5] . ", 3, 2, 2, '2008-03-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[6] . ", 1, 3, 3, '2009-07-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[7] . ", 2, 4, 4, '2009-03-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[8] . ", 3, 1, 1, '2008-02-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[9] . ", 1, 2, 2, '2008-02-01', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[10] . ", 2, 3, 3, '2009-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[11] . ", 3, 4, 4, '2009-03-06', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[12] . ", 1, 1, 2, '2008-06-04', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[13] . ", 2, 2, 3, '2008-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[14] . ", 3, 4, 1, '2008-07-04', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[15] . ", 1, 4, 2, '2009-01-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[16] . ", 2, 2, 3, '2008-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[17] . ", 3, 3, 1, '2009-03-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[18] . ", 1, 2, 1, '2008-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[19] . ", 2, 4, 1, '2009-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[20] . ", 3, 1, 4, '2008-03-25', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[21] . ", 1, 2, 3, '2009-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[22] . ", 2, 4, 1, '2008-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[23] . ", 3, 3, 1, '2008-03-11', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[24] . ", 3, 2, 2, '2008-04-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[25] . ", 1, 1, 1, '2009-01-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[26] . ", 2, 2, 2, '2008-05-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[27] . ", 3, 3, 3, '2009-12-12', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[28] . ", 1, 4, 4, '2009-12-13', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[29] . ", 2, 1, 1, '2009-12-14', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[30] . ", 3, 2, 2, '2009-12-15', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[31] . ", 1, 3, 3, '2009-07-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[32] . ", 2, 4, 4, '2009-03-07', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[33] . ", 3, 1, 1, '2009-12-15', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[34] . ", 1, 2, 2, '2009-12-13', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[35] . ", 2, 3, 3, '2009-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[36] . ", 3, 4, 4, '2009-03-06', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[37] . ", 1, 1, 2, '2009-12-13', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[38] . ", 2, 2, 3, '2008-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[39] . ", 3, 4, 1, '2009-12-14', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[40] . ", 1, 4, 2, '2009-01-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[41] . ", 2, 2, 3, '2009-12-15', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[42] . ", 3, 3, 1, '2009-03-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[43] . ", 1, 2, 1, '2009-12-13', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[44] . ", 2, 4, 1, '2009-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[45] . ", 3, 1, 4, '2009-12-13', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[46] . ", 1, 2, 3, '2009-10-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[47] . ", 2, 4, 1, '2009-12-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[48] . ", 3, 3, 1, '2009-03-11', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[49] . ", 3, 2, 2, '2009-04-05', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD');\n";
$this->_query($participant);
$query = "\nINSERT INTO civicrm_activity\n (source_record_id, activity_type_id, subject, activity_date_time, duration, location, phone_id, phone_number, details, priority_id,parent_id, is_test, status_id)\nVALUES\n (01, 5, 'NULL', '2009-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (02, 5, 'NULL', '2008-05-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (03, 5, 'NULL', '2008-05-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (04, 5, 'NULL', '2008-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (05, 5, 'NULL', '2008-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (06, 5, 'NULL', '2008-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (07, 5, 'NULL', '2009-07-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (08, 5, 'NULL', '2009-03-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (09, 5, 'NULL', '2008-02-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (10, 5, 'NULL', '2008-02-01 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (11, 5, 'NULL', '2009-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (12, 5, 'NULL', '2009-03-06 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (13, 5, 'NULL', '2008-06-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (14, 5, 'NULL', '2008-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (15, 5, 'NULL', '2008-07-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (16, 5, 'NULL', '2009-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (17, 5, 'NULL', '2008-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (18, 5, 'NULL', '2009-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (19, 5, 'NULL', '2008-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (20, 5, 'NULL', '2009-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (21, 5, 'NULL', '2008-03-25 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (22, 5, 'NULL', '2009-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (23, 5, 'NULL', '2008-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (24, 5, 'NULL', '2008-03-11 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (25, 5, 'NULL', '2008-04-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (26, 5, 'NULL', '2009-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (27, 5, 'NULL', '2008-05-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (28, 5, 'NULL', '2009-12-12 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (29, 5, 'NULL', '2009-12-13 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (30, 5, 'NULL', '2009-12-14 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (31, 5, 'NULL', '2009-12-15 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (32, 5, 'NULL', '2009-07-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (33, 5, 'NULL', '2009-03-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (34, 5, 'NULL', '2009-12-15 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (35, 5, 'NULL', '2009-12-13 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (36, 5, 'NULL', '2009-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (37, 5, 'NULL', '2009-03-06 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (38, 5, 'NULL', '2009-12-13 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (39, 5, 'NULL', '2008-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (40, 5, 'NULL', '2009-12-14 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (41, 5, 'NULL', '2009-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (42, 5, 'NULL', '2009-12-15 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (43, 5, 'NULL', '2009-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (44, 5, 'NULL', '2009-12-13 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (45, 5, 'NULL', '2009-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (46, 5, 'NULL', '2009-12-13 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (47, 5, 'NULL', '2009-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (48, 5, 'NULL', '2009-12-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (49, 5, 'NULL', '2009-03-11 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n (50, 5, 'NULL', '2009-04-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )\n ";
$this->_query($query);
$activityContact = "\nINSERT INTO civicrm_activity_contact\n (contact_id, activity_id, record_type_id)\nVALUES\n";
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$currentActivityID = CRM_Core_DAO::singleValueQuery("SELECT MAX(id) FROM civicrm_activity");
$currentActivityID -= 50;
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
for ($i = 0; $i < 50; $i++) {
$currentActivityID++;
$activityContact .= "({$randomContacts[$i]}, {$currentActivityID}, {$sourceID})";
if ($i != 49) {
$activityContact .= ", ";
}
}
$this->_query($activityContact);
}
示例4: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
//CRM-4418, handling edit and delete separately.
$permissions = array($this->_permission);
if ($this->_permission == CRM_Core_Permission::EDIT) {
//previously delete was subset of edit
//so for consistency lets grant delete also.
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
$values = array();
$links = self::links();
$action = array_sum(array_keys($links)) & $mask;
$note->find();
while ($note->fetch()) {
if (!CRM_Core_BAO_Note::getNotePrivacyHidden($note)) {
CRM_Core_DAO::storeValues($note, $values[$note->id]);
$values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $note->contact_id;
$contact->find();
$contact->fetch();
$values[$note->id]['createdBy'] = $contact->display_name;
$values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
}
}
$this->assign('notes', $values);
$commentLinks = self::commentLinks();
$action = array_sum(array_keys($commentLinks)) & $mask;
$commentAction = CRM_Core_Action::formLink($commentLinks, $action, array('id' => $note->id, 'pid' => $note->entity_id, 'cid' => $note->entity_id));
$this->assign('commentAction', $commentAction);
}
示例5: addMembership
function addMembership()
{
$contact = new CRM_Contact_DAO_Contact();
$contact->query("SELECT id FROM civicrm_contact where contact_type = 'Individual'");
while ($contact->fetch()) {
$contacts[] = $contact->id;
}
shuffle($contacts);
$randomContacts = array_slice($contacts, 0, 350);
$sources = array('Payment', 'Donation', 'Check');
$membershipTypes = array(2, 1);
$membershipTypeNames = array('Student', 'General');
$statuses = array(3, 4);
$membership = "\n INSERT INTO civicrm_membership\n (contact_id, membership_type_id, join_date, start_date, end_date, source, status_id)\nVALUES\n ";
$activity = "\nINSERT INTO civicrm_activity\n (source_contact_id, source_record_id, activity_type_id, subject, activity_date_time, duration, location, phone_id, phone_number, details, priority_id,parent_id, is_test, status_id)\nVALUES\n";
foreach ($randomContacts as $count => $dontCare) {
$source = self::_getRandomElement($sources);
$acititySourceId = $count + 1;
if (($count + 1) % 11 == 0) {
// lifetime membership, status can be anything
$startDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count, date('Y')));
$membership .= "( {$randomContacts[$count]}, 3, '{$startDate}', '{$startDate}', null, '{$source}', 1)";
$activity .= "( {$randomContacts[$count]}, {$acititySourceId}, 7, 'Lifetime', '{$startDate} 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )";
} elseif (($count + 1) % 5 == 0) {
// Grace or expired, memberhsip type is random of 1 & 2
$randId = array_rand($membershipTypes);
$membershipType = self::_getRandomElement($membershipTypes);
$startDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count * ($randId + 1) * ($randId + 1) * ($randId + 1), date('Y') - ($randId + 1)));
$partOfDate = explode('-', $startDate);
$endDate = date('Y-m-d', mktime(0, 0, 0, $partOfDate[1], $partOfDate[2] - 1, $partOfDate[0] + ($randId + 1)));
$membership .= "( {$randomContacts[$count]}, {$membershipType}, '{$startDate}', '{$startDate}', '{$endDate}', '{$source}', {$statuses[$randId]})";
$activity .= "( {$randomContacts[$count]}, {$acititySourceId}, 7, '{$membershipTypeNames[$randId]}', '{$startDate} 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )";
} elseif (($count + 1) % 2 == 0) {
// membership type 2
$startDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count, date('Y')));
$endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count, date('Y') + 1));
$membership .= "( {$randomContacts[$count]}, 2, '{$startDate}', '{$startDate}', '{$endDate}', '{$source}', 1)";
$activity .= "( {$randomContacts[$count]}, {$acititySourceId}, 7, 'Student', '{$startDate} 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )";
} else {
// membership type 1
$startDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count, date('Y')));
$endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - $count, date('Y') + 2));
$membership .= "( {$randomContacts[$count]}, 1, '{$startDate}', '{$startDate}', '{$endDate}', '{$source}', 1)";
$activity .= "( {$randomContacts[$count]}, {$acititySourceId}, 7, 'General', '{$startDate} 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )";
}
if ($count != 349) {
$membership .= ",";
$activity .= ",";
}
}
CRM_Core_DAO::executeQuery($membership, CRM_Core_DAO::$_nullArray);
CRM_Core_DAO::executeQuery($activity, CRM_Core_DAO::$_nullArray);
}
示例6: createBatchEntry
/**
* Required params
*
* From import record usually:
* 'contact_id',
* 'contact_display_name',
* 'net_amount',
* 'received_date',
*
* This usually goes from the form:
* 'payment_instrument_id',
* 'contribution_type_id',
* 'campaign_id',
*
* And from the code:
* 'batch_id',
* 'weight',
*
* Optional:
* 'transaction_id'
*
* @param array $params
* @return type
*/
protected function createBatchEntry(array $params)
{
//preload what we can
// if(isset($params['VARef'])) {
// require_once 'CRM/Contact/DAO/Contact.php';
// $contact = new CRM_Contact_DAO_Contact();
// $contact->external_identifier = $params['VARef'];
// $contact->find();
// if($contact->fetch() === false) {
// throw new Exception("Can't load contact using extenal_id = '{$params['VARef']}'");
// }
//
// $params['contact_id'] = $contact->id;
// $params['contactDisplayName'] = $contact->display_name;
// }
//check mandatory $params - others are checked in CRM_Batch_BAO_Batch::createContribution()
foreach (array() as $param) {
if (empty($params[$param])) {
throw new InvalidArgumentException("No param[{$param}] when creating the batch entry");
}
}
if (!isset($params['contact_display_name']) && isset($params['contact_id'])) {
require_once 'CRM/Contact/DAO/Contact.php';
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $params['contact_id'];
$contact->find();
if ($contact->fetch() === false) {
throw new Exception("Can't find user with id = '{$params['contact_id']}'");
}
//$params['contact_id'] = $contact->id;
$params['contact_display_name'] = $contact->display_name;
}
try {
require_once 'CRM/Finance/BAO/Batch.php';
return CRM_Finance_BAO_Batch::createContribution($params);
} catch (RuntimeException $e) {
throw new CRM_Finance_BAO_Import_ProcessException($e->getMessage(), $e->getCode(), $e);
}
}
示例7: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$note =& new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
$values = array();
$links =& CRM_Contact_Page_View_Note::links();
$action = array_sum(array_keys($links)) & CRM_Core_Action::mask($this->_permission);
$note->find();
while ($note->fetch()) {
$values[$note->id] = array();
CRM_Core_DAO::storeValues($note, $values[$note->id]);
$values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $note->contact_id;
$contact->find();
$contact->fetch();
$values[$note->id]['createdBy'] = $contact->display_name;
}
$this->assign('notes', $values);
}
示例8: buildNoteTree
/**
* Recursive function to get all descendent notes of the note with given ID
* @param int $parentId ID of the note to start from
* @param int $maxDepth Maximum number of levels to descend into the tree; if not given, will include all descendents.
* @param bool $snippet If TRUE, returned values will be pre-formatted for display in a table of notes.
* @param array $tree (Reference) Variable to store all found descendents
* @param int $depth Depth of current iteration within the descendent tree (used for comparison against maxDepth)
* @return array Nested associative array beginning with direct children of given note.
*/
private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
{
if ($maxDepth && $depth > $maxDepth) {
return;
}
// get direct children of given parentId note
$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_note';
$note->entity_id = $parentId;
$note->orderBy('modified_date asc');
$note->find();
while ($note->fetch()) {
// foreach child, call this function, unless the child is private/hidden
if (!self::getNotePrivacyHidden($note)) {
CRM_Core_DAO::storeValues($note, $tree[$note->id]);
// get name of user that created this note
require_once 'CRM/Contact/DAO/Contact.php';
require_once 'CRM/Core/Smarty/plugins/modifier.mb_truncate.php';
$contact = new CRM_Contact_DAO_Contact();
$createdById = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $parentId, 'entity_id');
$contact->id = $createdById;
$contact->find();
$contact->fetch();
$tree[$note->id]['createdBy'] = $contact->display_name;
$tree[$note->id]['createdById'] = $createdById;
$tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
if ($snippet) {
$tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
$tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
}
self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
}
}
return $tree;
}
示例9: getGroupContacts
/**
* Returns array of contacts who are members of the specified group.
*
* @param CRM_Contact $group A valid group object (passed by reference)
* @param array $returnProperties Which properties
* should be included in the returned Contact object(s). If NULL,
* the default set of contact properties will be
* included. group_contact properties (such as 'status',
* ' in_date', etc.) are included automatically.Note:Do not inclue
* Id releted properties.
* @param text $status A valid status value ('Added', 'Pending', 'Removed').
* @param text $sort Associative array of
* one or more "property_name"=>"sort direction"
* pairs which will control order of Contact objects returned.
* @param Int $offset Starting row index.
* @param Int $row_count Maximum number of rows to returns.
*
*
* @return $contactArray Array of contacts who are members of the specified group
*
* @access public
*/
static function getGroupContacts(&$group, $returnProperties = NULL, $status = 'Added', $sort = NULL, $offset = NULL, $row_count = NULL, $includeChildGroups = FALSE)
{
$groupDAO = new CRM_Contact_DAO_Group();
$groupDAO->id = $group->id;
if (!$groupDAO->find(TRUE)) {
return CRM_Core_Error::createError("Could not locate group with id: {$id}");
}
// make sure user has got permission to view this group
if (!CRM_Contact_BAO_Group::checkPermission($groupDAO->id, $groupDAO->title)) {
return CRM_Core_Error::createError("You do not have permission to access group with id: {$id}");
}
$query = '';
if (empty($returnProperties)) {
$query = "SELECT contact_a.id as contact_id,\n civicrm_email.email as email";
} else {
$query = "SELECT contact_a.id as contact_id , {$grpStatus} as status,";
$query .= implode(',', $returnProperties);
}
$params = array();
if ($includeChildGroups) {
$groupIds = CRM_Contact_BAO_GroupNesting::getDescendentGroupIds(array($group->id));
} else {
$groupIds = array($group->id);
}
foreach ($groupIds as $groupId) {
$params[] = array('group', 'IN', array($group->id => TRUE), 0, 0);
}
$tables = array(CRM_Core_BAO_Email::getTableName() => TRUE, CRM_Contact_BAO_Contact::getTableName() => TRUE);
$inner = array();
$whereTables = array();
$where = CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
$permission = CRM_Core_Permission::whereClause(CRM_Core_Permission::VIEW, $tables, $whereTables);
$from = CRM_Contact_BAO_Query::fromClause($tables, $inner);
$query .= " {$from} WHERE {$permission} AND {$where} ";
if ($sort != NULL) {
$order = array();
foreach ($sort as $key => $direction) {
$order[] = " {$key} {$direction} ";
}
$query .= " ORDER BY " . implode(',', $order);
}
if (!is_null($offset) && !is_null($row_count)) {
$query .= " LIMIT {$offset}, {$row_count}";
}
$dao = new CRM_Contact_DAO_Contact();
$dao->query($query);
// this is quite inefficient, we need to change the return
// values in docs
$contactArray = array();
while ($dao->fetch()) {
$contactArray[] = clone $dao;
}
return $contactArray;
}
示例10: addParticipant
function addParticipant()
{
$contact = new CRM_Contact_DAO_Contact();
$contact->query("SELECT id FROM civicrm_contact");
while ($contact->fetch()) {
$contacts[] = $contact->id;
}
shuffle($contacts);
$randomContacts = array_slice($contacts, 20, 50);
$participant = "\nINSERT INTO civicrm_participant\n (contact_id, event_id, status_id, role_id, register_date, source, fee_level, is_test, fee_amount, fee_currency)\nVALUES\n ( " . $randomContacts[0] . ", 1, 1, 1, '2006-01-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[1] . ", 2, 2, 2, '2005-05-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[2] . ", 3, 3, 3, '2005-05-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD') ,\n ( " . $randomContacts[3] . ", 1, 4, 4, '2005-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[4] . ", 2, 1, 1, '2005-01-10', 'Check', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[5] . ", 3, 2, 2, '2005-03-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[6] . ", 1, 3, 3, '2006-07-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[7] . ", 2, 4, 4, '2006-03-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[8] . ", 3, 1, 1, '2005-02-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[9] . ", 1, 2, 2, '2005-02-01', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[10] . ", 2, 3, 3, '2006-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[11] . ", 3, 4, 4, '2006-03-06', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[12] . ", 1, 1, 2, '2005-06-04', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[13] . ", 2, 2, 3, '2004-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[14] . ", 3, 4, 1, '2005-07-04', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[15] . ", 1, 4, 2, '2006-01-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[16] . ", 2, 2, 3, '2005-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[17] . ", 3, 3, 1, '2006-03-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[18] . ", 1, 2, 1, '2005-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[19] . ", 2, 4, 1, '2006-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[20] . ", 3, 1, 4, '2005-03-25', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[21] . ", 1, 2, 3, '2006-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[22] . ", 2, 4, 1, '2005-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[23] . ", 3, 3, 1, '2005-03-11', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[24] . ", 3, 2, 2, '2005-04-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[25] . ", 1, 1, 1, '2006-01-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[26] . ", 2, 2, 2, '2007-05-07', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[27] . ", 3, 3, 3, '2007-05-05', 'Direct Transfer', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[28] . ", 1, 4, 4, '2007-10-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[29] . ", 2, 1, 1, '2007-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[30] . ", 3, 2, 2, '2007-03-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[31] . ", 1, 3, 3, '2006-07-21', 'Check', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[32] . ", 2, 4, 4, '2006-03-07', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[33] . ", 3, 1, 1, '2007-02-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[34] . ", 1, 2, 2, '2007-02-01', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[35] . ", 2, 3, 3, '2006-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[36] . ", 3, 4, 4, '2006-03-06', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[37] . ", 1, 1, 2, '2007-06-04', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[38] . ", 2, 2, 3, '2004-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[39] . ", 3, 4, 1, '2007-07-04', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[40] . ", 1, 4, 2, '2006-01-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[41] . ", 2, 2, 3, '2007-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[42] . ", 3, 3, 1, '2006-03-05', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[43] . ", 1, 2, 1, '2007-10-21', 'Direct Transfer', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[44] . ", 2, 4, 1, '2006-01-10', 'Direct Transfer', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[45] . ", 3, 1, 4, '2007-03-25', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[46] . ", 1, 2, 3, '2006-10-21', 'Credit Card', 'Single', 0, 50, 'USD'),\n ( " . $randomContacts[47] . ", 2, 4, 1, '2007-01-10', 'Credit Card', 'Soprano', 0, 50, 'USD'),\n ( " . $randomContacts[48] . ", 3, 3, 1, '2007-03-11', 'Credit Card', 'Tiny-tots (ages 5-8)', 0, 800, 'USD'),\n ( " . $randomContacts[49] . ", 3, 2, 2, '2007-04-05', 'Check', 'Tiny-tots (ages 5-8)', 0, 800, 'USD');\n";
CRM_Core_DAO::executeQuery($participant, CRM_Core_DAO::$_nullArray);
$query = "\nINSERT INTO civicrm_activity\n (source_contact_id, source_record_id, activity_type_id, subject, activity_date_time, duration, location, phone_id, phone_number, details, priority_id,parent_id, is_test, status_id)\nVALUES\n ({$randomContacts['0']}, 01, 5, 'NULL', '2006-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['1']}, 02, 5, 'NULL', '2005-05-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['2']}, 03, 5, 'NULL', '2005-05-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['3']}, 04, 5, 'NULL', '2005-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['4']}, 05, 5, 'NULL', '2005-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['5']}, 06, 5, 'NULL', '2005-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['6']}, 07, 5, 'NULL', '2006-07-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['7']}, 08, 5, 'NULL', '2006-03-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['8']}, 09, 5, 'NULL', '2005-02-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['9']}, 10, 5, 'NULL', '2005-02-01 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['10']}, 11, 5, 'NULL', '2006-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['11']}, 12, 5, 'NULL', '2006-03-06 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['12']}, 13, 5, 'NULL', '2005-06-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['13']}, 14, 5, 'NULL', '2004-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['14']}, 15, 5, 'NULL', '2005-07-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['15']}, 16, 5, 'NULL', '2006-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['16']}, 17, 5, 'NULL', '2005-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['17']}, 18, 5, 'NULL', '2006-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['18']}, 19, 5, 'NULL', '2005-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['19']}, 20, 5, 'NULL', '2006-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['20']}, 21, 5, 'NULL', '2005-03-25 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['21']}, 22, 5, 'NULL', '2006-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['22']}, 23, 5, 'NULL', '2005-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['23']}, 24, 5, 'NULL', '2005-03-11 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['24']}, 25, 5, 'NULL', '2005-04-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['25']}, 26, 5, 'NULL', '2006-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['26']}, 27, 5, 'NULL', '2007-05-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['27']}, 28, 5, 'NULL', '2005-05-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['28']}, 29, 5, 'NULL', '2007-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['29']}, 30, 5, 'NULL', '2007-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['30']}, 31, 5, 'NULL', '2007-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['31']}, 32, 5, 'NULL', '2006-07-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['32']}, 33, 5, 'NULL', '2006-03-07 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['33']}, 34, 5, 'NULL', '2007-02-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['34']}, 35, 5, 'NULL', '2007-02-01 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['35']}, 36, 5, 'NULL', '2006-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['36']}, 37, 5, 'NULL', '2006-03-06 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['37']}, 38, 5, 'NULL', '2007-06-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['38']}, 39, 5, 'NULL', '2004-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['39']}, 40, 5, 'NULL', '2007-07-04 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['40']}, 41, 5, 'NULL', '2006-01-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['41']}, 42, 5, 'NULL', '2007-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['42']}, 43, 5, 'NULL', '2006-03-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['43']}, 44, 5, 'NULL', '2007-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['44']}, 45, 5, 'NULL', '2006-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['45']}, 46, 5, 'NULL', '2007-03-25 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['46']}, 47, 5, 'NULL', '2006-10-21 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['47']}, 48, 5, 'NULL', '2006-01-10 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['48']}, 49, 5, 'NULL', '2007-03-11 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 ),\n ({$randomContacts['49']}, 50, 5, 'NULL', '2007-04-05 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2 )\n ";
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}