function DatabaseHandler::update_course_requirement_from_name
Search API
7.x DatabaseHandler.php | DatabaseHandler::update_course_requirement_from_name($subject_id, $course_num, $new_course_id, $school_id = 0) |
6.x DatabaseHandler.php | DatabaseHandler::update_course_requirement_from_name($subject_id, $course_num, $new_course_id, $school_id = 0) |
File
- classes/
DatabaseHandler.php, line 645
Class
Code
function update_course_requirement_from_name($subject_id, $course_num, $new_course_id, $school_id = 0)
{
// This will convert all instances of subject_id/course_num
// to use the newCourseID. It looks through the requirements tables
// that may have listed it as a requirement. We will
// look specifically at the data_entry_value to do some of them.
// ************ IMPORTANT ****************
// This is used only by dataentry. It is intentionally
// not doing the draft tables!
$res = $this->db_query("UPDATE degree_requirements
set `course_id`= ?
where `data_entry_value`= ?
", $new_course_id, "$subject_id~$course_num");
$res = $this->db_query("UPDATE group_requirements
SET `course_id`='?'
WHERE `data_entry_value`= ?
", $new_course_id, "$subject_id~$course_num");
// Also update substitutions....
$res = $this->db_query("UPDATE student_substitutions
SET `sub_course_id`='?'
WHERE `sub_entry_value`= ?
", $new_course_id, "$subject_id~$course_num");
$res = $this->db_query("UPDATE student_substitutions
SET `required_course_id`='?'
WHERE `required_entry_value`= ?
", $new_course_id, "$subject_id~$course_num");
// Also the advising histories....
$res = $this->db_query("UPDATE advised_courses
SET `course_id`='?'
WHERE `entry_value`= ?
", $new_course_id, "$subject_id~$course_num");
}