Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-06-10 14:31:53 +03:00
commit 65f519113a
4 changed files with 19 additions and 12 deletions

View file

@ -230,7 +230,7 @@ module Depp
def extension_xml
xml = { _anonymus: [] }
ident = ident_xml[:_anonymus].try(:first)
ident = ident_xml[:_anonymus].try(:first) if !persisted?
legal = legal_document_xml[:_anonymus].try(:first)
xml[:_anonymus] << ident if ident.present?
xml[:_anonymus] << legal if legal.present?

View file

@ -148,40 +148,41 @@ class Domain < ActiveRecord::Base
end
def start_expire_period
logger.info "#{Time.zone.now.utc} - Expiring domains\n"
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
d = Domain.where('valid_to <= ?', Time.zone.now)
d.each do |x|
x.domain_statuses.create(value: DomainStatus::EXPIRED) if x.expirable?
end
logger.info "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n"
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
end
def start_redemption_grace_period
logger.info "#{Time.zone.now.utc} - Setting server_hold to domains\n"
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
d = Domain.where('outzone_at <= ?', Time.zone.now)
d.each do |x|
x.domain_statuses.create(value: DomainStatus::SERVER_HOLD) if x.server_holdable?
end
logger.info "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n"
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
end
def start_delete_period
logger.info "#{Time.zone.now.utc} - Setting delete_candidate to domains\n"
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
d = Domain.where('delete_at <= ?', Time.zone.now)
d.each do |x|
x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable?
end
logger.info "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n"
return if Rails.env.test?
STDOUT << "#{Time.zone.now.utc} - Successfully set delete_candidate to #{d.count} domains\n"
end
def destroy_delete_candidates
logger.info "#{Time.zone.now.utc} - Destroying domains\n"
STDOUT << "#{Time.zone.now.utc} - Destroying domains\n" unless Rails.env.test?
c = 0
DomainStatus.where(value: DomainStatus::DELETE_CANDIDATE).each do |x|
@ -189,7 +190,7 @@ class Domain < ActiveRecord::Base
c += 1
end
logger.info "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n"
STDOUT << "#{Time.zone.now.utc} - Successfully destroyed #{c} domains\n" unless Rails.env.test?
end
end

View file

@ -7,20 +7,20 @@
= f.label :ident_country_code, t(:country) + '*'
.col-md-7
= f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {},
class: 'js-ident-country-code', required: true)
class: 'js-ident-country-code', required: true, disabled: @contact.persisted?)
.form-group
.col-md-3.control-label
= f.label :ident_type, t(:type) + '*'
.col-md-7
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type },
class: 'js-ident-type', required: true)
class: 'js-ident-type', required: true, disabled: @contact.persisted?)
.form-group
.col-md-3.control-label
= f.label :ident, t(:ident) + '*'
.col-md-7
= f.text_field :ident, class: 'form-control', required: true
= f.text_field :ident, class: 'form-control', required: true, disabled: @contact.persisted?
- tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none'
.js-ident-tip{ style: tip_visibility }
= t(:birthday_format)

View file

@ -0,0 +1,6 @@
class AddOutzoneAtAndDeleteAtToDomain < ActiveRecord::Migration
def change
add_column :domains, :outzone_at, :datetime unless column_exists?(:domains, :outzone_at)
add_column :domains, :delete_at, :datetime unless column_exists?(:domains, :delete_at)
end
end