//all below tables are require to fetch result.
//1. get survey activity target table in.
- $query->_select['survey_activity_target_contact_id'] = 'civicrm_activity_contact.contact_id as survey_activity_target_contact_id';
+ $query->_select['survey_activity_target_contact_id'] = 'civicrm_activity_target.contact_id as survey_activity_target_contact_id';
$query->_select['survey_activity_target_id'] = 'civicrm_activity_target.id as survey_activity_target_id';
$query->_element['survey_activity_target_id'] = 1;
$query->_element['survey_activity_target_contact_id'] = 1;
$query->_qill[$grouping][] = ts('Survey - %1', array(1 => CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title')));
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_activity.source_record_id',
- $op, $value, "Integer"
+ $op, $value, 'Integer'
);
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_survey.id',
- $op, $value, "Integer"
+ $op, $value, 'Integer'
);
return;
$query->_qill[$grouping][] = ts('Survey Status - %1', array(1 => $activityStatus[$value]));
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_activity.status_id',
- $op, $value, "Integer"
+ $op, $value, 'Integer'
);
return;
}
}
$query->_qill[$grouping][] = ts('Survey Interviewer - %1', array(1 => $surveyInterviewerName));
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_activity_assignment.assignee_contact_id',
- $op, $value, "Integer"
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_activity_assignment.contact_id',
+ $op, $value, 'Integer'
);
return;
}
switch ($name) {
case self::CIVICRM_ACTIVITY_TARGET:
- $from = " INNER JOIN civicrm_activity_contact
- ON ( civicrm_activity_contact.contact_id = contact_a.id AND civicrm_activity_contact.record_type = 'Target') ";
+ $from = " INNER JOIN civicrm_activity_contact civicrm_activity_target
+ ON ( civicrm_activity_target.contact_id = contact_a.id AND civicrm_activity_target.record_type = 'Target') ";
break;
case self::CIVICRM_ACTIVITY:
case self::CIVICRM_ACTIVITY_ASSIGNMENT:
$from = "
-INNER JOIN civicrm_activity_assignment ON ( civicrm_activity.id = civicrm_activity_assignment.activity_id ) ";
+INNER JOIN civicrm_activity_contact civicrm_activity_assignment ON ( civicrm_activity.id = civicrm_activity_assignment.activity_id AND
+civicrm_activity_assignment.record_type = 'Assignee' ) ";
break;
case 'civicrm_survey':