summaryrefslogtreecommitdiff
path: root/app/models/phone.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 21:03:48 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 21:03:48 +0100
commitf04aa92778dca7f71ca656235885095b13dd3535 (patch)
treeb0ac9cf3dfecbbdb0209c1204054adcac861f001 /app/models/phone.rb
parentf3c3e77eaa2b82567f02601b6f66177208674181 (diff)
parent508871c01cbf02bf6d8d7056c2d5a70e4d67eebf (diff)
Merge branch 'develop'5.0.2
Diffstat (limited to 'app/models/phone.rb')
-rw-r--r--app/models/phone.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/phone.rb b/app/models/phone.rb
index 1f3c497..a606834 100644
--- a/app/models/phone.rb
+++ b/app/models/phone.rb
@@ -20,6 +20,7 @@ class Phone < ActiveRecord::Base
# Validations
#
before_validation :sanitize_mac_address
+ before_validation :destroy_fallback_sip_account_if_not_hot_deskable
validates_presence_of :mac_address
validate_mac_address :mac_address
@@ -227,5 +228,11 @@ class Phone < ActiveRecord::Base
self.last_ip_address = nil
end
end
+
+ def destroy_fallback_sip_account_if_not_hot_deskable
+ if !self.hot_deskable?
+ self.fallback_sip_account_id = nil
+ end
+ end
end