diff --git a/app/models/hgv_trans_identifier.rb b/app/models/hgv_trans_identifier.rb index 17d521c2e..6fc27b96a 100644 --- a/app/models/hgv_trans_identifier.rb +++ b/app/models/hgv_trans_identifier.rb @@ -53,7 +53,7 @@ def xml_title_text # - *Returns* : # - new translation identifier def self.new_from_template(publication) - if self.related_text.nil? + if publication.related_text.nil? raise 'No related text to create translation from—this error may occur because the only text associated with this publication is a reprint stub.' return nil end @@ -66,7 +66,7 @@ def self.new_from_template(publication) # Returns the 'last' DDB Text identifier that is not a reprint in this tranlsations publication def related_text - self.publication.identifiers.select{|i| (i.class == DDBIdentifier) && !i.is_reprinted?}.last + self.publication.related_text end # Place any actions you always want to perform on translation identifier content prior to it being committed in this method diff --git a/app/models/publication.rb b/app/models/publication.rb index 9be2b97c8..43f6ac36a 100644 --- a/app/models/publication.rb +++ b/app/models/publication.rb @@ -1523,6 +1523,10 @@ def creatable_identifiers return creatable_identifiers end + def related_text + self.identifiers.select{|i| (i.class == DDBIdentifier) && !i.is_reprinted?}.last + end + protected #Returns title string in form acceptable to ".git/refs/" def title_to_ref(str)