Jelajahi Sumber

Fixed bug with emailing from pub importer

Stephen Ficklin 8 tahun lalu
induk
melakukan
d5c65cec3a

+ 11 - 11
tripal_pub/includes/importers/tripal_pub.PMID.inc

@@ -1,15 +1,15 @@
 <?php
 /**
  * @file
- * This file provides support for importing and parsing of results from the 
+ * This file provides support for importing and parsing of results from the
  * NCBI PubMed database.  The functions here are used by
  * both the publication importer setup form and the publication importer.
- * 
+ *
  */
 
 
 /**
- * A hook for altering the publication importer form.  It Changes the 
+ * A hook for altering the publication importer form.  It Changes the
  * 'Abstract' filter to be 'Abstract/Title'.
  *
  * @param $form
@@ -41,7 +41,7 @@ function tripal_pub_remote_alter_form_PMID($form, $form_state, $num_criteria = 1
  *   The Drupal form array
  * @param $form_state
  *   The form state array
- *  
+ *
  * @return
  *  The form (drupal form api)
  *
@@ -193,8 +193,8 @@ function tripal_pub_remote_search_PMID($search_array, $num_to_retrieve, $page) {
  *   The PubMed Search string
  * @param $retmax
  *   The maximum number of records to return
- *   
- * @return 
+ *
+ * @return
  *   An array containing the Count, WebEnv and QueryKey as return
  *   by PubMed's esearch utility
  *
@@ -270,7 +270,7 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
  * @param $web_env
  *   The esearch WebEnv
  * @param $rettype
- *   The efetch return type 
+ *   The efetch return type
  * @param $retmod
  *   The efetch return mode
  * @param $start
@@ -279,7 +279,7 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
  *   The number of publications to retrieve
  * @param $args
  *   Any additional arguments to add the efetch query URL
- *   
+ *
  * @return
  *  An array containing the total_records in the dataaset, the search string
  *  and an array of the publications that were retreived.
@@ -445,7 +445,7 @@ function tripal_pub_PMID_parse_pubxml($pub_xml) {
 
 /**
  * Parses the section from the XML returned from PubMed that contains
- * information about the Journal 
+ * information about the Journal
  *
  * @param $xml
  *   The XML to parse
@@ -612,7 +612,7 @@ function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
         case 'PublicationType':
           $xml->read();
           $value = $xml->value;
-          
+
           $identifiers = array(
             'name' => $value,
             'cv_id' => array(
@@ -631,7 +631,7 @@ function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
             );
             $pub_cvterm = tripal_get_cvterm($identifiers, $options);
             if (!$pub_cvterm) {
-              tripal_report_error('tripal_pubmed', TRIPAL_ERROR, 
+              tripal_report_error('tripal_pubmed', TRIPAL_ERROR,
                 'Cannot find a valid vocabulary term for the publication type: "%term".',
                 array('%term' => $value));
             }

+ 1 - 0
tripal_pub/includes/tripal_pub.pub_citation.inc

@@ -202,6 +202,7 @@ function tripal_pub_create_citation($pub) {
   else {
     $pub_type = $pub['Publication Type'];
   }
+
   //----------------------
   // Journal Article
   //----------------------

+ 9 - 8
tripal_pub/tripal_pub.module

@@ -31,6 +31,7 @@ require_once 'includes/importers/tripal_pub.AGL.inc';
  * @}
  */
 
+
 /**
  * Implements hook_menu().
  *
@@ -364,8 +365,8 @@ function tripal_pub_permission() {
  * @ingroup tripal_pub
  */
 function tripal_pub_mail($key, &$message, $params) {
+  $site_name = variable_get('site_name');
   $language = $message['language'];
-  $variables = user_mail_tokens($params['account'], $language);
   switch($key) {
     case 'import_report':
       $headers = array(
@@ -373,13 +374,13 @@ function tripal_pub_mail($key, &$message, $params) {
         'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
         'Content-Transfer-Encoding' => '8Bit',
         'X-Mailer' => 'Drupal'
-        );
-        foreach ($headers as $key => $value) {
-          $message['headers'][$key] = $value;
-        }
-        $message['subject'] = t('Publication import from !site', $variables, $language->language);
-        $message['body'][] = $params['message'];
-        break;
+      );
+      foreach ($headers as $key => $value) {
+        $message['headers'][$key] = $value;
+      }
+      $message['subject'] = t('Publication import from !site', array('!site' => $site_name));
+      $message['body'][] = $params['message'];
+      break;
   }
 }