Lacey Sanderson 9 年 前
コミット
cee9402ff6

+ 1 - 1
tripal_core/api/tripal_core.chado_query.api.inc

@@ -1520,7 +1520,7 @@ function chado_query($sql, $args = array()) {
     // tables with featureloc must automaticaly have the chado schema set as
     // active to find.
     if (preg_match('/'.$chado_schema_name.'.featureloc/i', $sql) or preg_match('/'.$chado_schema_name.'.feature/i', $sql)) {
-      $previous_db = chado_set_active('chado') ;
+      $previous_db = chado_set_active('chado');
       $results = db_query($sql, $args);
       chado_set_active($previous_db);
     }

+ 1 - 1
tripal_core/includes/tripal_core.chado_install.inc

@@ -376,7 +376,7 @@ function tripal_core_install_sql($sql_file) {
 
   // determine the schema name.
   $chado_schema = tripal_get_schema_name('chado');
-  $chado_dot = $schado_schema . '.';
+  $chado_dot = $chado_schema . '.';
 
   if ($chado_local) {
     db_query("set search_path to $chado_schema");

+ 6 - 1
tripal_core/includes/tripal_core.search.inc

@@ -338,7 +338,12 @@ function tripal_core_get_token_value_for_property($base_table, $field_name, $for
  * to catch new node types right after they're created.
  */
 function tripal_core_modules_enabled($modules) {
-  tripal_search_update_default_index();
+  if (module_exists('search_api')) {
+    $index_enabled = db_query('SELECT enabled FROM search_api_index WHERE machine_name=:name', array(':name' => 'default_node_index'))->fetchField();
+    if ($index_enabled) {
+      tripal_search_update_default_index();
+    }
+  }
 }
 
 /**

+ 10 - 4
tripal_cv/api/tripal_cv.api.inc

@@ -566,6 +566,15 @@ function tripal_insert_cvterm($term, $options = array()) {
     $values = array('dbxref_id' => $cvterm->dbxref_id);
     $result = chado_select_record('dbxref', array('*'), $values);
     $dbxref = $result[0];
+    if (!$dbxref) {
+      tripal_report_error(
+        'tripal_cv',
+        TRIPAL_ERROR,
+        'Unable to access the dbxref record for the :term cvterm. Term Record: !record',
+        array(':term' => $name, '!record' => print_r($cvterm, TRUE))
+      );
+      return FALSE;
+    }
 
     // Get the db.
     $values = array('db_id' => $dbxref->db_id);
@@ -657,10 +666,7 @@ function tripal_insert_cvterm($term, $options = array()) {
     // We can now perform and updated if we need to.
   }
 
-  // Get the CVterm record.  If it doesn't exist then create it.
-  $result = chado_query($cvtermsql, array(':accession' => $dbxref->accession, ':dbname' => $dbname, ':term' => $name, ':cvname' => $cvname));
-  $cvterm = $result->fetchObject();
-  if (!$cvterm) {
+  if (!$result) {
 
     // check to see if the dbxref exists if not, add it.
     $dbxref =  tripal_insert_dbxref(array(

+ 1 - 1
tripal_cv/tripal_cv.module

@@ -154,7 +154,7 @@ function tripal_cv_menu() {
     'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/chado/tripal_cv/cvterm/auto_name/%/%'] = array(
-    'page callback' => 'tripal_cv_cvterm_name_autocomplete',
+    'page callback' => 'tripal_autocomplete_cvterm',
     'page arguments' => array(6, 7),
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_CALLBACK,