fix where and qill for all the date filters
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 25 Aug 2015 09:19:29 +0000 (14:49 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 25 Aug 2015 09:19:29 +0000 (14:49 +0530)
CRM/Report/Form/Contribute/Recur.php

index 446c4092d76f0950e3ba389e32ab24848036f3ce..e2938671746aeb45f33d2b6686f44a9e27ce6a0d 100644 (file)
@@ -191,22 +191,22 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
           'start_date' => array(
             'title' => ts('Start Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'next_sched_contribution_date' => array(
             'title' => ts('Next Scheduled Contribution Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'end_date' => array(
             'title' => ts('End Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
-          'contribution_processed_date' => array(
+          'modified_date' => array(
             'title' => ts('Last Contribution Processed'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'calculated_end_date' => array(
             'title' => ts('Calculated end date (either end date or date all installments will be made)'),
@@ -313,16 +313,8 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
 ";
         $isBreak = TRUE;
       }
-      if (!empty($this->_params['contribution_processed_date_' . $suffix])) {
-        $relative = CRM_Utils_Array::value("contribution_processed_date_relative", $this->_params);
-        $from = CRM_Utils_Array::value("contribution_processed_date_from", $this->_params);
-        $to = CRM_Utils_Array::value("contribution_processed_date_to", $this->_params);
-        $this->_where .= " AND contribution_civireport.id IN (SELECT MAX(cc.id)
-          FROM civicrm_contribution cc
-          LEFT JOIN civicrm_contribution_recur ccr ON cc.contribution_recur_id = ccr.id
-          WHERE ccr.contribution_status_id = 1 AND (" .
-          $this->dateClause("DATE(ccr.modified_date)",
-          $relative, $from, $to, CRM_Utils_Type::T_DATE, NULL, NULL) . " ) GROUP BY cc.contribution_recur_id)";
+      if (!empty($this->_params['modified_date_' . $suffix])) {
+        $this->_where .= " AND {$this->_aliases['civicrm_contribution_recur']}.contribution_status_id = 1";
         $isBreak = TRUE;
       }
       if (!empty($isBreak)) {