Closed aolley closed 11 years ago
The 'section' field in the course_module table is recorded with the course_sections.id field.
So the "section" in $mod, and the one passed to course_add_cm_to_section have to be different. So if sectionid is mean't to be the sectionnum, then the $mod->section = $sectionid needs to have the $DB call I did later. I'll amend my commit to reflect that.
Thanks @aolley I see what you meant now.
Updated my commit :)
Hi @aolley I committed df3a2b8bc5407ef1f73f0765b58f072cd50ce994 to address the issues I commented in your last commit.
"$sectionid supposed to be course_sections.id right? you got course_sections.section here."
Ah yes, I had just moved the DB call up when i amended the commit and fixed up the params, forgot to switch the field it grabs.
$mod->section is set to the $sectionid as it should be. However the $section param passed to course_add_cm_to_section function is meant to be the relative section number in the course, not the absolute section id.