Added missing CID for custom code

This commit is contained in:
Priit Tark 2015-05-04 14:41:27 +03:00
parent 6bded6bc80
commit 60d564d098
4 changed files with 29 additions and 20 deletions

View file

@ -55,10 +55,11 @@ class Epp::Contact < Contact
# add prefix when needed
if custom_code.present?
prefix, custom = custom_code.split(':')
if prefix != registrar.code && custom != registrar.code
custom_code = "#{registrar.code}:#{custom_code}"
cid, rcode, custom = custom_code.split(':')
if "#{cid}:#{rcode}" != registrar.contact_prefix
custom_code = "#{registrar.contact_prefix}:#{custom_code}"
end
custom_code = nil if custom_code == registrar.contact_prefix
end
super(

View file

@ -140,4 +140,8 @@ class Registrar < ActiveRecord::Base
def code=(code)
self[:code] = code.gsub(/[ :]/, '').upcase if new_record? && code.present?
end
def contact_prefix
"CID:#{code}"
end
end