Merge branch 'MDL-81713-main' of https://github.com/junpataleta/moodle
[moodle.git] / reportbuilder / upgrade.txt
blob3e158489546926fcff790daf4c53cb9ee5c8b3c8
1 This file describes API changes in /reportbuilder/*
2 Information provided here is intended especially for developers.
4 === 4.5 ===
6 * The following external methods now return tags data relevant to each custom report:
7   - `core_reportbuilder_list_reports`
8   - `core_reportbuilder_retrieve_report`
9 * The following previously deprecated local helper methods have been removed and can no longer be used:
10   - `audience::get_all_audiences_menu_types`
11   - `report::get_available_columns`
12 * The base datasource `add_all_from_entities` method accepts optional parameter to specify which entities to add elements from
14 === 4.4 ===
16 * New methods `get_identity_[columns|filters]` in user entity, for retrieving all user identity field report elements
17 * Entity table aliases are now auto-generated, hence usage of the `get_default_table_aliases` method is now deprecated. Instead,
18   entities should implement the `get_default_tables` method to define the tables they use
19 * New method `get_table_aliases` in base entity class, for retrieving all table aliases in a single call
20 * The database helper `generate_alias[es]` and `generate_param_name[s]` methods now accept an optional `$suffix` argument for
21   appending additional string to the generated value
22 * The `get_name` method has been moved to the base report class and can now be implemented for both custom and system reports, it
23   will be used as the caption when rendering tables (which can also be targeted in Behat scenarios)
24 * The default value for the filename when calling `set_downloadable` is now taken from calling `get_name` on the current report
25 * The base datasource `add_all_from_entity` method accepts additional parameters to limit which columns, filters and conditions
26   are added. The `add_[columns|filters|conditions]_from_entity` class methods also now support wildcard matching in both `$include`
27   and `$exclude` parameters
28 * Custom reports now implement the tag API, with options for specifying in the `report::[create|update]_report` helper methods
29   as well as in the `create_report` test generator method
30 * The `tags` filter has been improved to also allow for filtering by component/itemtype core_tag definition - this is more
31   suited for system reports
32 * New report filter types:
33   - `cohort` for reports containing cohort data
34   - `courserole` for reports showing course enrolments
35   - `filesize` for reports containing filesize data
37 === 4.3 ===
39 * New external methods for retrieving system report data:
40   - `core_reportbuilder_can_view_system_report`
41   - `core_reportbuilder_retrieve_system_report`
42 * New `get_tag_joins_for_entity` helper in base entity class, for returning SQL joins necessary for retrieving tags
43 * New methods `[set|has]_table_join_alias` in the base entity class, to allow entities to reduce joins on the same table
44 * New `set_is_deprecated` method in base `local\report\[column|filter]` classes to deprecate report entity columns and filters
45 * The following report entity columns have been deprecated, with replacements as follows:
46   - `comment:context` => `context:name`
47   - `comment:contexturl` => `context:link`
48   - `enrolment:method` => `enrol:name` (plus enrolment formatter `enrolment_name` method)
49   - 'enrolment:role` => `role:name`
50   - `file:context` => `context:name`
51   - `file:contexturl` => `context:link`
52   - `instance:context` (tag) => `context:name`
53   - `instance:contexturl` (tag) => `context:link`
54 * The following report entity filters/conditions have been deprecated, with replacements as follows:
55   - `enrolment:method` => `enrol:plugin`
56 * The `local/audience/form` template outer region has renamed some of it's `data-` attributes (relevant for any themes that
57   have overridden this template):
58   - `data-instanceid` => `data-audience-id`
59   - `data-title` => `data-audience-title`
60 * The `add_base_condition_sql` method of the base report class will now ignore empty where clauses
61 * If a non-default column is specified in a datasource `get_default_column_sorting` method, a coding exception will be thrown
62 * Trying to add/annotate duplicate entity names to a report will now throw a coding exception
63 * The `get_default_entity_name` method of the base entity class is now private, and shouldn't be overridden in extending classes
64 * The report helper methods `add_report_[condition|filter]` now throw an exception when trying to add duplicate conditions or
65   filters to a report
66 * Two new methods:
67   - `get_default_no_results_notice` and
68   - `set_default_no_results_notice`
69   have been added to core_reportbuilder\local\report\base, allowing report implementations to control what lang string is used in
70   the notice when the report has no results. Reports can either set a preferred lang string, or pass null if the notice isn't
71   required in that particular report.
73 === 4.2 ===
75 * New method `set_checkbox_toggleall` in system report class to allow reports to easily create checkbox toggle columns
76 * Column callbacks are now passed a fourth argument to indicate the aggregation type currently being applied, which allows
77   for columns to define how the aggregated data is displayed
78 * New methods `[add|get]_attributes` added to report base class, for including custom attributes in report container HTML
79 * New database helper method `sql_replace_parameter_names` to help ensure uniqueness of parameters within an expression (where
80   that expression can be used multiple times as part of a larger query)
81 * The local report filter class has a new `get_field_sql_and_params` method which should be used by filter types that re-use
82   the filter field SQL within their generated expression, to ensure SQL containing parameters works correctly
83 * The following attributes can be added to custom reports in order to control card view display (via the `add_attributes` method):
84   - `data-force-card` to force cards view
85   - `data-force-table` to force table view
86 * New optional parameter `pagesize` in external method `core_reportbuilder_reports_get` to set the displayed rows per page.
87 * Javascript reports repository module method `getReport` updated to accept new pagesize parameter.
88 * The schedule helper `create_schedule` method accepts a `$timenow` parameter to use for comparisons against current date
89   during tests
90 * The `datasource_stress_test_columns` test helper now enables sorting on those columns that support it
91 * The `create_[column|filter|condition]` test generator methods now allow for setting all persistent properties
92 * The `get_category` method of the base audience class has been deprecated, callers should instead use `get_component_displayname`
94 === 4.1 ===
96 * New method `add_action_divider()` in base system report class, to allow adding a divider to the action menu.
97 * New external method `core_reportbuilder_set_filters` for setting report filter values (plus `setFilters` AJAX repository
98   export for calling from Javascript modules)
99 * New method `set_filter_form_default` in base system report class, to override whether the default filters form
100   should be shown for a report
101 * The external `core_reportbuilder_filters_reset` method now accepts an optional `parameters` argument, required by
102   some system reports
103 * New external methods for retrieving custom report data:
104   - `core_reportbuilder_list_reports`
105   - `core_reportbuilder_retrieve_report`
106   - `core_reportbuilder_view_report`
107 * For consistency, the following entity classes have moved namespace (usage of previous namespace will generate debugging):
108   - `core_admin\{ => reportbuilder}\local\entities\task_log`
109   - `core_cohort\{ => reportbuilder}\local\entities\cohort`
110   - `core_cohort\{ => reportbuilder}\local\entities\cohort_member`
111   - `core_course\{ => reportbuilder}\local\entities\course_category`
112   - `report_configlog\{ => reportbuilder}\local\entities\config_change`
113 * 'set_default_per_page' and 'get_default_per_page' methods have been added to \local\report\base class
114   to manage the default displayed rows per page.
115 * Added two new methods in the datasource class:
116   - add_all_from_entity() to add all columns/filters/conditions from the given entity to the report at once
117   - add_all_from_entities() to add all columns/filters/conditions from all the entities added to the report at once
118 * New database helper methods for generating multiple unique values: `generate_aliases` and `generate_param_names`
119 * The base aggregation `format_value` method has a `$columntype` argument in order to preserve type during aggregation. When
120   defining column callbacks, strict typing will now be preserved in your callback methods when the column is being aggregated
121 * The method `get_joins()` in the base entity class is now public, allowing for easier joins within reports
122 * New method `set_table_aliases` in base entity class, for overriding multiple table aliases in a single call
123 * The following local helper methods have been deprecated, their implementation moved to exporters:
124   - `audience::get_all_audiences_menu_types` -> `custom_report_audience_cards_exporter`
125   - `report::get_available_columns` -> `custom_report_column_cards_exporter`
126 * The `custom_report_exporter` class now defines its editor element properties as optional, rather than each of those exporters
127   defining their own properties as optional. In turn, this means the structure of the following external methods will always be
128   present and consistent:
129   - `core_reportbuilder_columns_*`
130   - `core_reportbuilder_conditions_*`
131   - `core_reportbuilder_filters_*`
132 * The `custom_report_*` exporters now accept only classes that extend datasource as part of their related data properties
133 * The following permission methods now accept an optional `$context` parameter (default system context):
134   - `[require_]can_view_reports_list`
135   - `[require_]can_create_report`
136 * New method `get_default_condition_values()` in base datasource class, to be overridden by sources that wish to
137   define default values for conditions upon report creation.
138 * New methods `get_identity_[column|filter]` in user entity, for retrieving user identity field report elements
139 * New method `user_reports_list_access_sql` in audience helper for retrieving list of all reports for given user
140 * New report filter types:
141   - `category` for reports containing course categories
142   - `tags` for reports containing entities with support for core_tag API
143   - `autocomplete` for reports that contain pre-defined values for selection.
144 * New method `get_sample_values()` added to base filter class, to be overridden in all filter types to support stress testing
145 * New test helpers for automated stress testing of report sources:
146   - `datasource_stress_test_columns`
147   - `datasource_stress_test_columns_aggregation`
148   - `datasource_stress_test_conditions`
149 * The test helper method `get_custom_report_content()` now accepts a list of filter values and applies them to the report
150 * New method `get_default_column_sorting` in base datasource class, to be overridden by sources that wish to
151   define default columns sort order upon report creation.