From 58bc4cc13b456b774418f06de7d68b40c85fd743 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Tue, 8 Dec 2015 10:40:52 +0200 Subject: [PATCH] Story#109623634 - contacts ident data can be changed if ident_cc is not set or birthday is in wrong format --- app/models/epp/contact.rb | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index ec5673b06..99f559041 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -160,20 +160,14 @@ class Epp::Contact < Contact self.ident_updated_at ||= Time.zone.now # not in use ident_frame = frame.css('ident').first - if ident_frame && ident_attr_valid?(ident_frame) && ident_country_code.blank? && ident_type.in?(%w(org priv).freeze) - at.merge!(ident_country_code: ident_frame.attr('cc')) + if ident_frame && ident_attr_valid?(ident_frame) + if ident_country_code.blank? && ident_type.in?(%w(org priv).freeze) + at.merge!(ident_country_code: ident_frame.attr('cc')) + end + if ident_type == "birthday" && ident !=~ /\d{4}-\d{2}-\d{2}/ + at.merge!(ident: ident_frame.text) + end end - - # Deprecated - # if ident_updated_at.present? - # throw :epp_error, { - # code: '2306', - # msg: I18n.t(:ident_update_error) - # } - # else - # at.merge!(self.class.ident_attrs(frame.css('ident').first)) - # self.ident_updated_at = Time.zone.now - # end end super(at)