function tripal_feature_delete_form_validate

2.x tripal_feature.delete.inc tripal_feature_delete_form_validate($form, &$form_state)
3.x tripal_feature.delete.inc tripal_feature_delete_form_validate($form, &$form_state)
1.x tripal_feature-delete.inc tripal_feature_delete_form_validate($form, &$form_state)

File

tripal_feature/includes/tripal_feature-delete.inc, line 72
@todo Add file header description

Code

function tripal_feature_delete_form_validate($form, &$form_state) {
  $organism_id = $form_state['values']['organism_id'];
  $seq_type = trim($form_state['values']['seq_type']);
  $analysis_id = $form_state['values']['analysis_id'];
  $is_unique = $form_state['values']['is_unique'];
  $feature_names = $form_state['values']['feature_names'];

  if (!$organism_id and !$anaysis_id and !$seq_type and !$feature_names) {
    form_set_error('feature_names', t("Please select at least one option"));
  }

  // check to make sure the types exists
  if ($seq_type) {
    $cvtermsql = "SELECT CVT.cvterm_id
                  FROM {cvterm} CVT
                     INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id
                     LEFT JOIN {cvtermsynonym} CVTS on CVTS.cvterm_id = CVT.cvterm_id
                  WHERE cv.name = '%s' and (CVT.name = '%s' or CVTS.synonym = '%s')";
    $cvterm = db_fetch_object(chado_query($cvtermsql, 'sequence', $seq_type, $seq_type));
    if (!$cvterm) {
      form_set_error('seq_type', t("The Sequence Ontology (SO) term selected for the sequence type is not available in the database. Please check spelling or select another."));
    }
  }
}