Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9505

Allow time filters on date fields in CiviReport

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.0.8
    • Fix Version/s: 4.2.0
    • Component/s: None
    • Labels:
      None

      Description

      This code allows reports to take time filters - ie.

      register_date_from = 2011-01-01
      register_date_from_time = 6PM

      It should work with URL filters.

      I have been adding the fields to my report through a hacky method of over-riding the addDateRange function on the report instance

      function addDateRange( $name, $label = 'From:', $dateFormat = 'searchDate', $required = false )

      { $this->addDateTime( $name . '_from', $label , $required, array( 'formatType' => $dateFormat ) ); $this->addDateTime( $name . '_to' , ts('To:'), $required, array( 'formatType' => $dateFormat ) ); }

      It seems that it would make sense to add to CRM_Core_Form a function

      function addDateTimeRange( $name, $label = 'From:', $dateFormat = 'searchDate', $required = false ) {
      $this->addDateTime( $name . '_from', $label , $required, array( 'formatType' => $dateFormat ) );
      $this->addDateTime( $name . '_to' , ts('To:'), $required, array( 'formatType' => $dateFormat ) );

      However, to use it on the report it then requires an additional constant (I think) , altering $this->addFilters & altering CRM_Core_Form_Date::buildDateRange(

      It wouldn't be TOOO bad but I have too many questions to tackle it

      However, this minor patch does seem to give a small bit of useful extra functionality

        Attachments

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: