From 1e5a5125878b61604eaa5050f8ed9a58209368e7 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 8 Apr 2015 15:14:28 +0200 Subject: [PATCH] Added EmailAddresses creation. --- contrib/auto_wizzard_example.json | 6 ++++++ lib/auto_wizzard.rb | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/contrib/auto_wizzard_example.json b/contrib/auto_wizzard_example.json index 0c990aa24..351e99c32 100644 --- a/contrib/auto_wizzard_example.json +++ b/contrib/auto_wizzard_example.json @@ -17,5 +17,11 @@ "name": "product_name", "value": "Zammad Demo System" } + ], + "EmailAddresses": [ + { + "realname": "Zammad Demo System", + "email": "zammad@localhost", + } ] } \ No newline at end of file diff --git a/lib/auto_wizzard.rb b/lib/auto_wizzard.rb index 2da922dd2..de699c21b 100644 --- a/lib/auto_wizzard.rb +++ b/lib/auto_wizzard.rb @@ -2,7 +2,7 @@ module AutoWizzard =begin -creates or updates Users and sets Settings based on the 'auto_wizzard.json' file placed in the root directory. +creates or updates Users, EmailAddresses and sets Settings based on the 'auto_wizzard.json' file placed in the root directory. there is an example file 'contrib/auto_wizzard_example.json' @@ -60,6 +60,26 @@ returns } end + # add EmailAddresses + if auto_wizzard_hash['EmailAddresses'] + + auto_wizzard_hash['EmailAddresses'].each { |email_address_data| + + email_address_data_symbolized = email_address_data.symbolize_keys + + email_address_data_symbolized = email_address_data_symbolized.merge( + { + :updated_by_id => 1, + :created_by_id => 1 + } + ) + + EmailAddress.create_if_not_exists( + email_address_data_symbolized + ) + } + end + true end end \ No newline at end of file