*
* @param int $caseID
* Case id.
- * @param bool $skipDetails
+ * @param bool $includeDetails
* If true include details of contacts.
*
* @return array
* array of return properties
*
*/
- public static function getRelatedContacts($caseID, $skipDetails = FALSE) {
+ public static function getRelatedContacts($caseID, $includeDetails = TRUE) {
$caseRoles = array();
- if (!$skipDetails) {
+ if ($includeDetails) {
$caseInfo = civicrm_api3('Case', 'getsingle', array(
'id' => $caseID,
+ // Most efficient way of retrieving definition is to also include case type id and name so the api doesn't have to look it up separately
'return' => array('case_type_id', 'case_type_id.name', 'case_type_id.definition'),
));
if (!empty($caseInfo['case_type_id.definition']['caseRoles'])) {
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
- if ($skipDetails) {
+ if (!$includeDetails) {
$values[$dao->id] = 1;
}
else {
'role' => $dao->role,
'email' => $dao->email,
);
+ // Add more info about the role (creator, manager)
$role = CRM_Utils_Array::value($details['role'], $caseRoles);
if ($role) {
unset($role['name']);
// TODO: May want to replace this with a call to getRelatedAndGlobalContacts() when this feature is revisited.
// (Or for efficiency call the global one outside the loop and then union with this each time.)
- $contactDetails = self::getRelatedContacts($caseId, TRUE);
+ $contactDetails = self::getRelatedContacts($caseId, FALSE);
if (!empty($contactDetails[$result['from']['id']])) {
$params = array();