diff --git a/app/models/domain.rb b/app/models/domain.rb index 655902e81..b58bdb7d8 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -755,7 +755,10 @@ class Domain < ApplicationRecord def as_csv_row [ name, - "#{registrant_name}, #{registrant_ident_info}", + registrant_info[0], + registrant_info[1], + registrant_info[2], + registrant_info[3], valid_to.to_formatted_s(:db), registrar, created_at.to_formatted_s(:db), @@ -774,15 +777,19 @@ class Domain < ApplicationRecord generator.to_pdf end - def registrant_name - return registrant.name if registrant + def registrant_info + if registrant + return [registrant.name, registrant.ident, registrant.ident_country_code, + registrant.ident_type] + end ver = Version::ContactVersion.where(item_id: registrant_id).last contact = Contact.all_versions_for([registrant_id], created_at).first contact = ObjectVersionsParser.new(ver).parse if contact.nil? && ver - contact.try(:name) || 'Deleted' + [contact.try(:name), contact.try(:ident), contact.try(:ident_country_code), + contact.try(:ident_type)] || ['Deleted'] end def registrant_ident_info @@ -791,8 +798,10 @@ class Domain < ApplicationRecord def self.csv_header [ - 'Domain', 'Registrant', 'Valid to', 'Registrar', 'Created at', - 'Statuses', 'Admin. contacts', 'Tech. contacts', 'Nameservers', 'Force delete date', 'Force delete data' + 'Domain', 'Registrant name', 'Registrant ident', 'Registrant ident country code', + 'Registrant ident type', 'Valid to', 'Registrar', 'Created at', + 'Statuses', 'Admin. contacts', 'Tech. contacts', 'Nameservers', 'Force delete date', + 'Force delete data' ] end diff --git a/app/models/version/domain_version.rb b/app/models/version/domain_version.rb index 7330ed126..6f246538c 100644 --- a/app/models/version/domain_version.rb +++ b/app/models/version/domain_version.rb @@ -11,7 +11,7 @@ class Version::DomainVersion < PaperTrail::Version [ domain.name, - domain.registrant_name, + domain.registrant_info[0], domain.registrar, event, created_at.to_formatted_s(:db), diff --git a/test/fixtures/files/domains.csv b/test/fixtures/files/domains.csv index 81c7d94ac..729934079 100644 --- a/test/fixtures/files/domains.csv +++ b/test/fixtures/files/domains.csv @@ -1,2 +1,2 @@ -Domain,Registrant,Valid to,Registrar,Created at,Statuses,Admin. contacts,Tech. contacts,Nameservers,Force delete date,Force delete data -metro.test,"Jack, 12345678 [US org]",2010-07-05 00:00:00,Good Names,2010-07-05 07:30:00,[],"[""Jack, jack-001, 12345678 [US org]""]","[""Jack, jack-001, 12345678 [US org]""]","[""ns1.bestnames.test""]",, +Domain,Registrant name,Registrant ident,Registrant ident country code,Registrant ident type,Valid to,Registrar,Created at,Statuses,Admin. contacts,Tech. contacts,Nameservers,Force delete date,Force delete data +metro.test,Jack,12345678,US,org,2010-07-05 00:00:00,Good Names,2010-07-05 07:30:00,[],"[""Jack, jack-001, 12345678 [US org]""]","[""Jack, jack-001, 12345678 [US org]""]","[""ns1.bestnames.test""]",,