Browse Source

Merge pull request #1152 from jloguercio/8170

Added the functionality of create a course category if the category doesn't exist when importing courses - Refs #8170
José Loguercio 8 years ago
parent
commit
bd6ade3858
1 changed files with 1 additions and 3 deletions
  1. 1 3
      main/admin/course_import.php

+ 1 - 3
main/admin/course_import.php

@@ -65,9 +65,7 @@ function validate_data($courses)
         if (isset($course['CourseCategory']) && strlen($course['CourseCategory']) != 0) {
             $categoryInfo = CourseCategory::getCategory($course['CourseCategory']);
             if (empty($categoryInfo)) {
-                //@todo this is so bad even all lang variables are wrong ...
-                $course['error'] = get_lang('UnkownCategoryCourseCode').' ('.$course['CourseCategory'].')';
-                $errors[] = $course;
+                CourseCategory::addNode($course['CourseCategory'], $course['CourseCategory'], 'TRUE', null);
             }
         }
     }