Browse Source

Fix for issue #647

Stephen Ficklin 6 years ago
parent
commit
e8a4ab3a7a

+ 2 - 4
tripal_chado/api/modules/tripal_chado.cv.api.inc

@@ -417,13 +417,12 @@ function chado_update_cvtermpath($cv_id, $job = NULL) {
   
   // TODO: there's a function to determine the current Chado instance.
   // we should use that.
-  $prev_db = chado_set_active('chado');
   $transaction = db_transaction();
   
   try {
     
     // Get the is_a term. The OBO importer adds this for evey vocabulary.
-    $sql = "SELECT * FROM cvterm WHERE name = :is_a and cv_id = :cv_id";
+    $sql = "SELECT * FROM {cvterm} WHERE name = :is_a and cv_id = :cv_id";
     $args = [':is_a' => 'is_a', ':cv_id' => $cv_id];
     $cache['$is_a'] = chado_query($sql, $args)->fetchObject();
     
@@ -484,8 +483,7 @@ function chado_update_cvtermpath($cv_id, $job = NULL) {
     }
   }
   catch (Exception $e) {
-    $transaction->rollback();
-    chado_set_active($prev_db);
+    $transaction->rollback();    
     throw $e;
   }
 }

+ 4 - 1
tripal_chado/includes/tripal_chado.bundle.inc

@@ -64,7 +64,7 @@ function tripal_chado_bundle_create($bundle, $storage_args) {
       throw new Exception('Cannot create content type. Problem associating type with Chado.');
     }
   }
-
+  
   tripal_chado_create_bundle_table($bundle);
 }
 
@@ -114,6 +114,9 @@ function tripal_chado_create_bundle_table($bundle) {
     ),
   );
   $chado_entity_table = chado_get_bundle_entity_table($bundle);
+  if (!$chado_entity_table) {
+    throw new Exception('Cannot create entity linker table for chado.');
+  }
   db_create_table($chado_entity_table, $schema);
 }
 

+ 2 - 7
tripal_chado/includes/tripal_chado.install.inc

@@ -85,7 +85,7 @@ function tripal_chado_load_form($form, $form_state) {
   );
 
   $form['action_to_do'] = array(
-    '#type' => 'radios',
+    '#type' => 'select',
     '#title' => 'Installation/Upgrade Action',
     '#options' => array(
       'Install Chado v1.3' => t('New Install of Chado v1.3 (erases all existing Chado data if Chado already exists)'),
@@ -94,7 +94,7 @@ function tripal_chado_load_form($form, $form_state) {
       'Upgrade Chado v1.11 to v1.2' => t('Upgrade existing Chado v1.11 to v1.2 (no data is lost)'),
       'Install Chado v1.11' => t('New Install of Chado v1.11 (erases all existing Chado data if Chado already exists)'),
     ),
-    '#description' => t('Select an action to perform. If you want to install Chado all other Tripal modules must not be installed.'),
+    '#description' => t('Select an action to perform.'),
     '#required' => TRUE,
     '#ajax' => array(
       'callback' => "tripal_chado_load_form_ajax_callback",
@@ -104,11 +104,6 @@ function tripal_chado_load_form($form, $form_state) {
     ),
   );
 
-  $form['warning'] = array(
-    '#markup' => "<div><font color=\"red\">WARNING:</font>" . t('A new install of
-      Chado will remove and recreate the Chado database if it already exists.') . '</div>',
-  );
-
   $form['button'] = array(
     '#type' => 'submit',
     '#value' => t('Install/Upgrade Chado'),