mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Merge branch '111864739-history_legal_doc' into staging
This commit is contained in:
commit
9cb7a2e39c
2 changed files with 12 additions and 3 deletions
|
@ -17,6 +17,8 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
|
before_save :catch_legal_doc_id
|
||||||
|
|
||||||
validates :name, :phone, :email, :ident, :ident_type,
|
validates :name, :phone, :email, :ident, :ident_type,
|
||||||
:street, :city, :zip, :country_code, :registrar, presence: true
|
:street, :city, :zip, :country_code, :registrar, presence: true
|
||||||
|
|
||||||
|
@ -515,4 +517,13 @@ class Contact < ActiveRecord::Base
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def catch_legal_doc_id
|
||||||
|
|
||||||
|
if !legal_document_id && doc = self.legal_documents.last.new_record?
|
||||||
|
|
||||||
|
legal_document_id = doc.id
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,9 +38,7 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
legal_frame = f.css('legalDocument').first
|
legal_frame = f.css('legalDocument').first
|
||||||
if legal_frame.present?
|
if legal_frame.present?
|
||||||
doc = legal_document_attrs(legal_frame)
|
at[:legal_documents_attributes] = 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