Browse Source

Bug Fixes: Chado Node API Properies now handles blank definition of cvterm better; feature and stock node forms skip core validation in ajax and non-save situations

Lacey Sanderson 10 years ago
parent
commit
9b10cab444

+ 6 - 1
tripal_core/api/tripal_core.chado_nodes.properties.api.inc

@@ -482,8 +482,13 @@ function chado_add_node_form_properties(&$form, &$form_state, $details) {
 
       $form['properties']['property_table'][$property->type_id][$property->rank]['type'] = array(
         '#type' => 'markup',
-        '#markup' => $property->type_name . '<br><i>' . $property->definition . '</i>'
+        '#markup' => $property->type_name
       );
+      // If a definition is available we want to add that to the type column
+      // to make it easier for users to determine what an added property means.
+      if (isset($property->definition)) {
+        $form['properties']['property_table'][$property->type_id][$property->rank]['type']['#markup'] = $property->type_name . '<br><i>' . $property->definition . '</i>';
+      }
 
       $form['properties']['property_table'][$property->type_id][$property->rank]['value'] = array(
         '#type' => 'markup',

+ 1 - 1
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -264,7 +264,7 @@ function chado_feature_validate($node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if($node->op != 'Save') {
+  if(!isset($node->op) OR $node->op != 'Save') {
     return;
   }
 

+ 4 - 4
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -145,13 +145,13 @@ function chado_stock_form($node, $form_state) {
 
   // 2) if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
-  if (array_key_exists('values', $form_state)) {
+  if (array_key_exists('values', $form_state) AND isset($form_state['values']['uniquename'])) {
     $sname = $form_state['values']['sname'];
     $uniquename = $form_state['values']['uniquename'];
     $stock_id = $form_state['values']['stock_id'];
     $type_id = $form_state['values']['type_id'];
     $organism_id = $form_state['values']['organism_id'];
-    $sdescription = $form_state['values']['description'];
+    $sdescription = $form_state['values']['stock_description'];
     $dbxref_accession = $form_state['values']['accession'];
     $dbxref_description = $form_state['values']['db_description'];
     $dbxref_database = $form_state['values']['database'];
@@ -165,7 +165,7 @@ function chado_stock_form($node, $form_state) {
     $stock_id = $form_state['input']['stock_id'];
     $type_id = $form_state['input']['type_id'];
     $organism_id = $form_state['input']['organism_id'];
-    $sdescription = $form_state['input']['description'];
+    $sdescription = $form_state['input']['stock_description'];
     $dbxref_accession = $form_state['input']['accession'];
     $dbxref_description = $form_state['input']['db_description'];
     $dbxref_database = $form_state['input']['database'];
@@ -323,7 +323,7 @@ function chado_stock_validate(&$node, $form, &$form_state) {
   // Since this validate can be called on AJAX and Deletion of the node
   // we need to make this check to ensure queries are not executed
   // without the proper values.
-  if($node->op != 'Save') {
+  if(!isset($node->op) OR $node->op != 'Save') {
     return;
   }