Browse Source

Merge branch '7.x-3.x' of github.com:tripal/tripal into 7.x-3.x

Stephen Ficklin 8 years ago
parent
commit
96dd4568c1

+ 16 - 4
tripal_chado/includes/tripal_chado.migrate.inc

@@ -829,20 +829,32 @@ function tripal_chado_migrate_organism_images () {
   // Iterate through each organism entity
   while ($organism = $results->fetchObject()) {
     $nid = $organism->nid;
-    $eid = $organism->entity_id;
+    $entity_id = $organism->entity_id;
     
     // check if there is a file record for the organism node
     $fid = db_select('file_usage', 'fu')
-    ->field('fu', array('fid'))
+    ->fields('fu', array('fid'))
     ->condition('module', 'tripal_organism')
     ->condition('type', 'organism_image')
     ->condition('id', $nid)
     ->execute()
     ->fetchField();
-    
     // If there is an image, add it to the organism entity
     if ($fid) {
-      
+      $file = file_load($fid);
+      // Add a record to the file_usage table
+      file_usage_add($file, 'file', 'TripalEntity', $entity_id);
+      // Attached it to the entity
+      $entities = entity_load('TripalEntity', array($entity_id));
+      $entity = $entities[$entity_id];
+      $image_file = (array) $file;
+      $image = array(
+        'und' => array(
+          0 =>$image_file
+        )
+      );
+      $entity->data__image = $image;
+      field_attach_update('TripalEntity', $entity);
     }
   }
   

+ 1 - 1
tripal_chado/includes/tripal_chado.setup.inc

@@ -165,7 +165,7 @@ function tripal_chado_prepare_chado() {
     // add the featuremapprop table to Chado
     tripal_chado_add_featuremap_dbxref_table();
     tripal_chado_add_featuremapprop_table();
-    tripal_chado_add_featuremappos_table();
+    //tripal_chado_add_featuremappos_table();
 
     // Support for Libraries.
     // add the materialized view

+ 0 - 1
tripal_chado/tripal_chado.info

@@ -15,4 +15,3 @@ stylesheets[all][] = theme/css/tripal_chado.css
 dependencies[] = tripal
 dependencies[] = date
 dependencies[] = image
-dependencies[] = tripal_chado_views

+ 1 - 0
tripal_chado_views/tripal_chado_views.info

@@ -18,3 +18,4 @@ files[] = views/handlers/tripal_views_handler_field_aggregate.inc
 
 dependencies[] = views
 dependencies[] = tripal
+dependencies[] = tripal_chado