Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when uploading company users from CSV file with selected courses to enrol into - IOMAD_401_STABLE #1916

Open
ni-ght opened this issue Dec 11, 2023 · 1 comment

Comments

@ni-ght
Copy link

ni-ght commented Dec 11, 2023

Hello,

When I try to upload company users from a CSV file, with selected courses to enrol into, I get the following exception:

Coding error detected, it must be fixed by a programmer: Invalid database query parameter value
More information about this error

Debug info: Objects are are not allowed: stdClass
Error code: codingerror × Dismiss this notification
Stack trace:
line 883 of /lib/dml/moodle_database.php: coding_exception thrown
line 902 of /lib/dml/moodle_database.php: call to moodle_database->detect_objects()
line 1277 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->fix_sql_params()
line 1679 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
line 1651 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
line 1630 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 330 of /local/iomad/lib/user.php: call to moodle_database->get_record()
line 1057 of /blocks/iomad_company_admin/uploaduser.php: call to company_user::enrol()

I believe the problem lies with the file "/blocks/iomad_company_admin/uploaduser.php", line 1055.
The "$courseids[]" array is being populated with "stdClass" objects.

foreach ($formdata->selectedcourses as $selectedcourse) {
    $courseids[] = $selectedcourse;
}

Replacing the above with the following code seems to fix the issue:

foreach ($formdata->selectedcourses as $selectedcourse) {
    $courseids[] = $selectedcourse->id;
}

Many thanks

encodecreate pushed a commit to encodecreate/Creation-Suite that referenced this issue Jan 12, 2024
@encodecreate
Copy link

Just made a pull request to get this fixed. Thanks for finding the issue, I was having trouble with this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants