Story #104525314 - feature reject combination of delete with deleteProhibited

This commit is contained in:
Matt Farnsworth 2015-11-06 11:09:37 +02:00
parent c40a282a63
commit 95bf081b53

View file

@ -116,6 +116,11 @@ class Domain < ActiveRecord::Base
validate :status_is_consistant
def status_is_consistant
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
unless has_error
if (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_DELETE, DomainStatus::FORCE_DELETE]).any?
has_error = statuses.include? DomainStatus::SERVER_DELETE_PROHIBITED
end
end
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
end