浏览代码

Merge pull request #459 from tripal/438-tv3-pub_xml_fix

Publication Importer fix Tv3
Bradford Condon 6 年之前
父节点
当前提交
44ba26f4bd

+ 0 - 1
tripal/includes/TripalEntityUIController.inc

@@ -316,7 +316,6 @@ function tripal_view_entity($entity, $view_mode = 'full') {
        $query->propertyCondition('status', 0);
      }
    }
-   //$query->propertyOrderBy('created', 'DESC');
 
    // Find out the total number of records and determine what page we're on, and
    // initialize the pager.

+ 6 - 6
tripal_chado/includes/TripalFields/schema__additional_type/schema__additional_type_widget.inc

@@ -19,8 +19,8 @@ class schema__additional_type_widget extends ChadoFieldWidget {
     $field_type = $this->field['type'];
     $field_table = $this->instance['settings']['chado_table'];
     $field_column = $this->instance['settings']['chado_column'];
-    $vocabulary = $this->instance['settings']['vocabulary'];
-    $parent_term = $this->instance['settings']['parent_term'];
+    $enforce_vocabulary = $this->instance['settings']['vocabulary'];
+    $enforce_parent_term = $this->instance['settings']['parent_term'];
     
     $linker_field = 'chado-' . $field_table . '__' . $field_column;
 
@@ -44,8 +44,8 @@ class schema__additional_type_widget extends ChadoFieldWidget {
     // If a parent_term is provided then use that to get the options
     $options = array();
     $options[] = 'Select a type';
-    if ($parent_term) {
-      list ($vocabulary, $accession) = explode(':', $parent_term);
+    if ($enforce_parent_term) {
+      list ($vocabulary, $accession) = explode(':', $enforce_parent_term);
       if ($vocabulary and $accession) {
         $sql = "
           SELECT
@@ -69,8 +69,8 @@ class schema__additional_type_widget extends ChadoFieldWidget {
         }
       }
     }
-    elseif ($vocabulary) {
-      $cv = chado_get_cv(array('name' => $vocabulary));
+    elseif ($enforce_vocabulary) {
+      $cv = chado_get_cv(array('name' => $enforce_vocabulary));
       $options = chado_get_cvterm_select_options($cv->cv_id);
     }
     // If no vocabulary or parent term are provided then just give a generic

+ 5 - 7
tripal_chado/includes/loaders/tripal_chado.pub_importer_PMID.inc

@@ -356,7 +356,7 @@ function tripal_pub_PMID_parse_pubxml($pub_xml) {
   if (!$pub_xml) {
     return $pub;
   }
-
+  
   // read the XML and iterate through it.
   $xml = new XMLReader();
   $xml->xml(trim($pub_xml));
@@ -512,9 +512,7 @@ function tripal_pub_PMID_parse_article($xml, &$pub) {
           tripal_pub_PMID_parse_journal($xml, $pub);
           break;
         case 'ArticleTitle':
-          $xml->read();
-          // remoave any trailing period from the title
-          $pub['Title'] = trim(preg_replace('/\.$/', '', $xml->value));
+          $pub['Title'] = $xml->readString();
           break;
         case 'Abstract':
           tripal_pub_PMID_parse_abstract($xml, $pub);
@@ -675,14 +673,14 @@ function tripal_pub_PMID_parse_abstract($xml, &$pub) {
       switch ($element) {
         case 'AbstractText':
           $label = $xml->getAttribute('Label');
-          $xml->read();
+          $value = $xml->readString();
           if ($label) {
-            $part = "<p><b>$label</b></br>" . $xml->value . '</p>';
+            $part = "<p><b>$label</b></br>" . $value . '</p>';
             $abstract .= $part;
             $pub['Structured Abstract Part'][] = $part;
           }
           else {
-            $abstract .= '<p>' . $xml->value . '</p>';
+            $abstract .= "<p>" . $value . "</p>";
           }
           break;
         case 'CopyrightInformation':