Skip to content

Commit

Permalink
add case type to drop down
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapjansma committed Jun 27, 2016
1 parent 78c47d3 commit 97e1eaa
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions CRM/Caselink/Page/CaseLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ public function run() {
$case_status = array();
$params =array('name' => 'case_status');
CRM_Core_BAO_OptionGroup::retrieve($params, $case_status);
$sql = "SELECT civicrm_case.*, civicrm_case_contact.contact_id as client_id, civicrm_contact.display_name, ov.label as case_status_label"
. "FROM `".$config->getCustomGroup('table_name')."` AS `case_link`
INNER JOIN `civicrm_case` ON `case_link`.`".$config->getCaseIdField('column_name')."` = `civicrm_case`.`id`"
. "INNER JOIN `civicrm_case_contact` ON `civicrm_case`.`id` = `civicrm_case_contact`.`case_id`"
. "INNER JOIN `civicrm_contact` ON `civicrm_case_contact`.`contact_id` = `civicrm_contact`.`id`"
. "LEFT JOIN civicrm_option_value ov ON ( civicrm_case.status_id=ov.value AND ov.option_group_id='".$case_status['id']."')"
. "WHERE `case_link`.`entity_id` = '".$this->caseId."' LIMIT 1";
$sql = "SELECT civicrm_case.*, civicrm_case_contact.contact_id as client_id, civicrm_contact.display_name, ov.label as case_status_label, casetype.title as case_type_label"
. " FROM `".$config->getCustomGroup('table_name')."` AS `case_link`"
. " INNER JOIN `civicrm_case` ON `case_link`.`".$config->getCaseIdField('column_name')."` = `civicrm_case`.`id`"
. " INNER JOIN `civicrm_case_contact` ON `civicrm_case`.`id` = `civicrm_case_contact`.`case_id`"
. " INNER JOIN `civicrm_contact` ON `civicrm_case_contact`.`contact_id` = `civicrm_contact`.`id`"
. " LEFT JOIN civicrm_option_value ov ON ( civicrm_case.status_id=ov.value AND ov.option_group_id='".$case_status['id']."')"
. " LEFT JOIN civicrm_case_type casetype ON casetype.id = civicrm_case.case_type_id"
. " WHERE `case_link`.`entity_id` = '".$this->caseId."' LIMIT 1";
$dao = CRM_Core_DAO::executeQuery($sql);
$case = false;
if ($dao->fetch()) {
Expand All @@ -40,6 +41,9 @@ public function run() {
$query['context'] = 'case';
$url = CRM_Utils_System::url("civicrm/contact/view/case", $query);
$label = $dao->display_name.'::'.$dao->subject;
if (!empty($dao->case_type_label)) {
$label .= ' ('.$dao->case_type_label.')';
}
$case = array(
'url' => $url,
'label' => htmlentities($label, ENT_QUOTES),
Expand Down

0 comments on commit 97e1eaa

Please sign in to comment.