# HG changeset patch # User luisf # Date 1312226781 -3600 # Node ID 258b68689b286723f01b7f2de1c067b278d061ce # Parent 2df99e8d191eebed54e2cdf6822bf17a0832c73c Fixes Bugs #219 and #226. diff -r 2df99e8d191e -r 258b68689b28 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- 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 diff -r 2df99e8d191e -r 258b68689b28 vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb --- 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