function _DatabaseHandler::update_course_requirement_from_name

4.x _DatabaseHandler.php _DatabaseHandler::update_course_requirement_from_name($subject_id, $course_num, $new_course_id)
5.x _DatabaseHandler.php _DatabaseHandler::update_course_requirement_from_name($subject_id, $course_num, $new_course_id)

File

classes/_DatabaseHandler.php, line 653

Class

_DatabaseHandler

Code

function update_course_requirement_from_name($subject_id, $course_num, $new_course_id) 
 {
  // 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);




}