commit 625c8abb4f8050f1086521d3c36b9ec32b21ff7e Author: Troy Williams Date: Thu Sep 2 11:47:42 2010 +1200 MDL-24043 addslashes_object() for and added default course category is insert fails diff --git a/enrol/imsenterprise/enrol.php b/enrol/imsenterprise/enrol.php old mode 100644 new mode 100755 index 7f127a6..fb32380 --- a/enrol/imsenterprise/enrol.php +++ b/enrol/imsenterprise/enrol.php @@ -524,11 +524,12 @@ function process_group_tag($tagcontents){ // Else if we're allowed to create new categories, let's create this one $newcat->name = $group->category; $newcat->visible = 0; - if($catid = insert_record('course_categories', $newcat)){ + if($catid = insert_record('course_categories', addslashes_object($newcat))){ $course->category = $catid; $this->log_line("Created new (hidden) category, #$catid: $newcat->name"); }else{ - $this->log_line('Failed to create new category: '.$newcat->name); + $this->log_line('Failed to create new category: '.$newcat->name.' so using default category instead.'); + $course->category = 1; } }else{ // If not found and not allowed to create, stick with default