go_import 3.0.18 → 3.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/go_import/model/deal.rb +1 -1
- data/sources/easy/.go_import/runner.rb +2 -1
- data/sources/salesforce/.go_import/readme.txt +1 -1
- data/sources/salesforce/.go_import/runner.rb +226 -40
- data/sources/salesforce/Gemfile +1 -0
- data/sources/salesforce/Gemfile.lock +2 -1
- data/sources/salesforce/converter.rb +38 -167
- data/sources/salesforce/export/readme.txt +3 -0
- metadata +17 -4
- data/sources/salesforce/data/contacts.csv +0 -4
- data/sources/salesforce/go.zip +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmYyYzMzZmIyY2Y3MzdjYzQwNzBlMWU0M2Y3NmEyM2QzNWVmZDlmNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODY1OGUxMzM0MGJjMTE5MDgzYmQ4OGVjNWUxODU3YjgxODU2OTI4Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODEwYjk5MTY3ODFlMjQxNmY5YTgwZjUyYzE1Mzk4ZjhiN2U0ZGNjZTc5MmY5
|
10
|
+
ZGMzMjgxNWM2YmY2NmMwMDc5NTYzN2E2MmQ2YjMxYTU1YjBhZWMwODgxNWEw
|
11
|
+
MGIwNmMzNGU4MmZiYTNlYjNmNzMwNTBhMGYzNTdkZjc4ZmIyZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmE4MThjNmI1MTJiNWI4YzgwYWM0NzA3MmRmMTQwMTliNGQ5MDE4NjQ4ZGJk
|
14
|
+
ZjUxZDllOWQ2MGY3MDFiYjUwMjQzZDJhNDJkNWU3YzgwZTE5ZGM1OWVlZjIz
|
15
|
+
YmFiYTc5ZmFkZDlkZDAxODMxODY3MDUyYjM3ZjgzNjAwOWZjZWU=
|
data/lib/go_import/model/deal.rb
CHANGED
@@ -96,6 +96,7 @@ end
|
|
96
96
|
|
97
97
|
def to_coworker(row)
|
98
98
|
coworker = GoImport::Coworker.new
|
99
|
+
|
99
100
|
# integration_id is typically the userId in Easy
|
100
101
|
# Must be set to be able to import the same file more
|
101
102
|
# than once without creating duplicates
|
@@ -177,7 +178,7 @@ def to_organization_note(converter, row, rootmodel)
|
|
177
178
|
note.classification = GoImport::NoteClassification::Comment
|
178
179
|
note.text = "#{row['Category']}: #{row['History']}"
|
179
180
|
end
|
180
|
-
|
181
|
+
|
181
182
|
return note.text.empty? ? nil : note
|
182
183
|
end
|
183
184
|
|
@@ -1 +1 @@
|
|
1
|
-
This source converts a
|
1
|
+
This source converts a full export from SalesForce to LIME Go.
|
@@ -1,72 +1,258 @@
|
|
1
1
|
|
2
|
+
require 'zip'
|
3
|
+
|
2
4
|
require 'go_import'
|
3
5
|
require_relative("../converter")
|
4
6
|
|
5
|
-
#
|
7
|
+
# EXPORT_FOLDER and other constants should be defined ../converter.rb
|
8
|
+
|
9
|
+
USER_FILE = "User.csv"
|
10
|
+
ORGANIZATION_FILE = "Account.csv"
|
11
|
+
PERSON_FILE = "Contact.csv"
|
12
|
+
DEAL_FILE = "Opportunity.csv"
|
13
|
+
NOTE_FILE = "Note.csv"
|
6
14
|
|
7
|
-
def process_rows(
|
8
|
-
|
15
|
+
def process_rows(filename)
|
16
|
+
if !File.exists?(filename)
|
17
|
+
puts "Error: Cant find the file '#{filename}'."
|
18
|
+
raise
|
19
|
+
end
|
20
|
+
|
21
|
+
f = File.open(filename, 'r')
|
22
|
+
data = f.read.encode("UTF-8", "ISO-8859-1")
|
9
23
|
rows = GoImport::CsvHelper::text_to_hashes(data)
|
10
24
|
rows.each do |row|
|
11
25
|
yield row
|
12
26
|
end
|
27
|
+
f.close
|
13
28
|
end
|
14
29
|
|
15
|
-
def
|
16
|
-
|
30
|
+
def get_salesforce_export_zipfile()
|
31
|
+
if defined?(EXPORT_FOLDER)
|
32
|
+
if EXPORT_FOLDER.nil? || EXPORT_FOLDER.empty?
|
33
|
+
puts "EXPORT_FOLDER is empty, using 'export' as default."
|
34
|
+
export_folder = File.expand_path("export", Dir.pwd)
|
35
|
+
else
|
36
|
+
export_folder = File.expand_path(EXPORT_FOLDER, Dir.pwd)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
puts "EXPORT_FOLDER is not defined, using 'export' as default."
|
40
|
+
export_folder = File.expand_path("export", Dir.pwd)
|
41
|
+
end
|
17
42
|
|
18
|
-
|
43
|
+
puts "Searching '#{export_folder}' for Salesforce export zip file..."
|
19
44
|
|
20
|
-
|
21
|
-
|
22
|
-
|
45
|
+
if defined?(EXPORT_FILE)
|
46
|
+
if EXPORT_FILE.nil? || EXPORT_FILE.empty?
|
47
|
+
export_zip_files = Dir.glob(File.join(export_folder, "*.zip"))
|
48
|
+
else
|
49
|
+
export_zip_files = Dir.glob(File.join(export_folder, EXPORT_FILE))
|
50
|
+
end
|
51
|
+
else
|
52
|
+
export_zip_files = Dir.glob(File.join(export_folder, "*.zip"))
|
53
|
+
end
|
23
54
|
|
24
|
-
if
|
25
|
-
|
55
|
+
if export_zip_files.length == 0
|
56
|
+
puts "No zip file found, please copy your Salesforce export zipfile to '#{export_folder}'."
|
57
|
+
return nil
|
58
|
+
elsif export_zip_files.length > 1
|
59
|
+
puts "More than one zip file found in '#{export_folder}', either remove all but one or set the EXPORT_FILE in converter.rb"
|
60
|
+
return nil
|
61
|
+
elsif export_zip_files.length == 1
|
62
|
+
puts "Found zipfile to import from. Using: '#{export_zip_files[0]}'."
|
63
|
+
return export_zip_files[0]
|
26
64
|
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def to_coworker(row)
|
68
|
+
coworker = nil
|
69
|
+
|
70
|
+
if row['IsActive'] == '1' && row['UserType'] == 'Standard'
|
71
|
+
coworker = GoImport::Coworker.new
|
27
72
|
|
28
|
-
|
29
|
-
|
30
|
-
|
73
|
+
coworker.id = row['Email']
|
74
|
+
coworker.integration_id = row['Id']
|
75
|
+
coworker.first_name = row['FirstName']
|
76
|
+
coworker.last_name = row['LastName']
|
77
|
+
coworker.direct_phone_number = row['Phone']
|
78
|
+
coworker.mobile_phone_number = row['MobilePhone']
|
31
79
|
end
|
80
|
+
|
81
|
+
return coworker
|
82
|
+
end
|
32
83
|
|
33
|
-
|
84
|
+
def to_organization(row, rootmodel)
|
85
|
+
if row['IsDeleted'] != '0'
|
86
|
+
return nil
|
87
|
+
end
|
88
|
+
|
89
|
+
organization = GoImport::Organization.new
|
90
|
+
|
91
|
+
organization.integration_id = row['Id']
|
92
|
+
organization.name = row['Name']
|
93
|
+
organization.set_tag(row['Type'])
|
94
|
+
|
95
|
+
organization.central_phone_number = row['Phone']
|
96
|
+
organization.web_site = row['Website']
|
34
97
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
rootmodel.add_coworker(converter.to_coworker(row))
|
41
|
-
end
|
98
|
+
organization.with_postal_address do |address|
|
99
|
+
address.street = row['BillingStreet']
|
100
|
+
address.zip_code = row['BillingPostalCode']
|
101
|
+
address.city = row['BillingCity']
|
102
|
+
address.country_code = row['BillingCountry']
|
42
103
|
end
|
43
104
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
105
|
+
organization.with_visit_address do |address|
|
106
|
+
address.street = row['ShippingStreet']
|
107
|
+
address.zip_code = row['ShippingPostalCode']
|
108
|
+
address.city = row['ShippingCity']
|
109
|
+
address.country_code = row['ShippingCountry']
|
50
110
|
end
|
51
111
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
112
|
+
organization.responsible_coworker =
|
113
|
+
rootmodel.find_coworker_by_integration_id(row['OwnerId'])
|
114
|
+
|
115
|
+
return organization
|
116
|
+
end
|
117
|
+
|
118
|
+
def add_person_to_organization(row, rootmodel)
|
119
|
+
if row['IsDeleted'] == 0
|
120
|
+
org = rootmodel.find_organization_by_integration_id(row['AccountId'])
|
121
|
+
|
122
|
+
if !org.nil?
|
123
|
+
person = GoImport::Person.new
|
124
|
+
add_employee(person)
|
125
|
+
|
126
|
+
person.integration_id = row['Id']
|
127
|
+
person.first_name = row['FirstName']
|
128
|
+
person.last_name = row['LastName']
|
129
|
+
|
130
|
+
person.direct_phone_number = row['Phone']
|
131
|
+
person.fax_phone_number = row['Fax']
|
132
|
+
person.mobile_phone_number = row['MobilePhone']
|
133
|
+
person.home_phone_number = row['HomePhone']
|
134
|
+
person.position = row['Title']
|
135
|
+
person.email = row['Email']
|
58
136
|
end
|
59
137
|
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def to_deal(row, rootmodel, converter)
|
141
|
+
if row['IsDeleted'] != '0'
|
142
|
+
return nil
|
143
|
+
end
|
144
|
+
|
145
|
+
deal = GoImport::Deal.new
|
146
|
+
|
147
|
+
deal.integration_id = row['Id']
|
148
|
+
deal.customer = rootmodel.find_organization_by_integration_id(row['AccountId'])
|
149
|
+
deal.responsible_coworker = rootmodel.find_coworker_by_integration_id(row['OwnerId'])
|
150
|
+
deal.customer_contact =
|
151
|
+
rootmodel.find_person_by_integration_id(row['PrimaryPartnerAccountId'])
|
152
|
+
deal.name = row['Name']
|
153
|
+
deal.description = row['Description']
|
154
|
+
deal.value = row['Amount']
|
155
|
+
deal.probability = row['Probability']
|
156
|
+
|
157
|
+
deal.set_tag row['Type']
|
158
|
+
|
159
|
+
if converter.respond_to?(:get_deal_status_from_salesforce_stage)
|
160
|
+
status = converter.get_deal_status_from_salesforce_stage(row['StageName'])
|
60
161
|
|
61
|
-
|
62
|
-
|
63
|
-
# and persons (contact)
|
64
|
-
if defined?(DEAL_FILE) && !DEAL_FILE.nil? && !DEAL_FILE.empty?
|
65
|
-
process_rows DEAL_FILE do |row|
|
66
|
-
rootmodel.add_deal(converter.to_deal(row, rootmodel))
|
162
|
+
if !status.nil?
|
163
|
+
deal.status = status
|
67
164
|
end
|
68
165
|
end
|
166
|
+
|
167
|
+
return deal
|
168
|
+
end
|
169
|
+
|
170
|
+
def to_note(row, rootmodel)
|
171
|
+
if row['IsDeleted'] != '0'
|
172
|
+
return nil
|
173
|
+
end
|
174
|
+
|
175
|
+
note = GoImport::Note.new
|
176
|
+
|
177
|
+
note.integration_id = row['Id']
|
178
|
+
note.text = row['Title'] + ' ' + row['Body']
|
179
|
+
|
180
|
+
note.date = row['CreatedDate']
|
181
|
+
|
182
|
+
note.created_by = rootmodel.find_coworker_by_integration_id(row['CreatedById'])
|
183
|
+
note.organization = rootmodel.find_organization_by_integration_id(row['AccountId'])
|
184
|
+
|
185
|
+
# TODO: we should probably set the classification in the same was
|
186
|
+
# a a deal's status is set.
|
187
|
+
|
188
|
+
return note
|
189
|
+
end
|
190
|
+
|
191
|
+
def convert_source
|
192
|
+
puts "Trying to convert Superoffice to LIME Go..."
|
193
|
+
|
194
|
+
converter = Converter.new
|
195
|
+
|
196
|
+
salesforce_export_zipfile = get_salesforce_export_zipfile()
|
197
|
+
|
198
|
+
if salesforce_export_zipfile.nil? then
|
199
|
+
puts "Could find Salesforce export zip file."
|
200
|
+
raise
|
201
|
+
end
|
69
202
|
|
203
|
+
rootmodel = GoImport::RootModel.new
|
204
|
+
converter.configure(rootmodel)
|
205
|
+
|
206
|
+
# We know have the Salesforce export zip file in
|
207
|
+
# export_zip_files[0]. We should unzip the file to a temp folder
|
208
|
+
# and return the path.
|
209
|
+
working_folder = Dir.mktmpdir("go-import")
|
210
|
+
puts "upzip '#{salesforce_export_zipfile}' to '#{working_folder.to_s}'..."
|
211
|
+
|
212
|
+
Dir.chdir(working_folder) do
|
213
|
+
Zip::File.open(salesforce_export_zipfile) do |zip_file|
|
214
|
+
zip_file.each do |entry|
|
215
|
+
if entry.to_s.include?("/") then
|
216
|
+
# puts "DIR"
|
217
|
+
else
|
218
|
+
entry.extract
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
#puts 'sleep a while'
|
224
|
+
#sleep 5
|
225
|
+
|
226
|
+
puts "Trying to import users..."
|
227
|
+
process_rows(USER_FILE) do |row|
|
228
|
+
rootmodel.add_coworker(to_coworker(row))
|
229
|
+
end
|
230
|
+
|
231
|
+
puts "Trying to import organizations..."
|
232
|
+
process_rows(ORGANIZATION_FILE) do |row|
|
233
|
+
rootmodel.add_organization(to_organization(row, rootmodel))
|
234
|
+
end
|
235
|
+
|
236
|
+
puts "Trying to import persons..."
|
237
|
+
process_rows(PERSON_FILE) do |row|
|
238
|
+
add_person_to_organization(row, rootmodel)
|
239
|
+
end
|
240
|
+
|
241
|
+
puts "Trying to import deals..."
|
242
|
+
process_rows(DEAL_FILE) do |row|
|
243
|
+
rootmodel.add_deal(to_deal(row, rootmodel, converter))
|
244
|
+
end
|
245
|
+
|
246
|
+
puts "Trying to import notes..."
|
247
|
+
process_rows(NOTE_FILE) do |row|
|
248
|
+
rootmodel.add_note(to_note(row, rootmodel))
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
puts "Trying to remove '#{working_folder}'."
|
253
|
+
FileUtils.rm_rf(working_folder)
|
254
|
+
|
70
255
|
return rootmodel
|
256
|
+
|
71
257
|
end
|
72
258
|
|
data/sources/salesforce/Gemfile
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
|
2
1
|
require 'go_import'
|
3
2
|
|
4
|
-
# This converter will convert
|
5
|
-
#
|
3
|
+
# This converter will convert a full export from Salesforce to LIME
|
4
|
+
# Go. Export data according to
|
5
|
+
# https://help.salesforce.com/apex/HTViewHelpDoc?id=admin_exportdata.htm
|
6
|
+
|
7
|
+
# You need to customize this script to suit your Salesforce export.
|
6
8
|
|
7
|
-
# You
|
9
|
+
# You should save the zipfile from Salesforce in the
|
10
|
+
# EXPORT_FOLDER. You dont have to unzip the file, just put it in the folder.
|
11
|
+
EXPORT_FOLDER = "export"
|
8
12
|
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
DATA_FOLDER = "data"
|
13
|
+
# If you put more than one zip in the folder you must name the file
|
14
|
+
# you want to import to LIME GO.
|
15
|
+
# EXPORT_FILE = ""
|
13
16
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#PERSON_FILE = "data/persons.csv"
|
17
|
-
#DEAL_FILE = "data/deals.csv"
|
17
|
+
# go-import will NOT use any unzipped files from the EXPORT_FOLDER. It
|
18
|
+
# will instead extract the zipfile to a temporary folder.
|
18
19
|
|
19
|
-
# Ie if you dont want to import deals, set DEAL_FILE = ""
|
20
20
|
|
21
21
|
# If you are importing files then you must set the FILES_FOLDER
|
22
22
|
# constant. FILES_FOLDER should point to the folder where the files
|
@@ -41,164 +41,35 @@ class Converter
|
|
41
41
|
# added to organization, deal and person. Valid types are
|
42
42
|
# :String and :Link. If no type is specified :String is used
|
43
43
|
# as default.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Turns a row from the organization csv file into a
|
58
|
-
# GoImport::Organization.
|
59
|
-
# Use rootmodel to locate other related stuff such coworker
|
60
|
-
def to_organization(row, rootmodel)
|
61
|
-
organization = GoImport::Organization.new
|
62
|
-
|
63
|
-
puts "Trying to create org '#{row}'"
|
64
|
-
|
65
|
-
return organization
|
66
|
-
|
67
|
-
|
68
|
-
# Integrationid is typically the id in the system that
|
69
|
-
# we are getting the csv from. Must be set to be able
|
70
|
-
# to import the same file more than once without
|
71
|
-
# creating duplicates
|
72
|
-
organization.integration_id = row['id']
|
73
|
-
organization.name = row['name']
|
74
|
-
|
75
|
-
# Just setting all basic properties to show whats available
|
76
|
-
# Remove or fix...
|
77
|
-
organization.organization_number = 'a number' # needs clean up, should have helpers for that in lib. Swedish format.
|
78
|
-
organization.email = 'email to organizaiton, not the person'
|
79
|
-
organization.web_site = 'www.whatever.com'
|
80
|
-
organization.central_phone_number = '0000' # needs clean up, should have helpers for that in lib. Default swedish format, convert to global format
|
81
|
-
|
82
|
-
# Addresses consists of several parts in Go.
|
83
|
-
# Lots of other systems have the address all in one
|
84
|
-
# line, to be able to match when importing it is
|
85
|
-
# way better to split the addresses
|
86
|
-
organization.with_visit_address do |address|
|
87
|
-
address.street = 'visit street'
|
88
|
-
address.zip_code = 'visit zip'
|
89
|
-
address.city = 'visit city'
|
90
|
-
end
|
91
|
-
|
92
|
-
# Another example of setting address using
|
93
|
-
# helper to split '226 48 LUND' into zip and city
|
94
|
-
organization.with_postal_address do |address|
|
95
|
-
address.street = 'postal street'
|
96
|
-
address.parse_zip_and_address_se '226 48 LUND'
|
44
|
+
# rootmodel.settings.with_organization do |organization|
|
45
|
+
# organization.set_custom_field( { :integrationid => 'external_url', :title => 'Link to external system', :type => :Link } )
|
46
|
+
# end
|
47
|
+
|
48
|
+
rootmodel.settings.with_deal do |deal|
|
49
|
+
deal.add_status({:label => "1. Kvalificering", :integration_id => "qualification"})
|
50
|
+
deal.add_status({:label => "Vunnen", :integration_id => "won",
|
51
|
+
:assessment => GoImport::DealState::PositiveEndState })
|
52
|
+
deal.add_status({:label => "Lost", :integration_id => "Lost",
|
53
|
+
:assessment => GoImport::DealState::NegativeEndState })
|
97
54
|
end
|
98
|
-
|
99
|
-
# Responsible coworker is set by first locating
|
100
|
-
# it in the root model and then setting a reference
|
101
|
-
# to him/her
|
102
|
-
# We need to be able handle missing coworkers here
|
103
|
-
coworker = rootmodel.find_coworker_by_integration_id row['responsible_id']
|
104
|
-
organization.responsible_coworker = coworker.to_reference
|
105
|
-
|
106
|
-
# Set tags for the organization. All organizations will get
|
107
|
-
# the tag "import" automagically
|
108
|
-
organization.set_tag("Guldkund")
|
109
|
-
|
110
|
-
# When imported from web based ERP or similair that
|
111
|
-
# client will continue to use it can be useful to be
|
112
|
-
# able to link from Go to the same record in the ERP
|
113
|
-
# FOr instance Lime links
|
114
|
-
organization.set_custom_value("external_url", "http://something.com?key=#{row['id']}")
|
115
|
-
|
116
|
-
return organization
|
117
|
-
end
|
118
|
-
|
119
|
-
# Turns a row from the coworker csv file into a GoImport::Coworker.
|
120
|
-
def to_coworker(row)
|
121
|
-
coworker = GoImport::Coworker.new
|
122
|
-
coworker.integration_id = row['id']
|
123
|
-
coworker.first_name = row['first_name']
|
124
|
-
coworker.last_name = row['last_name']
|
125
|
-
|
126
|
-
# Other optional attributes
|
127
|
-
coworker.email = 't@e.com'
|
128
|
-
coworker.direct_phone_number = '+46121212'
|
129
|
-
coworker.mobile_phone_number = '+46324234'
|
130
|
-
coworker.home_phone_number = '+46234234'
|
131
|
-
|
132
|
-
# Tags and custom fields are set the same
|
133
|
-
# way as on organizations
|
134
|
-
|
135
|
-
return coworker
|
136
55
|
end
|
137
56
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
person.fax_phone_number = '+4623234234234'
|
153
|
-
person.mobile_phone_number = '+462321212'
|
154
|
-
person.email = 'x@y.com'
|
155
|
-
person.alternative_email = 'y@x.com'
|
156
|
-
person.with_postal_address do |address|
|
157
|
-
address.street = 'postal street'
|
158
|
-
address.parse_zip_and_address_se '226 48 LUND'
|
57
|
+
def get_deal_status_from_salesforce_stage(salesforce_deal_stage)
|
58
|
+
# When deals are added to LIME Go this method is called for
|
59
|
+
# each deal. The deal's stage from Salesforce is supplied as
|
60
|
+
# an argument and this method should return a status for the
|
61
|
+
# deal in LIME Go. The returned value is probably an
|
62
|
+
# integration_id of a deal status that has been added in the
|
63
|
+
# configure(rootmodel) method.
|
64
|
+
deal_status = nil
|
65
|
+
|
66
|
+
case salesforce_deal_stage
|
67
|
+
when 'Prospecting'
|
68
|
+
deal_status = '1. Kvalificering'
|
69
|
+
when 'Closed Won'
|
70
|
+
deal_status = 'Vunnen'
|
159
71
|
end
|
160
72
|
|
161
|
-
|
162
|
-
# way as on organizations
|
163
|
-
|
164
|
-
# set employer connection
|
165
|
-
employer_id = row['employer_id']
|
166
|
-
employer = rootmodel.find_organization_by_integration_id employer_id
|
167
|
-
employer.add_employee person
|
168
|
-
end
|
169
|
-
|
170
|
-
# Turns a row form the deal csv file into a GoImport::Deal. Use
|
171
|
-
# the rootmodel to find objects that should be linked to the new
|
172
|
-
# deal.
|
173
|
-
def to_deal(row, rootmodel)
|
174
|
-
deal = GoImport::Deal.new
|
175
|
-
deal.integration_id = row['id']
|
176
|
-
deal.name = row['name']
|
177
|
-
# should be integer, same currency should be used in
|
178
|
-
# the system
|
179
|
-
deal.value = row['value']
|
180
|
-
|
181
|
-
# find stuff connected to deal
|
182
|
-
responsible = rootmodel.find_coworker_by_integration_id row['responsible_id']
|
183
|
-
organization = rootmodel.find_organization_by_integration_id row['customer_id']
|
184
|
-
person = organization.find_employee_by_integration_id row['customer_contact_id']
|
185
|
-
# connect the deal by references
|
186
|
-
deal.responsible_coworker = responsible.to_reference
|
187
|
-
deal.customer = organization.to_reference
|
188
|
-
deal.customer_contact = person.to_reference
|
189
|
-
|
190
|
-
# other optional attributes
|
191
|
-
deal.probability = 50 # should be between 0 - 100
|
192
|
-
deal.order_date = '2014-01-05' # Format ?
|
193
|
-
|
194
|
-
# status, set this by either label, id or integration_id (use
|
195
|
-
# appropriate method to find status)
|
196
|
-
deal.status = rootmodel.settings.deal.find_status_by_label row['status']
|
197
|
-
|
198
|
-
# or set by existing status, search by label, integration_id
|
199
|
-
# (if string) or id (if integer).
|
200
|
-
# deal.status = "Won"
|
201
|
-
|
202
|
-
return deal
|
73
|
+
return deal_status
|
203
74
|
end
|
204
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oskar Gewalli
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: iso_country_codes
|
@@ -97,6 +97,20 @@ dependencies:
|
|
97
97
|
- - ! '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: rubyzip
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
type: :runtime
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
100
114
|
- !ruby/object:Gem::Dependency
|
101
115
|
name: nokogiri
|
102
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,10 +245,9 @@ files:
|
|
231
245
|
- sources/salesforce/.go_import/readme.txt
|
232
246
|
- sources/salesforce/.go_import/runner.rb
|
233
247
|
- sources/salesforce/converter.rb
|
234
|
-
- sources/salesforce/
|
248
|
+
- sources/salesforce/export/readme.txt
|
235
249
|
- sources/salesforce/Gemfile
|
236
250
|
- sources/salesforce/Gemfile.lock
|
237
|
-
- sources/salesforce/go.zip
|
238
251
|
- sources/VISMA/.gitignore
|
239
252
|
- sources/VISMA/.go_import/readme.txt
|
240
253
|
- sources/VISMA/.go_import/runner.rb
|
@@ -1,4 +0,0 @@
|
|
1
|
-
FirstName,LastName,Title,ReportsTo.Email,Birthdate,Description
|
2
|
-
Tom,Jones,Senior Director,buyer@salesforcesample.com,1940-06-07Z,"Self-described as ""the top"" branding guru on the West Coast"
|
3
|
-
Ian,Dury,Chief Imagineer,cto@salesforcesample.com,,"World-renowned expert in fuzzy logic design.
|
4
|
-
Influential in technology purchases."
|
data/sources/salesforce/go.zip
DELETED
Binary file
|