Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78807

Adding empty base conditions to a report should be a no-op

    XMLWordPrintable

Details

    Description

      If a report calls $this->add_base_condition_sql($select); where $select is an empty string (due to some pre-processing), and the report already has another base condition set then we get invalid SQL generated:

      WHERE bp.module = :rbparam0 AND # literally the end of the clause, because of empty string
      

      See: https://github.com/moodle/moodle/blob/b4cd63746a7f214b2afd8d7f8b745007c8405ef9/reportbuilder/classes/local/report/base.php#L227-L238

      There exists a fairly easy workaround: account for empty $select string, and replace with "1=1" but that's not nice to remember/do - improve the API to do the right thing in these cases

      Discovered while working on tenancy segregation in WP-4110

      Attachments

        Activity

          People

            pholden Paul Holden
            pholden Paul Holden
            Ruslan Kabalin Ruslan Kabalin
            David Carrillo David Carrillo
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 51 minutes
                51m

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.