changeset 552:258b68689b28 feature_36

Fixes Bugs #219 and #226.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 01 Aug 2011 20:26:21 +0100
parents 2df99e8d191e
children e25c069ab3b8
files vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb
diffstat 2 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Aug 01 18:08:33 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Mon Aug 01 20:26:21 2011 +0100
@@ -10,11 +10,17 @@
   end
   
   def identify_author(author)
-    if author.class == User      
+    if author.class == User
       author_info = {
         :name_on_paper => author.name,
-        :user_id => author.id
+        :email => author.mail,
+        :user_id => author.id, 
+        :institution  => ""
       }
+      
+      unless author.ssamr_user_detail.nil?
+        author_info[:institution] = author.ssamr_user_detail.institution_name
+      end
     
     else 
       if author.class == Author    
--- a/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb	Mon Aug 01 18:08:33 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb	Mon Aug 01 20:26:21 2011 +0100
@@ -25,23 +25,21 @@
           :user_id => self.id                    
         }
         
-        unless self.author.nil?
-          logger.error { "We've got author" }          
+        if self.author.nil?
+          logger.error { "NO AUTHOR HERE" }
+          info[:name_on_paper] = self.name
+          info[:email] = self.mail
+          if not self.ssamr_user_detail.nil?
+            info[:institution]  = self.ssamr_user_detail.institution_name
+          end
+        else
+          logger.error { "-----> We've got an author associated with the user." }          
           info[:name_on_paper] = self.author.name            
 
           if self.author.authorships.length > 0
             info[:email] = self.author.authorships.first.email
             info[:institution] = self.author.authorships.first.institution
           end
-
-        else
-          logger.error { "No author" }
-          
-          info[:name_on_paper] = "No Name"
-          info[:email] = self.mail
-          if not self.ssamr_user_detail.nil?
-            info[:institution]  = self.ssamr_user_detail.institution_name
-          end
         end
         
         return info