INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name )
SELECT ac.activity_id,
ac.contact_id,
- ac.record_type_id
+ ac.record_type_id,
c.sort_name
FROM civicrm_activity_contact ac
-INNER JOIN {$activityTempTable} ON ( ac.activity_id = {$activityTempTable}.activity_id
-INNER JOIN civicrm_contact c ON c.id = at.contact_id
+INNER JOIN {$activityTempTable} ON ( ac.activity_id = {$activityTempTable}.activity_id {$notbulkActivityClause} )
+INNER JOIN civicrm_contact c ON c.id = ac.contact_id
WHERE c.is_deleted = 0
- {$notbulkActivityClause} )
+
";
CRM_Core_DAO::executeQuery($query);
- CRM_Core_DAO::executeQuery($query);
-
// step 3: Combine all temp tables to get final query for activity selector
$query = "
SELECT {$activityTempTable}.*,
{$activityContactTempTable}.contact_id,
{$activityContactTempTable}.record_type_id,
- {$activityContactTempTable}.contact_name,
+ {$activityContactTempTable}.contact_name
FROM {$activityTempTable}
INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$activityContactTempTable}.activity_id
";
civicrm_activity.status_id,
civicrm_activity.subject,
civicrm_activity.source_record_id,
- sourceContact.sort_name as source_contact_name,
civicrm_option_value.value as activity_type_id,
civicrm_option_value.label as activity_type,
null as case_id, null as case_subject,
- civicrm_activity.campaign_id as campaign_id,
- activityContact.contact_id as contact_id,
- activityContact.record_type_id as record_type_id,
- contact.sort_name as sort_name
+ civicrm_activity.campaign_id as campaign_id
';
}
civicrm_activity.subject,
civicrm_activity.source_contact_id,
civicrm_activity.source_record_id,
- sourceContact.sort_name as source_contact_name,
civicrm_option_value.value as activity_type_id,
civicrm_option_value.label as activity_type,
null as case_id, null as case_subject,
$from = 'FROM civicrm_case_activity cca
INNER JOIN civicrm_activity ca ON ca.id = cca.activity_id
- INNER JOIN civicrm_contact cc ON cc.id = ca.source_contact_id
+ INNER JOIN civicrm_activity_contact cac ON cac.activity_id = ca.id
+ INNER JOIN civicrm_contact cc ON cc.id = cac.contact_id
INNER JOIN civicrm_option_group cog ON cog.name = "activity_type"
INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
AND cov.value = ca.activity_type_id AND cov.is_active = 1
LEFT OUTER JOIN civicrm_option_group og ON og.name="activity_status"
LEFT OUTER JOIN civicrm_option_value ov ON ov.option_group_id=og.id AND ov.name="Scheduled"
LEFT JOIN civicrm_activity_contact caa
- ON caa.activity_id = ca.id AND caa.record_type_id = $assigneeID
+ ON caa.activity_id = ca.id AND caa.record_type_id = "$assigneeID"
LEFT JOIN civicrm_contact acc ON acc.id = caa.contact_id ';
$where = 'WHERE cca.case_id= %1