diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-28 20:27:04 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-28 20:27:04 +0100 |
commit | f3c3e77eaa2b82567f02601b6f66177208674181 (patch) | |
tree | 1946390f7f697e80fcdab4164ad620d507b6a1fe /app/controllers/config_siemens_controller.rb | |
parent | 3e76142566ad8f55a64a88fe5c19e7d0ec7c11c0 (diff) | |
parent | 8d20201910b1915cffa495e6474d50f9c8e8331d (diff) |
Merge branch 'develop'5.0.1
Diffstat (limited to 'app/controllers/config_siemens_controller.rb')
-rw-r--r-- | app/controllers/config_siemens_controller.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb index f398b1a..c09dfcf 100644 --- a/app/controllers/config_siemens_controller.rb +++ b/app/controllers/config_siemens_controller.rb @@ -80,6 +80,7 @@ class ConfigSiemensController < ApplicationController @phone.mac_address = mac_address @phone.hot_deskable = true @phone.phone_model = PhoneModel.where('name LIKE ?', "#{phone_type}").first + @phone.tenant = tenant if ! @phone.save render( :status => 500, @@ -128,16 +129,13 @@ class ConfigSiemensController < ApplicationController return end - phone_sip_account = PhoneSipAccount.new() - phone_sip_account.phone_id = @phone.id - phone_sip_account.sip_account_id = @sip_account.id - - if ! phone_sip_account.save + @phone.fallback_sip_account = @sip_account + if ! @phone.save render( :status => 500, :layout => false, :content_type => 'text/plain', - :text => "<!-- #{phone_sip_account.errors.messages.inspect} -->", + :text => "<!-- #{@phone.errors.messages.inspect} -->", ) return end @@ -152,13 +150,17 @@ class ConfigSiemensController < ApplicationController @sip_account = @phone.sip_accounts.where(:sip_accountable_type => @phone.phoneable_type, :sip_accountable_id => @phone.phoneable_id).first + if !@sip_account + @sip_account = @phone.fallback_sip_account + end + + tenant = @phone.tenant + if @phone.phoneable if @phone.phoneable_type == 'Tenant' - tenant = @phone.phoneable language = tenant.language.code elsif @phone.phoneable_type == 'User' language = @phone.phoneable.language.code - tenant = @phone.phoneable.current_tenant end end |