Browse Source

Fixed bug where rank column is hard coded in property insert function. This isn't the case for analysisprop in chado v1.11

spficklin 12 năm trước cách đây
mục cha
commit
c77fdfc07f
1 tập tin đã thay đổi với 11 bổ sung7 xóa
  1. 11 7
      tripal_core/api/tripal_core.api.inc

+ 11 - 7
tripal_core/api/tripal_core.api.inc

@@ -2375,17 +2375,21 @@ $cv_name, $value, $update_if_present = 0) {
 
   // construct the array of values to be inserted
   $values = array(
-  $fkcol => $record_id,
+    $fkcol => $record_id,
     'type_id' => array(
       'cv_id' => array(
         'name' => $cv_name,
-  ),
+      ),
       'name' => $property,
       'is_obsolete' => 0
-  ),
-    'value' => $value,
-    'rank' => $rank,
+     ),
+    'value' => $value,   
   );
+  
+  // some chado prop tables (e.g. analysisprop) was missing the rank field, so we need to check for it
+  if (array_key_exists('rank', $table_desc['fields'])) {
+    $values['rank'] = $rank;
+  }
 
   return tripal_core_chado_insert($basetable . 'prop', $values);
 }
@@ -2444,9 +2448,9 @@ function tripal_core_update_property($basetable, $record_id, $property,
     'type_id' => array(
       'cv_id' => array(
         'name' => $cv_name,
-  ),
+       ),
       'name' => $property,
-  ),
+    ),
   );
 
   // construct the array of values to be updated