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

When coding a report template, can specify a default 'from' and 'to' for date ranges, but not for integer ranges

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.13, 4.6.5
    • Fix Version/s: 4.7
    • Component/s: CiviReport
    • Labels:
      None
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Contributed Code

      Description

      In CRM_Report_Form::setDefaultValues, specifically in the section dealing with filters, we can see that if we are working with a date filter, a default value can be specified as an array with 'from' and 'to'.

      I'm currently working with an integer field where a BETWEEN operator makes sense. As the form fields for this are called {$fieldName}_min and _max, defaults for these are not currently filled.

      I propose adding the lines:

                  else if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_INT && is_array($field['default'])) {
                    $this->_defaults["{$fieldName}_min"] = CRM_Utils_Array::value('min', $field['default']);
                    $this->_defaults["{$fieldName}_max"] = CRM_Utils_Array::value('max', $field['default']);
                  }
      

      after the bit that deals with dates, and then a default integer range can be similarly specified. PRs shortly.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              DaveFF David Knoll
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: