summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2012-12-31 08:50:27 +0100
committerspag <spag@golwen.net>2012-12-31 08:50:27 +0100
commitaed84444142604a62e37e57acfaaf957219e2c8d (patch)
treee00b1f5844590393171e0bc839ab516d39f5144d /app/models
parentc24bd3a8212e85894b2f7c26e190fe5e89fbaaf2 (diff)
parent12c8f4c82770ded6ea6b519e4451ed6757419ddf (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app/models')
-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