/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
protected $_includeCaseDetailExtra = FALSE;
- protected $_caseDetailExtra = array(
- );
+ protected $_caseDetailExtra = array();
/**
*
/**
*
*/
- function __construct() {
+ public function __construct() {
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
- $this->case_types = CRM_Case_PseudoConstant::caseType();
- $rels = CRM_Core_PseudoConstant::relationshipType();
+ $this->case_types = CRM_Case_PseudoConstant::caseType();
+ $rels = CRM_Core_PseudoConstant::relationshipType();
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
}
- $this->deleted_labels = array('' => ts('- select -'), 0 => ts('No'), 1 => ts('Yes'));
+ $this->deleted_labels = array(
+ '' => ts('- select -'),
+ 0 => ts('No'),
+ 1 => ts('Yes'),
+ );
$this->caseActivityTypes = array();
foreach (CRM_Case_PseudoConstant::caseActivityType() as $typeDetail) {
}
$this->_columns = array(
- 'civicrm_case' =>
- array(
+ 'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
- 'fields' =>
- array(
- 'id' => array('title' => ts('Case ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Case ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'subject' => array('title' => ts('Subject'),
+ 'subject' => array(
+ 'title' => ts('Subject'),
'required' => TRUE,
),
- 'start_date' => array('title' => ts('Start Date'),
+ 'start_date' => array(
+ 'title' => ts('Start Date'),
'type' => CRM_Utils_Type::T_DATE,
),
- 'end_date' => array('title' => ts('End Date'),
+ 'end_date' => array(
+ 'title' => ts('End Date'),
'type' => CRM_Utils_Type::T_DATE,
),
'status_id' => array('title' => ts('Case Status')),
'case_type_id' => array('title' => ts('Case Type')),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'default' => FALSE,
'type' => CRM_Utils_Type::T_INT,
),
),
- 'filters' =>
- array(
- 'start_date' => array('title' => ts('Start Date'),
+ 'filters' => array(
+ 'start_date' => array(
+ 'title' => ts('Start Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'end_date' => array('title' => ts('End Date'),
+ 'end_date' => array(
+ 'title' => ts('End Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'status_id' => array('title' => ts('Case Status'),
+ 'status_id' => array(
+ 'title' => ts('Case Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_statuses,
),
- 'case_type_id' => array('title' => ts('Case Type'),
+ 'case_type_id' => array(
+ 'title' => ts('Case Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_types,
),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $this->deleted_labels,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
+ 'fields' => array(
'client_sort_name' => array(
'name' => 'sort_name',
'title' => ts('Client Name'),
'required' => TRUE,
),
),
- 'filters' =>
- array(
+ 'filters' => array(
'sort_name' => array('title' => ts('Client Name')),
),
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'case_role' => array('name' => 'relationship_type_id',
+ 'fields' => array(
+ 'case_role' => array(
+ 'name' => 'relationship_type_id',
'title' => ts('Case Role(s)'),
),
),
- 'filters' =>
- array(
- 'case_role' =>
- array(
+ 'filters' => array(
+ 'case_role' => array(
'name' => 'relationship_type_id',
'title' => ts('Case Role(s)'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
- 'state_province_id' => array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
'country_id' => array('title' => ts('Country')),
),
'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince(),
),
),
),
- 'civicrm_worldregion' =>
- array(
+ 'civicrm_worldregion' => array(
'dao' => 'CRM_Core_DAO_Worldregion',
- 'filters' =>
- array(
+ 'filters' => array(
'worldregion_id' => array(
'name' => 'id',
- 'title' => ts('WorldRegion'),
+ 'title' => ts('World Region'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::worldRegion(),
),
),
),
- 'civicrm_country' =>
- array(
+ 'civicrm_country' => array(
'dao' => 'CRM_Core_DAO_Country',
),
- 'civicrm_activity_last' =>
- array(
+ 'civicrm_activity_last' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'filters' =>
- array(
- 'last_activity_date_time' =>
- array(
+ 'filters' => array(
+ 'last_activity_date_time' => array(
'name' => 'activity_date_time',
'title' => ts('Last Action Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
'alias' => 'civireport_activity_last',
),
- 'civicrm_activity_last_completed' =>
- array(
+ 'civicrm_activity_last_completed' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array(
- 'last_completed_activity_subject' =>
- array(
+ 'fields' => array(
+ 'last_completed_activity_subject' => array(
'name' => 'subject',
'title' => ts('Subject of the last completed activity in the case'),
),
- 'last_completed_activity_type' =>
- array(
+ 'last_completed_activity_type' => array(
'name' => 'activity_type_id',
'title' => ts('Activity type of the last completed activity'),
),
);
$this->_options = array(
- 'my_cases' =>
- array('title' => ts('My Cases'),
+ 'my_cases' => array(
+ 'title' => ts('My Cases'),
'type' => 'checkbox',
),
);
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->caseDetailSpecialColumnsAdd();
}
- function caseDetailSpecialColumnsAdd() {
+ public function caseDetailSpecialColumnsAdd() {
$elements = array();
$elements[] = &$this->createElement('select', 'case_activity_all_dates', NULL,
array(
- '' => ts('-- select --')) + $this->caseActivityTypes
+ '' => ts('- select -'),
+ ) + $this->caseActivityTypes
);
$this->addGroup($elements, 'case_detail_extra');
- $this->_caseDetailExtra = array('case_activity_all_dates' => array('title' => ts('List of all dates of activities of Type'),
+ $this->_caseDetailExtra = array(
+ 'case_activity_all_dates' => array(
+ 'title' => ts('List of all dates of activities of Type'),
'name' => 'activity_date_time',
),
);
$this->assign('caseDetailExtra', $this->_caseDetailExtra);
}
- function select() {
+ public function select() {
$select = array();
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
$this->_select = 'SELECT ' . implode(', ', $select) . ' ';
}
- function from() {
+ public function from() {
$case = $this->_aliases['civicrm_case'];
$conact = $this->_aliases['civicrm_contact'];
}
}
- function where() {
+ public function where() {
$clauses = array();
$this->_having = '';
foreach ($this->_columns as $tableName => $table) {
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
- if ($fieldName == 'case_type_id' && !empty($this->_params['case_type_id_value'])) {
+ if ($fieldName == 'case_type_id' &&
+ !empty($this->_params['case_type_id_value'])
+ ) {
foreach ($this->_params['case_type_id_value'] as $key => $value) {
if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) === FALSE) {
- $value = CRM_Core_DAO::VALUE_SEPARATOR . $value . CRM_Core_DAO::VALUE_SEPARATOR;
+ $value = CRM_Core_DAO::VALUE_SEPARATOR . $value .
+ CRM_Core_DAO::VALUE_SEPARATOR;
$this->_params['case_type_id_value'][$key] = "'{$value}'";
}
}
if (isset($this->_params['options']['my_cases'])) {
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
$clauses[] = "{$this->_aliases['civicrm_contact']}.id = {$userID}";
}
}
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_case']}.id";
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
- $select = "select COUNT( DISTINCT( {$this->_aliases['civicrm_address']}.country_id))";
- $sql = "{$select} {$this->_from} {$this->_where}";
+ $select = "select COUNT( DISTINCT( {$this->_aliases['civicrm_address']}.country_id))";
+ $sql = "{$select} {$this->_from} {$this->_where}";
$countryCount = CRM_Core_DAO::singleValueQuery($sql);
//CaseType statistics
if (array_key_exists('filters', $statistics)) {
foreach ($statistics['filters'] as $id => $value) {
if ($value['title'] == 'Case Type') {
- $statistics['filters'][$id]['value'] = 'Is ' . $this->case_types[substr($statistics['filters'][$id]
- ['value'], -3, -2
- )];
+ $statistics['filters'][$id]['value'] = 'Is ' .
+ $this->case_types[substr($statistics['filters'][$id]['value'], -3, -2
+ )];
}
}
}
return $statistics;
}
- function orderBy() {
+ public function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_case']}.start_date DESC ";
}
- function caseDetailSpecialColumnProcess() {
+ public function caseDetailSpecialColumnProcess() {
if (!$this->_includeCaseDetailExtra) {
return;
}
LEFT JOIN civicrm_activity civireport_activity_all_{$activityType} ON ( civireport_activity_all_{$activityType}.id = civireport_case_activity_all_{$activityType}.activity_id AND civireport_activity_all_{$activityType}.activity_type_id = {$activityType})";
$this->_columnHeaders['case_activity_all_dates'] = array(
- 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] . ": {$this->caseActivityTypes[$activityType]}",
+ 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] .
+ ": {$this->caseActivityTypes[$activityType]}",
'type' => CRM_Utils_Array::value('type', $this->_caseDetailExtra['case_activity_all_dates']),
);
}
$this->_from .= ' ' . implode(' ', $from) . ' ';
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$this->endPostProcess($rows);
}
- function checkEnabledFields() {
- if (isset($this->_params['worldregion_id_value']) && !empty($this->_params['worldregion_id_value'])) {
+ public function checkEnabledFields() {
+ if (isset($this->_params['worldregion_id_value']) &&
+ !empty($this->_params['worldregion_id_value'])
+ ) {
$this->_addressField = TRUE;
$this->_worldRegionField = TRUE;
}
$this->_relField = TRUE;
}
- if (!empty($this->_params['activity_date_time_relative']) || !empty($this->_params['activity_date_time_from']) ||
+ if (!empty($this->_params['activity_date_time_relative']) ||
+ !empty($this->_params['activity_date_time_from']) ||
CRM_Utils_Array::value('activity_date_time_to', $this->_params)
) {
$this->_activityLast = TRUE;
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$entryFound = FALSE;
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
}
if (array_key_exists('civicrm_case_subject', $row)) {
if ($value = $row['civicrm_case_subject']) {
- $caseId = $row['civicrm_case_id'];
- $contactId = $row['civicrm_contact_id'];
- $rows[$rowNum]['civicrm_case_subject'] = "<a href= 'javascript:viewCase( $caseId,$contactId );'>$value</a>";
+ $url = CRM_Utils_System::url("civicrm/case/ajax/details",
+ "caseId={$row['civicrm_case_id']}&contactId={$row['civicrm_contact_id']}",
+ $this->_absoluteUrl
+ );
+ $rows[$rowNum]['civicrm_case_subject'] = "<a class=\"crm-popup\" href=\"$url\">$value</a>";
$rows[$rowNum]['civicrm_case_subject_hover'] = ts('View Details of Case.');
$entryFound = TRUE;
}
$entryFound = TRUE;
}
- if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) && empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])) {
- $rows[$rowNum]['civicrm_activity_last_completed_last_completed_activity_subject'] = ts('(No Subject)');
+ if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) &&
+ empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])
+ ) {
+ $rows[$rowNum]['civicrm_activity_last_completed_last_completed_activity_subject'] = ts('(no subject)');
$entryFound = TRUE;
}
if (array_key_exists('civicrm_contact_client_sort_name', $row) &&
}
}
}
-