function admin_copy_degree_form_validate
Search API
7.x admin.degrees.inc | admin_copy_degree_form_validate($form, $form_state) |
6.x admin.degrees.inc | admin_copy_degree_form_validate($form, $form_state) |
5.x admin.degrees.inc | admin_copy_degree_form_validate($form, $form_state) |
Validate handler. Make sure our allow_overwrite setting is working. Check for existing major code.
File
- modules/
admin/ admin.degrees.inc, line 224
Code
function admin_copy_degree_form_validate($form, $form_state) {
$values = $form_state ["values"];
if ($values ["allow_overwrite"] == "no") {
// Check to see if destination major code already exists.
$de_catalog_year = $values ["de_catalog_year"];
$destination_major_code = trim(strtoupper($values ["destination_major_code"]));
// First thing's first. Make sure the sourceMajorCode exists.
$res = db_query("SELECT * FROM draft_degrees
WHERE major_code = ?
AND catalog_year = ? ", $destination_major_code, $de_catalog_year);
if (db_num_rows($res) != 0) {
// Meaning, it WAS be found.
form_error("destination_major_code", t("The destination major, %dest, was found for %year. Since you selected not to overwrite
existing majors, your submission was not processed. Please try again.", array("%dest" => $destination_major_code, "%year" => $de_catalog_year)));
return;
}
}
}