This commit is contained in:
Martin Lensment 2015-06-10 13:10:26 +03:00
parent d9aaab1e92
commit cd1f04f155
3 changed files with 34 additions and 7 deletions

View file

@ -427,21 +427,16 @@ class Epp::Domain < Domain
### RENEW ###
def renew(cur_exp_date, period, unit = 'y')
# TODO: Check how much time before domain exp date can it be renewed
validate_exp_dates(cur_exp_date)
if Setting.days_to_renew_domain_before_expire != 0
if (valid_to - Time.zone.now).to_i / 1.day >= Setting.days_to_renew_domain_before_expire
add_epp_error('2105', nil, nil, I18n.t('object_is_not_eligible_for_renewal'))
end
end
add_epp_error('2105', nil, nil, I18n.t('object_is_not_eligible_for_renewal')) unless renewable?
return false if errors.any?
p = self.class.convert_period_to_time(period, unit)
self.valid_to = valid_to + p
self.period = period
self.period_unit = unit
save
end