Browse Source

Fixed bug with upgrade form Chado v1.2 to v1.3. Fixed bug displaying publications"

Stephen Ficklin 8 years ago
parent
commit
8710ad6eaf

+ 1 - 1
tripal_chado/api/tripal_chado.schema.api.inc

@@ -659,4 +659,4 @@ function chado_get_cvterm_mapping($params) {
     $result->cvterm = $cvterm;
   }
   return $result;
-}
+}

+ 29 - 0
tripal_chado/includes/TripalFields/schema__publication/schema__publication_formatter.inc

@@ -20,6 +20,35 @@ class schema__publication_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
+    $list_items = array();
+    $chado_table = $this->instance['settings']['chado_table'];
+    foreach ($items as $delta => $item) {
+      
+      $title = $item['value']['Title'];
+      $citation = $item['value']['Citation'];
+      $entity = array_key_exists('entity', $item['value']) ? $item['value']['entity'] : '';
+      if ($entity) {
+        list($entity_type, $entity_id) = explode(':', $entity);
+        $new_title = l($title, 'bio_data/' . $entity_id); 
+        $citation = preg_replace("/$title/", $new_title, $citation);
+      }
+      $list_items[] = $citation;
+    }
 
+    krsort($list_items, SORT_NUMERIC);
+
+    $list = array(
+      'title' => '',
+      'items' => $list_items,
+      'type' => 'ol',
+      'attributes' => array(),
+    );
+
+    if (count($items) > 0) {
+      $element[0] = array(
+        '#type' => 'markup',
+        '#markup' => theme_item_list($list),
+      );
+    }
   }
 }

+ 1 - 0
tripal_chado/includes/tripal_chado.fields.inc

@@ -556,6 +556,7 @@ function tripal_chado_bundle_create_instances($entity_type, $bundle) {
     'chado_type_column' => $chado_bundle->type_column,
   );
 
+  $info = array();
   tripal_chado_bundle_create_instances_base($info, $entity_type, $bundle, $details);
   tripal_chado_bundle_create_instances_custom($info, $entity_type, $bundle, $details);
   tripal_chado_bundle_create_instances_linker($info, $entity_type, $bundle, $details);

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

@@ -400,7 +400,7 @@ function tripal_chado_upgrade_chado_1_2_to_1_3_pre_alter() {
   foreach ($new_tables as $table) {
 
     // Get the schema for this table.
-    $function = 'tripal_chado_schema_v1_3_' . $table;
+    $function = 'tripal_chado_chado_schema_v1_3_' . $table;
     $schema = $function();
 
     // If the table exists then fix the pkeys and fkeys.