c.sort_name,
c.is_deleted
FROM {$activityTempTable}
-INNER JOIN civicrm_activity a ON ( a.id = {$activityTempTable}.activity_id AND a.activity_type_id != {$bulkActivityTypeID} )
+INNER JOIN civicrm_activity a ON ( a.id = {$activityTempTable}.activity_id )
INNER JOIN civicrm_activity_contact ac ON ( ac.activity_id = {$activityTempTable}.activity_id )
INNER JOIN civicrm_contact c ON c.id = ac.contact_id
-
+WHERE ac.record_type_id != %1
";
- CRM_Core_DAO::executeQuery($query);
+ $params = array(1 => array($targetID, 'Integer'));
+ CRM_Core_DAO::executeQuery($query, $params);
// for each activity insert one target contact
// if we load all target contacts the performance will suffer a lot for mass-activities;
c.is_deleted,
count(ac.contact_id)
FROM {$activityTempTable}
-INNER JOIN civicrm_activity a ON ( a.id = {$activityTempTable}.activity_id AND a.activity_type_id = {$bulkActivityTypeID} )
+INNER JOIN civicrm_activity a ON ( a.id = {$activityTempTable}.activity_id )
INNER JOIN civicrm_activity_contact ac ON ( ac.activity_id = {$activityTempTable}.activity_id )
INNER JOIN civicrm_contact c ON c.id = ac.contact_id
WHERE ac.record_type_id = %1
GROUP BY ac.activity_id
";
- $params = array(1 => array($targetID, 'Integer'));
+
CRM_Core_DAO::executeQuery($query, $params);
// step 3: Combine all temp tables to get final query for activity selector
if (empty($values[$activityID]['target_contact_name'])) {
$values[$activityID]['target_contact_name'] = array();
+ $values[$activityID]['target_contact_counter'] = $dao->counter;
}
// if deleted, wrap in <del>
elseif (!empty($values['recipients'])) {
$contactActivities[$activityId]['target_contact'] = $values['recipients'];
}
- elseif (!$values['target_contact_name']) {
- $contactActivities[$activityId]['target_contact'] = '<em>n/a</em>';
- }
- elseif (!empty($values['target_contact_name'])) {
- $count = 0;
- $contactActivities[$activityId]['target_contact'] = '';
+ elseif (isset($values['target_contact_counter']) && $values['target_contact_counter']) {
foreach ($values['target_contact_name'] as $tcID => $tcName) {
- if ($tcID && $count < 5) {
- $contactActivities[$activityId]['target_contact'] .= CRM_Utils_System::href($tcName,
- 'civicrm/contact/view', "reset=1&cid={$tcID}");
- $count++;
- if ($count) {
- $contactActivities[$activityId]['target_contact'] .= "; ";
- }
+ $contactActivities[$activityId]['target_contact'] .= CRM_Utils_System::href($tcName,
+ 'civicrm/contact/view', "reset=1&cid={$tcID}");
+ }
- if ($count == 4) {
- $contactActivities[$activityId]['target_contact'] .= "(" . ts('more') . ")";
- break;
- }
- }
+ if ($extraCount = $values['target_contact_counter'] - 1) {
+ $contactActivities[$activityId]['target_contact'] .= ";<br />" . "(" . ts('%1 more', array(1 => $extraCount)) . ")";
}
}
+ elseif (!$values['target_contact_name']) {
+ $contactActivities[$activityId]['target_contact'] = '<em>n/a</em>';
+ }
if (empty($values['assignee_contact_name'])) {
$contactActivities[$activityId]['assignee_contact'] = '<em>n/a</em>';