*
*/
function __construct() {
- $this->case_types = CRM_Case_PseudoConstant::caseType();
+ $this->case_types = CRM_Case_PseudoConstant::caseType();
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
- $rels = CRM_Core_PseudoConstant::relationshipType();
+ $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->_columns = array(
- 'civicrm_c2' =>
- array(
+ 'civicrm_c2' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'client_name' =>
- array(
+ 'fields' => array(
+ 'client_name' => array(
'name' => 'sort_name',
'title' => ts('Client'),
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
),
- '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'),
'required' => TRUE,
),
'subject' => array(
- 'title' => ts('Case Subject'), 'default' => TRUE,
+ 'title' => ts('Case Subject'),
+ 'default' => TRUE,
),
'status_id' => array(
- 'title' => ts('Status'), 'default' => TRUE,
+ 'title' => ts('Status'),
+ 'default' => TRUE,
),
'case_type_id' => array(
- 'title' => ts('Case Type'), 'default' => TRUE,
+ 'title' => ts('Case Type'),
+ 'default' => TRUE,
),
'start_date' => array(
- 'title' => ts('Start Date'), 'default' => TRUE,
+ 'title' => ts('Start Date'),
+ 'default' => TRUE,
'type' => CRM_Utils_Type::T_DATE,
),
'end_date' => array(
- 'title' => ts('End Date'), 'default' => TRUE,
+ 'title' => ts('End Date'),
+ 'default' => TRUE,
'type' => CRM_Utils_Type::T_DATE,
),
'duration' => array(
- 'title' => ts('Duration (Days)'), 'default' => FALSE,
+ 'title' => ts('Duration (Days)'),
+ 'default' => FALSE,
),
'is_deleted' => array(
- 'title' => ts('Deleted?'), 'default' => FALSE, 'type' => CRM_Utils_Type::T_INT,
+ '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,
),
- '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,
),
- 'status_id' => array('title' => ts('Status'),
+ 'status_id' => array(
+ 'title' => ts('Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_statuses,
),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'type' => CRM_Report_Form::OP_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $this->deleted_labels,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Staff Member'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Staff Member'),
'default' => TRUE,
),
),
- 'filters' =>
- array('sort_name' => array('title' => ts('Staff Member'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Staff Member'),
),
),
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'filters' =>
- array('relationship_type_id' => array('title' => ts('Staff Relationship'),
+ 'filters' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Staff Relationship'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->rel_types,
),
),
),
- 'civicrm_relationship_type' =>
- array(
+ 'civicrm_relationship_type' => array(
'dao' => 'CRM_Contact_DAO_RelationshipType',
- 'fields' =>
- array(
- 'label_b_a' =>
- array(
- 'title' => ts('Relationship'), 'default' => TRUE,
+ 'fields' => array(
+ 'label_b_a' => array(
+ 'title' => ts('Relationship'),
+ 'default' => TRUE,
),
),
),
- 'civicrm_case_contact' =>
- array(
+ 'civicrm_case_contact' => array(
'dao' => 'CRM_Case_DAO_CaseContact',
),
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_relationship_type') {
$this->_relField = TRUE;
*/
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
- if (empty($fields['relationship_type_id_value']) && (array_key_exists('sort_name', $fields['fields']) || array_key_exists('label_b_a', $fields['fields']))) {
+ if (empty($fields['relationship_type_id_value']) &&
+ (array_key_exists('sort_name', $fields['fields']) ||
+ array_key_exists('label_b_a', $fields['fields']))
+ ) {
$errors['fields'] = ts('Either filter on at least one relationship type, or de-select Staff Member and Relationship from the list of fields.');
}
- if ((!empty($fields['relationship_type_id_value']) || !empty($fields['sort_name_value'])) && (!array_key_exists('sort_name', $fields['fields']) || !array_key_exists('label_b_a', $fields['fields']))) {
+ if ((!empty($fields['relationship_type_id_value']) ||
+ !empty($fields['sort_name_value'])) &&
+ (!array_key_exists('sort_name', $fields['fields']) ||
+ !array_key_exists('label_b_a', $fields['fields']))
+ ) {
$errors['fields'] = ts('To filter on Staff Member or Relationship, please also select Staff Member and Relationship from the list of fields.');
}
return $errors;
function from() {
- $cc = $this->_aliases['civicrm_case'];
- $c = $this->_aliases['civicrm_contact'];
- $c2 = $this->_aliases['civicrm_c2'];
- $cr = $this->_aliases['civicrm_relationship'];
+ $cc = $this->_aliases['civicrm_case'];
+ $c = $this->_aliases['civicrm_contact'];
+ $c2 = $this->_aliases['civicrm_c2'];
+ $cr = $this->_aliases['civicrm_relationship'];
$crt = $this->_aliases['civicrm_relationship_type'];
$ccc = $this->_aliases['civicrm_case_contact'];
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- if (CRM_Utils_Array::value("operatorType", $field) & CRM_Report_Form::OP_DATE) {
+ if (CRM_Utils_Array::value("operatorType", $field) &
+ CRM_Report_Form::OP_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,
CRM_Utils_Array::value('type', $field)
if ($fieldName == 'case_type_id') {
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (!empty($value)) {
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+ $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" .
+ implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
$op = NULL;
}
}
}
- if (array_key_exists('civicrm_case_case_type_id', $row) && !empty($rows[$rowNum]['civicrm_case_case_type_id'])) {
- $value = $row['civicrm_case_case_type_id'];
+ if (array_key_exists('civicrm_case_case_type_id', $row) &&
+ !empty($rows[$rowNum]['civicrm_case_case_type_id'])
+ ) {
+ $value = $row['civicrm_case_case_type_id'];
$typeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- $value = array();
+ $value = array();
foreach ($typeIds as $typeId) {
if ($typeId) {
$value[$typeId] = $this->case_types[$typeId];
}
// convert Case ID and Subject to links to Manage Case
- if (array_key_exists('civicrm_case_id', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
+ if (array_key_exists('civicrm_case_id', $row) &&
+ !empty($rows[$rowNum]['civicrm_c2_id'])
+ ) {
$url = CRM_Utils_System::url("civicrm/contact/view/case",
- 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
+ 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' .
+ $row['civicrm_case_id'],
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_case_id_link'] = $url;
$rows[$rowNum]['civicrm_case_id_hover'] = ts("Manage Case");
$entryFound = TRUE;
}
- if (array_key_exists('civicrm_case_subject', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
+ if (array_key_exists('civicrm_case_subject', $row) &&
+ !empty($rows[$rowNum]['civicrm_c2_id'])
+ ) {
$url = CRM_Utils_System::url("civicrm/contact/view/case",
- 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
+ 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' .
+ $row['civicrm_case_id'],
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_case_subject_link'] = $url;