Fix delete course when setting "allow_skill_rel_items" is enabled

pull/2525/head
jmontoyaa 7 years ago
parent 594bd30611
commit c3b4fc1745
  1. 2
      main/admin/course_list.php
  2. 8
      main/inc/lib/course.lib.php

@ -342,6 +342,8 @@ if (isset($_POST['action'])) {
$obj_cat->update_category_delete($course_code);
}
}
Display::addFlash(Display::return_message(get_lang('Deleted')));
break;
}
}

@ -2314,9 +2314,15 @@ class CourseManager
// Skills
$table = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER);
$argumentation = Database::escape_string(sprintf(get_lang('SkillFromCourseXDeletedSinceThen'), $course['code']));
$sql = "UPDATE $table SET course_id = NULL, session_id = NULL, argumentation = '$argumentation' WHERE course_id = $courseId";
$sql = "UPDATE $table SET course_id = NULL, session_id = NULL, argumentation = '$argumentation'
WHERE course_id = $courseId";
Database::query($sql);
if (api_get_configuration_value('allow_skill_rel_items')) {
$sql = "DELETE FROM skill_rel_course WHERE c_id = $courseId";
Database::query($sql);
}
// Deletes all groups, group-users, group-tutors information
// To prevent fK mix up on some tables
GroupManager::deleteAllGroupsFromCourse($courseId);

Loading…
Cancel
Save