CRM-11558 Conditional to include time fields on a report date filter

    Details

    • Type: Task
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.6
    • Fix Version/s: 4.3.0
    • Component/s: CiviReport
    • Labels:
      None
    • Documentation Required?:
      User and Admin Doc
    • Funding Source:
      Needs Funding

      Description

      Implement a new constant "OP_DATETIME" which has all the OP_DATE behavior, plus exposing time fields as in CRM-9505

      See also http://issues.civicrm.org/jira/browse/CRM-11551

        Attachments

          Activity

          [CRM-11558] Conditional to include time fields on a report date filter
          Adam Wight added a comment -

          Please see r44552

          Deepak Srivastava added a comment -

          Adam, Thanks for the fix.

          I have added a operator type constant so report writer could decide the appearance of date fields, and it also keeps the behaviour consistent with other filters.

          Adam Wight added a comment -

          nice one!

          Ravish Nair added a comment -

          checked in r44621

          Eileen McNaughton added a comment -

          I wanted to check what was in the mentioned svn commit - so I've pasted the diff since it's not easy to get to anymore. I see the constant is there on
          https://github.com/civicrm/civicrm-core/blob/6dd5c484fe8bad23de027e9de47277671ac57632/CRM/Report/Form.php#L41-41

          Index: Core/Form.php
          ===================================================================
          — Core/Form.php (revision 44551)
          +++ Core/Form.php (revision 44552)
          @@ -799,9 +799,14 @@
          $this->addButtons($buttons);
          }

          • function addDateRange($name, $from = '_from', $to = '_to', $label = 'From:', $dateFormat = 'searchDate', $required = FALSE) {
          • $this->addDate($name . $from, $label, $required, array('formatType' => $dateFormat));
          • $this->addDate($name . $to, ts('To:'), $required, array('formatType' => $dateFormat));
            + function addDateRange($name, $from = '_from', $to = '_to', $label = 'From:', $dateFormat = 'searchDate', $required = FALSE, $displayTime = FALSE)
            Unknown macro: {+ if ($displayTime) { + $this->addDateTime($name . $from, $label, $required, array('formatType' => $dateFormat)); + $this->addDateTime($name . $to, ts('To:'), $required, array('formatType' => $dateFormat)); + } else { + $this->addDate($name . $from, $label, $required, array('formatType' => $dateFormat)); + $this->addDate($name . $to, ts('To:'), $required, array('formatType' => $dateFormat)); + } }

          function addSelect($name, $label, $prefix = NULL, $required = NULL, $extra = NULL, $select = '- select -') {
          Index: Core/Form/Date.php
          ===================================================================
          — Core/Form/Date.php (revision 44551)
          +++ Core/Form/Date.php (revision 44552)
          @@ -77,7 +77,7 @@

          • @static
          • @access public
            */
          • static function buildDateRange(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $addReportFilters = TRUE, $dateFormat = 'searchDate')
            Unknown macro: {+ static function buildDateRange(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From}

          Index: Report/Form.php
          ===================================================================
          — Report/Form.php (revision 44551)
          +++ Report/Form.php (revision 44552)
          @@ -747,7 +747,10 @@

          case CRM_Report_FORM::OP_DATE:
          // build datetime fields

          • CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count);
            + CRM_Core_Form_Date::buildDateRange(
            + $this, $fieldName, $count,
            + '_from', '_to', 'From:', FALSE, TRUE, 'searchDate',
            + $field['type'] != CRM_Utils_Type::T_DATE);
            $count++;
            break;

            People

            • Assignee:
              Ravish Nair
              Reporter:
              Adam Wight

              Dates

              • Created:
                Updated:
                Resolved: