mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
115040781-legal_doc_check_and_save
This commit is contained in:
parent
431eaf5439
commit
4e51adb08e
1 changed files with 13 additions and 3 deletions
|
@ -335,9 +335,19 @@ class Contact < ActiveRecord::Base
|
||||||
errors.add(:domains, :exist)
|
errors.add(:domains, :exist)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if doc = Epp::Contact.attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
|
|
||||||
frame.css("legalDocument").first.content = doc.path if doc && doc.persisted?
|
legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame)
|
||||||
self.legal_document_id = doc.id
|
|
||||||
|
if legal_document_data
|
||||||
|
|
||||||
|
doc = LegalDocument.create(
|
||||||
|
documentable_type: Contact,
|
||||||
|
document_type: legal_document_data[:type],
|
||||||
|
body: legal_document_data[:body]
|
||||||
|
)
|
||||||
|
self.legal_documents = [doc]
|
||||||
|
self.legal_document_id = doc.id
|
||||||
|
self.save
|
||||||
end
|
end
|
||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue