Browse Source

Added update function for missing table

Stephen Ficklin 6 years ago
parent
commit
0819c4eb3c
2 changed files with 23 additions and 2 deletions
  1. 22 1
      tripal/tripal.install
  2. 1 1
      tripal/views_handlers/tripal_views_handler_field.inc

+ 22 - 1
tripal/tripal.install

@@ -163,6 +163,7 @@ function tripal_schema() {
   $schema['tripal_bundle'] = tripal_tripal_bundle_schema();
   $schema['tripal_import'] = tripal_tripal_import_schema();
   $schema['tripal_collection'] = tripal_tripal_collection_schema();
+  $schema['tripal_collection_bundle'] = tripal_tripal_collection_bundle_schema();
 
   // Adds a table for additional information related to bundles.
   $schema['tripal_bundle_variables'] = tripal_tripal_bundle_variables_schema();
@@ -1074,4 +1075,24 @@ function tripal_update_7309() {
     $error = $e->getMessage();
     throw new DrupalUpdateException('Could not add the tripal_collection table:' . $error);
   }
-}
+}
+
+/**
+ * Adds the missing tripal_collection_bundle table
+ * @throws DrupalUpdateException
+ */
+function tripal_update_7310() {
+  $transaction = db_transaction();
+  try {
+    if (!db_table_exists('tripal_collection_bundle')) {
+      $schema = array();
+      $schema['tripal_collection_bundle'] = tripal_tripal_collection_bundle_schema();
+      db_create_table('tripal_collection_bundle', $schema['tripal_collection_bundle']);
+    }
+  }
+  catch (\PDOException $e) {
+    $transaction->rollback();
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not add the tripal_collection_bundle table:' . $error);
+  }
+}

+ 1 - 1
tripal/views_handlers/tripal_views_handler_field.inc

@@ -82,7 +82,7 @@ class tripal_views_handler_field extends views_handler_field {
     $items = $this->get_value($values);
 
     // Handle single value fields:
-    if (count($items == 1)) {
+    if (count($items) == 1) {
       $function = $field['module'] . '_field_formatter_view';
       $value = $function('TripalEntity', $entity, $field, $instance, 'und', $items, $instance['display']['default']);
       return $value;