diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 21:03:48 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 21:03:48 +0100 |
commit | f04aa92778dca7f71ca656235885095b13dd3535 (patch) | |
tree | b0ac9cf3dfecbbdb0209c1204054adcac861f001 /app/controllers/phones_controller.rb | |
parent | f3c3e77eaa2b82567f02601b6f66177208674181 (diff) | |
parent | 508871c01cbf02bf6d8d7056c2d5a70e4d67eebf (diff) |
Merge branch 'develop'5.0.2
Diffstat (limited to 'app/controllers/phones_controller.rb')
-rw-r--r-- | app/controllers/phones_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index f1dcd3e..2698465 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -13,9 +13,9 @@ class PhonesController < ApplicationController end def new - set_fallback_sip_accounts - @phone = @phoneable.phones.build() + + set_fallback_sip_accounts # Use the last phone.phone_model as the default. # @@ -80,6 +80,9 @@ class PhonesController < ApplicationController def set_fallback_sip_accounts used_sip_account_ids = Phone.where(:fallback_sip_account_id => SipAccount.pluck(:id)).pluck(:fallback_sip_account_id) @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant').where(:hotdeskable => true) - SipAccount.where(:id => used_sip_account_ids) + if @phone && !@phone.fallback_sip_account_id.blank? && SipAccount.exists?(@phone.fallback_sip_account_id) + @fallback_sip_accounts << SipAccount.where(:id => @phone.fallback_sip_account_id).first + end end end |