mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
111864739-legaldocs_for_contacts
This commit is contained in:
parent
7f9e1e0c9c
commit
f087a00bef
2 changed files with 13 additions and 2 deletions
|
@ -2,6 +2,7 @@ class Contact < ActiveRecord::Base
|
||||||
include Versions # version/contact_version.rb
|
include Versions # version/contact_version.rb
|
||||||
include EppErrors
|
include EppErrors
|
||||||
include UserEvents
|
include UserEvents
|
||||||
|
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
|
||||||
|
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
has_many :domain_contacts
|
has_many :domain_contacts
|
||||||
|
@ -9,6 +10,8 @@ class Contact < ActiveRecord::Base
|
||||||
has_many :legal_documents, as: :documentable
|
has_many :legal_documents, as: :documentable
|
||||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
|
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
|
||||||
|
|
||||||
|
attr_accessor :legal_document_id
|
||||||
|
|
||||||
# TODO: remove later
|
# TODO: remove later
|
||||||
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
|
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
|
||||||
|
|
||||||
|
@ -501,4 +504,10 @@ class Contact < ActiveRecord::Base
|
||||||
related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) }
|
related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def children_log
|
||||||
|
log = HashWithIndifferentAccess.new
|
||||||
|
log[:legal_documents]= [legal_document_id]
|
||||||
|
log
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,9 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
legal_frame = f.css('legalDocument').first
|
legal_frame = f.css('legalDocument').first
|
||||||
if legal_frame.present?
|
if legal_frame.present?
|
||||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
doc = legal_document_attrs(legal_frame)
|
||||||
|
self.legal_document_id = doc.id if doc.id
|
||||||
|
at[:legal_documents_attributes] = doc
|
||||||
end
|
end
|
||||||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||||
at
|
at
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue