Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-8741

Configurable Reports Custom User Field

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.9.10, 3.10.7
    • None
    • 3.9.0
    • MOODLE_310_STABLE, MOODLE_39_STABLE

      According to a previous update in https://tracker.moodle.org/browse/CONTRIB-7985  we should be able to specify a logical operator on the users filter, I am assuming like so:

       

      %%FILTER_USERS:u.lastname:=%%

      However given the query below:

      select u.lastname as 'lastname'
      from prefix_user u
      where 1=1
      %%FILTER_USERS:u.lastname:=%%

      When I apply the filter I get an error reading from database. It appears to me that the equals operator is being used correctly but the search parameter is not being enclosed in quotes.


      Debug info: Unknown column 'McQueen' in 'where clause'
      select u.lastname as 'lastname'
      from mdl_user u
      where 1=1
      AND u.lastname = McQueen

      LIMIT 0, 5000
      – line 87 of /blocks/configurable_reports/reports/sql/report.class.php: call to mysqli_native_moodle_database->get_recordset_sql()
      – line 132 of /blocks/configurable_reports/reports/sql/report.class.php: call to report_sql->execute_query()
      – line 74 of /blocks/configurable_reports/viewreport.php: call to report_sql->create_report()
      [array (
      )]
      Error code: dmlreadexception
      ×Stack trace: * line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown

      • line 1212 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 87 of /blocks/configurable_reports/reports/sql/report.class.php: call to mysqli_native_moodle_database->get_recordset_sql()
      • line 132 of /blocks/configurable_reports/reports/sql/report.class.php: call to report_sql->execute_query()
      • line 74 of /blocks/configurable_reports/viewreport.php: call to report_sql->create_report()

         

      If I use the LIKE operator instead and break the query I can see the search is quoted in the debug output: 

      AND u.lastname LIKE '%McQueen%'

       

       

       

       

            jleyva Juan Leyva
            benkahn Benjamin Kahn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

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