function z__schools_admin_copy_degree_form_validate

7.x schools.module z__schools_admin_copy_degree_form_validate($form, &$form_state)
6.x schools.module z__schools_admin_copy_degree_form_validate($form, &$form_state)

File

modules/schools/schools.module, line 1114
Schools module.

Code

function z__schools_admin_copy_degree_form_validate($form, &$form_state) {
  $values = $form_state ['values'];

  $source_major_code = $values ['source_major_code'];
  $school_id = $values ['schools_school'];
  $form_state ['values']['school_id'] = intval($school_id);

  // Make sure that this major code exists for this school.
  $res = db_query("SELECT * FROM draft_degrees WHERE major_code = ? AND school_id = ?", array($source_major_code, $school_id));
  $cur = db_fetch_array($res);
  if (!$cur) {
    form_error("source_major_code", t("Sorry, but the source major code could not be found for the selected school.  Please verify the school that the source degree belongs to."));
    form_error("schools_school", "");
  }

}