summaryrefslogtreecommitdiff
path: root/lib/tasks/csv_user_import.rake
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
commiteb0e1cc5c26275ff3e5c341404e8bc558f8312b8 (patch)
tree71f449ccd6f15422717de3ac24f87d5e888ddd79 /lib/tasks/csv_user_import.rake
parentdf6e17e48995f25e72509986f30700d778b179b6 (diff)
parent3b27a5d45b12f6bac65da2a8e17387bfda42a2f1 (diff)
Merge branch 'develop'
Diffstat (limited to 'lib/tasks/csv_user_import.rake')
-rw-r--r--lib/tasks/csv_user_import.rake14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/tasks/csv_user_import.rake b/lib/tasks/csv_user_import.rake
index 81959d5..e65bc1f 100644
--- a/lib/tasks/csv_user_import.rake
+++ b/lib/tasks/csv_user_import.rake
@@ -129,6 +129,16 @@ namespace :user_import do
end
if user
+ # Create voicemail account
+ voicemail_account = user.voicemail_accounts.first
+ if !voicemail_account
+ if VoicemailAccount.where(:name => "user_#{user.user_name}").count == 0
+ voicemail_account = user.voicemail_accounts.create(:name => "user_#{user.user_name}", :active => true )
+ else
+ voicemail_account = user.voicemail_accounts.create(:active => true)
+ end
+ end
+
# Find or create a sip_accounts
['VoipNr1', 'VoipNr2', 'VoipNr3'].each_with_index do |phone_number_type, index|
@@ -141,6 +151,9 @@ namespace :user_import do
if !phone_number_type.blank? && !csv_user[phone_number_type].blank?
sip_account = user.sip_accounts.where(:auth_name => auth_name).first
if sip_account
+ if sip_account.voicemail_account != voicemail_account
+ sip_account.update_attributes(:voicemail_account_id => voicemail_account.id)
+ end
if sip_account.caller_name.to_s != user.to_s
sip_account.update_attributes(:caller_name => user.to_s)
end
@@ -154,6 +167,7 @@ namespace :user_import do
:hotdeskable => true,
:callforward_rules_act_per_sip_account => true,
:gs_node_id => gs_node_id,
+ :voicemail_account_id => voicemail_account.id,
)
end