catalyst / totara-mod-ojt

https://github.com/catalyst/totara-mod-ojt/wiki
5 stars 21 forks source link

'position_assignment' not in join list for content #44

Closed matthewhilton closed 2 years ago

matthewhilton commented 2 years ago

In the T12 version of the plugin, if you make a report using the totara report builder with the source OJT Topic item completion and enable the option Records for user's direct reports for any of the user's job assignments (under content), the report gives an error:

 'position_assignment' not in join list for content

Debug info:
Error code: joinnotinjoinlist
Stack trace:
line 475 of /lib/setuplib.php: moodle_exception thrown
line 3247 of /totara/reportbuilder/lib.php: call to print_error()
line 3222 of /totara/reportbuilder/lib.php: call to reportbuilder->get_single_join()
line 3321 of /totara/reportbuilder/lib.php: call to reportbuilder->get_joins()
line 4364 of /totara/reportbuilder/lib.php: call to reportbuilder->get_content_joins()
line 4152 of /totara/reportbuilder/lib.php: call to reportbuilder->collect_joins()
line 5034 of /totara/reportbuilder/lib.php: call to reportbuilder->build_query()
line 5020 of /totara/reportbuilder/lib.php: call to reportbuilder->get_data()
line 4890 of /totara/reportbuilder/lib.php: call to reportbuilder->get_data_for_table()
line 4697 of /totara/reportbuilder/lib.php: call to reportbuilder->display_table_default()
line 726 of /totara/reportbuilder/renderer.php: call to reportbuilder->display_table()
line 108 of /totara/reportbuilder/report.php: call to totara_reportbuilder_renderer->report_html()

I would guess that this is because there is the content option added:

new rb_content_option(
                'user',
                get_string('user', 'rb_source_ojt_topic_item_completion'),
                array(
                    'userid' => 'base.userid'
                    'managerid' => 'position_assignment.managerid',
                    'managerpath' => 'position_assignment.managerpath',
                    'postype' => 'position_assignment.type',
                ),
                'position_assignment'
            ),

But there is no 'position_assignment' in the define_joinlist

I've tried adding a rb_join to the joinlist to join the position column from mdl_ojt_topic_item , however, I do not think I am linking it correctly and I am not familiar enough with the Totara report builder to debug it easily.

alexmorrisnz commented 2 years ago

Hi @matthewhilton I've updated the OJT_12 branch to resolve this by using the core function add_basic_user_content_options If you update your site to the new version it should function correctly