CRM-14106 - Regex targeting the first part of if statements
[civicrm-core.git] / CRM / Report / Form / Case / Detail.php
index f108ff673ec918f34ae2c9a25386129797334779..3a68446e8a7863f2f2a908bb622bae59e04b3289 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -62,6 +62,8 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
       $this->rel_types[$relid] = $v['label_b_a'];
     }
 
+    $this->deleted_labels = array('' => ts('- select -'), 0 => ts('No'), 1 => ts('Yes'));
+
     $this->caseActivityTypes = array();
     foreach (CRM_Case_PseudoConstant::caseActivityType() as $typeDetail) {
       $this->caseActivityTypes[$typeDetail['id']] = $typeDetail['label'];
@@ -88,6 +90,10 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
           ),
           'status_id' => array('title' => ts('Case Status')),
           'case_type_id' => array('title' => ts('Case Type')),
+          'is_deleted' => array('title' => ts('Deleted?'),
+            'default' => FALSE,
+            'type' => CRM_Utils_Type::T_INT,
+          ),
         ),
         'filters' =>
         array(
@@ -107,6 +113,12 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $this->case_types,
           ),
+          'is_deleted' => array('title' => ts('Deleted?'),
+            'type' => CRM_Utils_Type::T_INT,
+            'operatorType' => CRM_Report_Form::OP_SELECT,
+            'options' => $this->deleted_labels,
+            'default' => 0,
+          ),
         ),
       ),
       'civicrm_contact' =>
@@ -292,7 +304,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
           if ($tableName == 'civicrm_address') {
             $this->_addressField = TRUE;
           }
-          if (CRM_Utils_Array::value('required', $field) ||
+          if (!empty($field['required']) ||
             CRM_Utils_Array::value($fieldName, $this->_params['fields'])
           ) {
             if ($tableName == 'civicrm_email') {
@@ -538,7 +550,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
       $this->_relField = TRUE;
     }
 
-    if (CRM_Utils_Array::value('activity_date_time_relative', $this->_params) ||
+    if (!empty($this->_params['activity_date_time_relative']) ||
       CRM_Utils_Array::value('activity_date_time_from', $this->_params) ||
       CRM_Utils_Array::value('activity_date_time_to', $this->_params)
     ) {
@@ -546,7 +558,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
     }
 
     foreach (array_keys($this->_caseDetailExtra) as $field) {
-      if (CRM_Utils_Array::value($field, $this->_params['case_detail_extra'])) {
+      if (!empty($this->_params['case_detail_extra'][$field])) {
         $this->_includeCaseDetailExtra = TRUE;
         break;
       }
@@ -639,6 +651,12 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
+      if (array_key_exists('civicrm_case_is_deleted', $row)) {
+        $value = $row['civicrm_case_is_deleted'];
+        $rows[$rowNum]['civicrm_case_is_deleted'] = $this->deleted_labels[$value];
+        $entryFound = TRUE;
+      }
+
       if (!$entryFound) {
         break;
       }