Browse Source

Small bug fix to featuremap module (tried to integrate map table when it should've been featuremap). Also added checks to the Tripal Views API so an empty integration doesn't get added.

Lacey Sanderson 12 years ago
parent
commit
4a75742316

+ 3 - 3
tripal_featuremap/tripal_featuremap.views.inc

@@ -32,11 +32,11 @@ function tripal_featuremap_views_data()  {
 
   if (module_exists('tripal_views')) {
     $tables = array(
-      'map'
+      'featuremap'
     );
     foreach ($tables as $tablename) {
       $priority = 9;
-      
+
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
@@ -64,7 +64,7 @@ function tripal_featuremap_views_data()  {
       'mapprop'
     );
     foreach ($tables as $tablename) {
-      $priority = 9;     
+      $priority = 9;
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 13 - 1
tripal_views/api/tripal_views.api.inc

@@ -155,6 +155,12 @@ function tripal_views_is_lightest_priority_setup($setup_id, $table_name) {
 function tripal_views_integration_add_entry($defn_array) {
   $no_errors = TRUE;
 
+  if (empty($defn_array['table'])) {
+    watchdog('tripal_views','Recieved integration with no tablename: %defn', array('%defn' => print_r($defn_array,TRUE)), WATCHDOG_WARNING);
+    $no_errors = FALSE;
+    return $no_errors;
+  }
+
   // First insert into tripal_views
   $view_record = array(
     'table_name' => $defn_array['table'],
@@ -420,7 +426,7 @@ function tripal_views_integrate_all_chado_tables() {
 
   $tables = tripal_core_get_chado_tables(TRUE);
   foreach ($tables as $tablename) {
-  
+
     $priority = 10;
     if (!tripal_views_is_integrated($tablename, $priority)) {
       $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
@@ -570,6 +576,12 @@ function tripal_views_add_node_relationship_to_chado_table_integration($defn_arr
   $primary_key = $defn_array['table'] . '_id';
   $chado_linking = 'chado_' . $defn_array['table'];
 
+  if (empty($defn_array['table'])) {
+    watchdog('tripal_views','Tried to add a node=>chado relationship for an empty table defn: %defn',
+      array('%defn' => print_r($defn_array,TRUE)),WATCHDOG_WARNING);
+    return FALSE;
+  }
+
   // Add table.primary_key => chado_table.primary key join to $defn_array
   $integrations[$defn_array['table']]['fields'][$primary_key]['joins'][$chado_linking] = array(
     'table' => $chado_linking,