فهرست منبع

Fixed bug in importing some publication years with PubMed and also error when loading pub

spficklin 12 سال پیش
والد
کامیت
3d594a8509
2فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 1 0
      tripal_pub/includes/importers/PMID.inc
  2. 5 3
      tripal_pub/tripal_pub.module

+ 1 - 0
tripal_pub/includes/importers/PMID.inc

@@ -723,6 +723,7 @@ function tripal_pub_PMID_parse_date ($xml, $element_name) {
         case 'MedlineDate':
           // the medline date is when the date cannot be broken into distinct month day year.
           $xml->read(); 
+          $date['year'] = preg_replace('/^(\d{4}).*$/', '\1', $xml->value);
           $date['medline'] = $xml->value;          
           break;
         default:

+ 5 - 3
tripal_pub/tripal_pub.module

@@ -642,9 +642,11 @@ function chado_pub_load($node) {
   
   // expand the 'text' fields as those aren't included by default
   // and they really shouldn't be so large to cause problems
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.volumetitle');  
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.uniquename');;
+  if (is_array($pub)) {
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.volumetitle');  
+    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.uniquename');;
+  }
   
   // set the URL path
   $path = "pub/$pub_id";