go_import 3.0.40 → 3.0.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/go-import +4 -4
- data/lib/go_import/model/organization.rb +8 -7
- data/lib/go_import/model/person.rb +3 -3
- data/lib/go_import/model/rootmodel.rb +176 -17
- data/lib/go_import/phone_helper.rb +1 -0
- data/lib/go_import/shard_helper.rb +8 -8
- data/sources/base-crm/.go_import/runner.rb +235 -0
- data/sources/base-crm/Gemfile +5 -0
- data/sources/base-crm/README.md +9 -0
- data/sources/base-crm/converter.rb +62 -0
- data/sources/base-crm/data/contacts.csv +13 -0
- data/sources/base-crm/data/coworkers.csv +3 -0
- data/sources/base-crm/data/deals.csv +5 -0
- data/sources/base-crm/data/leads.csv +4 -0
- data/sources/base-crm/data/notes.csv +6 -0
- data/sources/base-crm/data/tasks.csv +5 -0
- data/spec/helpers/phone_helper_spec.rb +22 -0
- data/spec/helpers/shard_helper_spec.rb +24 -4
- data/spec/person_spec.rb +3 -4
- data/spec/rootmodel_spec.rb +417 -10
- metadata +13 -2
@@ -0,0 +1,235 @@
|
|
1
|
+
require 'go_import'
|
2
|
+
require_relative("../converter")
|
3
|
+
|
4
|
+
REPORT_RESULT = true
|
5
|
+
COWORKER_FILE = "data/coworkers.csv"
|
6
|
+
ORGANIZATION_FILE = "data/contacts.csv"
|
7
|
+
LEADS_FILE = "data/leads.csv"
|
8
|
+
PERSON_FILE = "data/contacts.csv"
|
9
|
+
DEAL_FILE = "data/deals.csv"
|
10
|
+
NOTE_FILE = "data/notes.csv"
|
11
|
+
SOURCE_ENCODING = "utf-8"
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
def process_rows(file_name, source_encoding)
|
16
|
+
data = File.read(file_name, :encoding => source_encoding)
|
17
|
+
rows = GoImport::CsvHelper::text_to_hashes(data)
|
18
|
+
rows.each do |row|
|
19
|
+
yield row
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def convert_source
|
24
|
+
puts "Trying to convert Base CRM source to LIME Go..."
|
25
|
+
|
26
|
+
converter = Converter.new
|
27
|
+
ignored_notes = 0
|
28
|
+
ignored_persons = 0
|
29
|
+
|
30
|
+
# A rootmodel is used to represent all entitite/models that is
|
31
|
+
# exported
|
32
|
+
rootmodel = GoImport::RootModel.new
|
33
|
+
|
34
|
+
converter.configure(rootmodel)
|
35
|
+
source_encoding = defined?(SOURCE_ENCODING) ? SOURCE_ENCODING : 'ISO-8859-1'
|
36
|
+
|
37
|
+
# coworkers
|
38
|
+
# start with these since they are referenced
|
39
|
+
# from everywhere....
|
40
|
+
if defined?(COWORKER_FILE) && !COWORKER_FILE.nil? && !COWORKER_FILE.empty?
|
41
|
+
process_rows(COWORKER_FILE, source_encoding) do |row|
|
42
|
+
coworker = converter.to_coworker(row)
|
43
|
+
coworker.integration_id = "#{row['first_name']} #{row['last_name']}"
|
44
|
+
coworker.first_name = row['first_name']
|
45
|
+
coworker.last_name = row['last_name']
|
46
|
+
coworker.email = row['email']
|
47
|
+
rootmodel.add_coworker(coworker)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# organizations
|
52
|
+
if defined?(ORGANIZATION_FILE) && !ORGANIZATION_FILE.nil? && !ORGANIZATION_FILE.empty?
|
53
|
+
process_rows(ORGANIZATION_FILE, source_encoding) do |row|
|
54
|
+
next if row["is_organisation"] == "false"
|
55
|
+
organization = converter.to_organization(row, rootmodel)
|
56
|
+
organization = GoImport::Organization.new
|
57
|
+
organization.integration_id = row['id']
|
58
|
+
organization.name = row['name']
|
59
|
+
organization.email = row['email']
|
60
|
+
organization.web_site = row['website']
|
61
|
+
organization.central_phone_number = GoImport::PhoneHelper.parse_numbers(row['phone']) if not row['phone'].nil?
|
62
|
+
|
63
|
+
organization.with_visit_address do |address|
|
64
|
+
address.street = row['address']
|
65
|
+
address.zip_code = row['zip']
|
66
|
+
address.city = row['city']
|
67
|
+
end
|
68
|
+
|
69
|
+
organization.with_postal_address do |address|
|
70
|
+
address.street = row['address']
|
71
|
+
address.zip_code = row['zip']
|
72
|
+
address.city = row['city']
|
73
|
+
end
|
74
|
+
|
75
|
+
case row['prospect_status']
|
76
|
+
when "current"
|
77
|
+
organization.relation = GoImport::Relation::WorkingOnIt
|
78
|
+
else
|
79
|
+
organization.relation = GoImport::Relation::BeenInTouch
|
80
|
+
end
|
81
|
+
|
82
|
+
case row['customer_status']
|
83
|
+
when "current"
|
84
|
+
organization.relation = GoImport::Relation::IsACustomer
|
85
|
+
when "past"
|
86
|
+
organization.relation = GoImport::Relation::WasACustomer
|
87
|
+
else
|
88
|
+
organization.relation = GoImport::Relation::BeenInTouch
|
89
|
+
end
|
90
|
+
|
91
|
+
coworker = rootmodel.find_coworker_by_integration_id row['owner']
|
92
|
+
organization.responsible_coworker = coworker
|
93
|
+
tags = row['tags'].split(",")
|
94
|
+
tags.each do |tag|
|
95
|
+
organization.set_tag(tag)
|
96
|
+
end
|
97
|
+
|
98
|
+
rootmodel.add_organization(organization)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# persons
|
103
|
+
# depends on organizations
|
104
|
+
if defined?(PERSON_FILE) && !PERSON_FILE.nil? && !PERSON_FILE.empty?
|
105
|
+
process_rows(PERSON_FILE, source_encoding) do |row|
|
106
|
+
# adds it self to the employer
|
107
|
+
next if row["is_organisation"] == "true"
|
108
|
+
person = converter.to_person(row, rootmodel)
|
109
|
+
|
110
|
+
person.integration_id = row['id']
|
111
|
+
|
112
|
+
person.first_name = row['first_name']
|
113
|
+
person.last_name = row['last_name']
|
114
|
+
|
115
|
+
person.direct_phone_number = GoImport::PhoneHelper.parse_numbers(row['phone'])
|
116
|
+
person.mobile_phone_number = GoImport::PhoneHelper.parse_numbers(row['mobile'])
|
117
|
+
person.email = row['email']
|
118
|
+
|
119
|
+
organization = rootmodel.find_organization {|org|
|
120
|
+
org.name == row["organisation_name"]
|
121
|
+
}
|
122
|
+
if not organization.nil?
|
123
|
+
organization.add_employee(person)
|
124
|
+
else
|
125
|
+
puts "No organization for person '#{person.first_name} #{person.last_name}, #{person.integration_id}' could be found. Person will not be imported!"
|
126
|
+
ignored_persons += 1
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# leads
|
132
|
+
if defined?(LEADS_FILE) && !LEADS_FILE.nil? && !LEADS_FILE.empty?
|
133
|
+
process_rows(LEADS_FILE, source_encoding) do |row|
|
134
|
+
organization = converter.to_organization_from_lead(row, rootmodel)
|
135
|
+
|
136
|
+
organization.integration_id = "l#{row['id']}"
|
137
|
+
organization.name = row['company_name']
|
138
|
+
organization.relation = GoImport::Relation::WorkingOnIt
|
139
|
+
|
140
|
+
organization.central_phone_number = GoImport::PhoneHelper.parse_numbers(row['phone']) if not row['phone'].nil?
|
141
|
+
|
142
|
+
organization.with_visit_address do |address|
|
143
|
+
address.street = row['street']
|
144
|
+
address.city = row['city']
|
145
|
+
end
|
146
|
+
|
147
|
+
coworker = rootmodel.find_coworker_by_integration_id row['owner']
|
148
|
+
organization.responsible_coworker = coworker
|
149
|
+
|
150
|
+
if not row['tags'].nil?
|
151
|
+
tags = row['tags'].split(",")
|
152
|
+
tags.each do |tag|
|
153
|
+
organization.set_tag(tag)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
person = GoImport::Person.new
|
158
|
+
|
159
|
+
person.integration_id = "p#{row['id']}"
|
160
|
+
person.first_name = row['first_name']
|
161
|
+
person.last_name = row['last_name']
|
162
|
+
person.direct_phone_number = GoImport::PhoneHelper.parse_numbers(row['phone']) if not row['phone'].nil?
|
163
|
+
person.mobile_phone_number = GoImport::PhoneHelper.parse_numbers(row['mobile']) if not row['mobile'].nil?
|
164
|
+
person.email = row['email']
|
165
|
+
|
166
|
+
organization.add_employee(person)
|
167
|
+
|
168
|
+
if row['description']
|
169
|
+
note = GoImport::Note.new()
|
170
|
+
|
171
|
+
note.text = row['description']
|
172
|
+
note.person = person
|
173
|
+
note.organization = organization
|
174
|
+
note.created_by = coworker
|
175
|
+
|
176
|
+
rootmodel.add_note(note)
|
177
|
+
end
|
178
|
+
rootmodel.add_organization(organization)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# deals
|
183
|
+
if defined?(DEAL_FILE) && !DEAL_FILE.nil? && !DEAL_FILE.empty?
|
184
|
+
process_rows(DEAL_FILE, source_encoding) do |row|
|
185
|
+
deal = converter.to_deal(row, rootmodel)
|
186
|
+
deal.integration_id = row['id']
|
187
|
+
deal.name = row['name']
|
188
|
+
|
189
|
+
deal.value = row['scope']
|
190
|
+
deal.customer = rootmodel.find_organization_by_integration_id(row['company_id'])
|
191
|
+
deal.customer_contact = rootmodel.find_person_by_integration_id(row['main_contact_id'])
|
192
|
+
deal.responsible_coworker = rootmodel.find_coworker_by_integration_id(row['owner'])
|
193
|
+
|
194
|
+
values = row['tags'].split(",")
|
195
|
+
values.each do |value|
|
196
|
+
deal.set_tag(value)
|
197
|
+
end
|
198
|
+
rootmodel.add_deal(deal)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# notes
|
203
|
+
if defined?(NOTE_FILE) && !NOTE_FILE.nil? && !NOTE_FILE.empty?
|
204
|
+
process_rows(NOTE_FILE, source_encoding) do |row|
|
205
|
+
note = converter.to_note(row, rootmodel)
|
206
|
+
note.integration_id = row['id']
|
207
|
+
note.text = row['content']
|
208
|
+
note.created_by = rootmodel.find_coworker_by_integration_id(row["owner"])
|
209
|
+
notable_id = row['noteable_id']
|
210
|
+
case row["noteable_type"]
|
211
|
+
when "Deal"
|
212
|
+
deal = rootmodel.find_deal_by_integration_id(notable_id)
|
213
|
+
note.deal = deal
|
214
|
+
when "Lead"
|
215
|
+
note.person = rootmodel.find_person_by_integration_id("p#{notable_id}")
|
216
|
+
note.organization = rootmodel.find_organization_by_integration_id("l#{notable_id}")
|
217
|
+
when "Contact"
|
218
|
+
puts "Ignoreing note for unbound person: #{row['owner']}"
|
219
|
+
ignored_notes += 1
|
220
|
+
next
|
221
|
+
else
|
222
|
+
org = rootmodel.find_organization_by_integration_id(notable_id)
|
223
|
+
if org.nil?
|
224
|
+
person = rootmodel.find_person_by_integration_id(notable_id)
|
225
|
+
org = person.organization
|
226
|
+
note.person = person
|
227
|
+
end
|
228
|
+
note.organization = org
|
229
|
+
end
|
230
|
+
rootmodel.add_note(note)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
puts "Ignored #{ignored_persons} persons and #{ignored_notes} notes"
|
234
|
+
return rootmodel
|
235
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Base CRM migration
|
2
|
+
|
3
|
+
1. Export your Base CRM data with the built in export in Base CRM
|
4
|
+
2. Put the exported data into the `data` folder
|
5
|
+
3. Coworkers has to be entered manually into the coworkers file. A template file is provided
|
6
|
+
4. All mappings are done in `runner.rb` but special unique things can be configured in `converter.rb`
|
7
|
+
|
8
|
+
Note: In Base CRM you can have contacts persons without a corresponding organization.
|
9
|
+
This is not allowed in LIME Go and these persons and notes just linked to them will be ignored.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
class Converter
|
3
|
+
|
4
|
+
def configure(rootmodel)
|
5
|
+
# add custom field to your model here. Custom fields can be
|
6
|
+
# added to organization, deal and person. Valid types are
|
7
|
+
# :String and :Link. If no type is specified :String is used
|
8
|
+
# as default.
|
9
|
+
rootmodel.settings.with_organization do |organization|
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
rootmodel.settings.with_deal do |deal|
|
14
|
+
deal.add_status({:label => "Prospecting", :integration_id => "Prospecting"})
|
15
|
+
deal.add_status({:label => "Qualified", :integration_id => "Qualified"})
|
16
|
+
deal.add_status({:label => "Won", :integration_id => "Won",
|
17
|
+
:assessment => GoImport::DealState::PositiveEndState })
|
18
|
+
deal.add_status({:label => "Lost", :integration_id => "Lost",
|
19
|
+
:assessment => GoImport::DealState::NegativeEndState })
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_organization(row, rootmodel)
|
24
|
+
|
25
|
+
organization = GoImport::Organization.new
|
26
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
27
|
+
|
28
|
+
return organization
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_organization_from_lead(row, rootmodel)
|
32
|
+
organization = GoImport::Organization.new
|
33
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
34
|
+
return organization
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_coworker(row)
|
38
|
+
coworker = GoImport::Coworker.new
|
39
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
40
|
+
return coworker
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_person(row, rootmodel)
|
44
|
+
person = GoImport::Person.new
|
45
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
46
|
+
return person
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_deal(row, rootmodel)
|
50
|
+
deal = GoImport::Deal.new
|
51
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
52
|
+
deal.status = rootmodel.settings.deal.find_status_by_label row['stage_name']
|
53
|
+
return deal
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_note(row, rootmodel)
|
57
|
+
note = GoImport::Note.new()
|
58
|
+
# All built in fields are automagically mapped. Add your custom stuff here...
|
59
|
+
return note
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
first_name,last_name,is_organisation,name,organisation_name,owner,tags,email,address,mobile,phone,customer_status,prospect_status,custom Name#1,custom First name#1,city,country,created_at,creator,description,facebook,fax,id,industry,last_activity_date,linkedin,linkedin_display,private,region,skype,title,twitter,updated_at,website,zip
|
2
|
+
Håka,Lind,false,Håka Lind,AD Company,Kalle Kula,"",hakan.lind@ad.com,gatan 2,+46701234123,"",current,,,,Göteborg,Sweden,2015-08-12T09:59:32Z,Kalle Kula,,,,98153928,,,,,false,"",,"Service Manager production system, IT coordinator",,2015-10-02T09:19:17Z,,56130
|
3
|
+
,,true,itteknik,,Kalle Kula,from iPhone,,vägen 23,,,current,,,,Malmö,Sverige,2015-11-25T15:17:20Z,Kalle Kula,,,,108910004,,,,,false,,,,,2015-11-25T15:17:21Z,,34250
|
4
|
+
Anna,Berg,false,Anna Berg,itteknik,Kalle Kula,"Flexibla Kontoret,Hantverksappen,vvs",info@roret.se,Brunnvägen 1,070-1110000,"",current,,,,Stockholm,Sweden,2016-02-15T07:41:56Z,Kalle Kula,,,,117069853,,,,,false,"",,"Ekonomi, Admin",,2016-02-15T07:41:56Z,,57450
|
5
|
+
Anna,Ståhl,false,Anna Ståhl,AB Bors Rör,Kalle Kula,from iPhone,,,076-800 10 00,,,,,,,,2015-08-19T08:49:26Z,Kalle Kula,,,,98708109,,,,,false,,,,,2015-08-19T08:49:26Z,,
|
6
|
+
,,true,AB Bors Rör,,Kalle Kula,"flexibla kontoret,vvs","","","","",,,,,"","",2015-09-17T12:01:44Z,Kalle Kula,,,,101402913,,,,,false,"",,,,2015-11-09T13:45:58Z,,""
|
7
|
+
,,true,AB Familjen,,Kalle Kula,from iPhone,,,,,,,,,Åre,Sweden,2015-08-19T06:26:58Z,Kalle Kula,,,,98702143,,,,,false,Jämtlands Län,,,,2015-08-21T07:29:44Z,,
|
8
|
+
,,true,AB Laholms,,Kalle Kula,from iPhone,,,,,,,,,,,2015-08-19T06:21:27Z,Kalle Kula,,,,98702035,,,,,false,,,,,2015-08-19T06:21:27Z,,
|
9
|
+
,,true,AD Company,,Kalle Kula,from iPhone,,gatan 2,,,current,,,,Lund,,2015-10-12T14:38:43Z,Kalle Kula,,,,104062513,,,,,false,,,,,2015-11-19T10:40:39Z,,553 00
|
10
|
+
,,true,AB Affär,,Kalle Kula,"",,,,,current,,,,Lund,Sweden,2015-08-18T21:59:33Z,Kalle Kula,,,,98677167,Digital sinage mm,,,,false,,,,,2015-08-18T21:59:33Z,,
|
11
|
+
,,true,AB Affären,,Kalle Kula,"",,,,,,,,,,,2014-09-05T07:45:04Z,Kalle Kula,,,,69769303,Redovisnings konsult,,,,false,,,,,2014-09-05T15:33:17Z,,
|
12
|
+
,,true,Ahlgrens Bilar,,Kalle Kula,"from iPhone,flexibla kontoret,Flexibla/Hantverksappen",,,,,,,,,,,2015-08-19T06:37:39Z,Kalle Kula,,,,98702525,,,,,false,,,,,2015-08-19T06:37:39Z,,
|
13
|
+
Alex,Alexandersson,false,Alex Alexandersson,Ahlgrens Bilar,Kalle Kula,from iPhone,Alex.Alexandersson@ahlgrens.se,,0707 840000,,,,,,,,2015-08-19T09:30:24Z,Kalle Kula,,,,98710895,,,,,false,,,,,2015-08-19T09:30:24Z,,
|
@@ -0,0 +1,5 @@
|
|
1
|
+
id,name,scope,pipeline_name,pipeline_id,stage_name,stage_id,owner,tags,main_contact_id,main_contact,company_id,company,added_at,added_on,created_at,creator,currency,forecasted_deal_value,hot,last_activity_date,last_stage_change_at,loss_reason,source,updated_at
|
2
|
+
10926776,"avtal, ca 40st",300000,Sales Pipeline,60134,Prospecting,432286,Kalle Kula,"",117069853,Anna Berg,108910004,"itteknik",2015-10-05 08:28:00 UTC,2015-10-05,2015-10-05T08:29:47Z,Kalle Kula,SEK,,true,2015-10-05T08:29:47Z,2015-10-05T08:28:47Z,"",Butiken1,2015-10-05T08:29:47Z
|
3
|
+
11973819,Deal2,100000,Sales Pipeline,60134,Qualified,432290,Kalle Kula,"ftp,filserver,service avtal",98708109,Anna Ståhl,101402913,AB Bors Rör,2015-11-19 10:38:00 UTC,2015-11-19,2015-11-19T10:39:51Z,Kalle Kula,SEK,,true,2015-11-19T10:39:51Z,2015-11-19T10:38:51Z,"",Henrik Henriksson konsult,2015-11-19T10:39:51Z
|
4
|
+
4636237,Deal1,4500,Sales Pipeline,60134,Won,432287,Kalle Kula,cloud,98153928,Håka Lind,104062513,AD Company,2014-09-02 09:40:00 UTC,2014-09-02,2014-09-03T09:41:05Z,Kalle Kula,SEK,,true,2015-02-18T07:39:45Z,2015-02-18T07:39:45Z,"",konsollen,2015-02-18T07:39:45Z
|
5
|
+
4653104,Deal3,2300,Sales Pipeline,60134,Won,432287,Kalle Kula,"",98710895,Alex Alexandersson,98702525,Ahlgrens Bilar,2014-09-04 07:53:00 UTC,2014-09-04,2014-09-04T07:54:31Z,Kalle Kula,SEK,,false,2014-09-04T07:55:07Z,2014-09-04T07:53:00Z,"",Hyresavtal,2014-09-04T07:54:31Z
|
@@ -0,0 +1,4 @@
|
|
1
|
+
first_name,last_name,company_name,owner,city,country,created_at,creator,description,email,facebook,fax,id,industry,linkedin,mobile,phone,region,skype,status,street,tags,title,twitter,updated_at,website,zip
|
2
|
+
Robin,Hood,Reklam1 AB,Kalle Kula,Lund,Sweden,2014-09-04T09:42:33Z,Kalle Kula,,,,,16685740,tillverkning,,0733-11 11 11,,,,Working,,reklam,Försäljnings- och marknadschef,,2014-09-04T09:42:33Z,,
|
3
|
+
Tony,Tonfisk,Hantverkare2,Kalle Kula,Borås,,2014-09-04T14:36:01Z,Kalle Kula,"Ringde, intresse finns",tony@tonfisk.se,,,16694927,Magasin/katalog,,0701121212,,,,Unqualified,gatan 11,,Ansvarig,,2014-09-10T14:44:29Z,,
|
4
|
+
Thomas,Tomasso,"Bregott fabriken",Kalle Kula,Jönköping,Sweden,2015-06-30T12:47:04Z,Kalle Kula,,thomas.tomasso@bregott.se,,,35451881,,,07088000 00,090505050,,,Working,gatan 12,,Delägare,,2015-06-30T12:47:04Z,,553 17
|
@@ -0,0 +1,6 @@
|
|
1
|
+
content,owner,noteable_id,noteable_type,noteable_name,created_at,id,noteable_company_name,noteable_first_name,noteable_last_name,updated_at
|
2
|
+
Uppdatering av underhållsavtal på befintlig,Kalle Kula,10926776,Deal,Sannarp,2014-09-03T08:49:07Z,22606121,,,,2014-09-03T08:49:07Z
|
3
|
+
"Mailat offert, Återkommer...",Kalle Kula,10926776,Deal,Sannarp,2014-09-03T08:50:01Z,22606134,,,,2014-09-03T08:50:01Z
|
4
|
+
"Kund mailar och...",Kalle Kula,11973819,Deal,Sannarp,2014-09-03T08:50:28Z,22606143,,,,2014-09-03T08:50:28Z
|
5
|
+
"Kört igång...",Kalle Kula,98702525,SalesAccount,,2014-09-03T08:56:28Z,22606290,"",Peder,Johansson,2014-09-03T08:56:28Z
|
6
|
+
"Påminnelse ,1, 2...",Kalle Kula,108910004,SalesAccount,,2014-09-03T08:58:13Z,22606323,"",Peder,Johansson,2014-09-03T08:58:13Z
|
@@ -0,0 +1,5 @@
|
|
1
|
+
content,owner,send_time,done_at,created_at,date,id,remind,taskable_company_name,taskable_first_name,taskable_id,taskable_last_name,taskable_name,taskable_type,updated_at
|
2
|
+
"Ring kund ang uppföljning,Kalle Kula,2014-09-04T06:15:00Z,2014-09-04T06:59:32Z,2014-09-03T08:59:53Z,,7338118,true,"""",Petter,69512473,Johansson,,SalesAccount,2014-09-04T06:59:32Z"
|
3
|
+
"Ring boka ny utb!,Kalle Kula,2014-09-08T07:45:00Z,,2014-09-04T07:00:36Z,,7402212,true,"""",Petter,69512473,Johansson,,SalesAccount,2014-09-07T14:45:04Z"
|
4
|
+
"Ring boka möte för fördjupat samarbete,Kalle Kula,2014-09-08T08:00:00Z,,2014-09-04T07:25:17Z,,7402869,true,"""",Anna,69512622,Andersson,,SalesAccount,2014-09-04T07:25:17Z"
|
5
|
+
"Boka nytt möte,Kalle Kula,2014-09-08T10:45:00Z,,2014-09-04T07:18:36Z,,7402562,true,"""",Cyrus,69512640,TheVirus,,SalesAccount,2014-09-07T14:44:51Z"
|
@@ -94,4 +94,26 @@ describe GoImport::PhoneHelper do
|
|
94
94
|
# then
|
95
95
|
number.should eq "+4722130030"
|
96
96
|
end
|
97
|
+
|
98
|
+
it "should handle nil" do
|
99
|
+
# given
|
100
|
+
source = nil
|
101
|
+
|
102
|
+
# when
|
103
|
+
number = GoImport::PhoneHelper.parse_numbers(source)
|
104
|
+
|
105
|
+
# then
|
106
|
+
number.should eq nil
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should handle empty string" do
|
110
|
+
# given
|
111
|
+
source = ""
|
112
|
+
|
113
|
+
# when
|
114
|
+
number = GoImport::PhoneHelper.parse_numbers(source)
|
115
|
+
|
116
|
+
# then
|
117
|
+
number.should eq ""
|
118
|
+
end
|
97
119
|
end
|
@@ -27,12 +27,12 @@ describe GoImport::ShardHelper do
|
|
27
27
|
organization = GoImport::Organization.new
|
28
28
|
organization.name = "Ankeborgs bibliotek"
|
29
29
|
organization.integration_id = n.to_s
|
30
|
-
|
30
|
+
|
31
31
|
person = GoImport::Person.new
|
32
32
|
person.first_name = "Kalle"
|
33
33
|
person.last_name = "Kula"
|
34
34
|
organization.add_employee(person)
|
35
|
-
|
35
|
+
|
36
36
|
person = GoImport::Person.new
|
37
37
|
person.first_name = "Nisse"
|
38
38
|
person.last_name = "Nice"
|
@@ -79,7 +79,7 @@ describe GoImport::ShardHelper do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
sharder = GoImport::ShardHelper.new(5)
|
82
|
-
|
82
|
+
|
83
83
|
# when, then
|
84
84
|
sharder.shard_model(model).length.should eq 4
|
85
85
|
end
|
@@ -116,6 +116,26 @@ describe GoImport::ShardHelper do
|
|
116
116
|
sharder.shard_model(model)[0].find_deal_by_integration_id("123").should eq deal
|
117
117
|
end
|
118
118
|
|
119
|
-
|
119
|
+
it "should keep the settings into a shard" do
|
120
|
+
# given
|
121
|
+
|
122
|
+
model = GoImport::RootModel.new
|
123
|
+
|
124
|
+
model.settings.with_organization do |organization|
|
125
|
+
organization.set_custom_field( { :integrationid => 'external_url', :title => 'Link to external system', :type => :Link } )
|
126
|
+
end
|
127
|
+
|
128
|
+
model.settings.with_deal do |deal|
|
129
|
+
deal.add_status({:label => "Prospecting", :integration_id => "prospect"})
|
130
|
+
deal.add_status({:label => "Qualified", :integration_id => "qualification"})
|
131
|
+
deal.add_status({:label => "Won", :integration_id => "won", :assessment => GoImport::DealState::PositiveEndState })
|
132
|
+
deal.add_status({:label => "Lost", :integration_id => "Lost", :assessment => GoImport::DealState::NegativeEndState })
|
133
|
+
end
|
134
|
+
|
135
|
+
sharder = GoImport::ShardHelper.new()
|
120
136
|
|
137
|
+
# when, then
|
138
|
+
sharder.shard_model(model)[0].settings.should eq model.settings
|
139
|
+
end
|
121
140
|
|
141
|
+
end
|
data/spec/person_spec.rb
CHANGED
@@ -25,7 +25,7 @@ describe "Person" do
|
|
25
25
|
person.set_custom_value('the key', 'the value')
|
26
26
|
|
27
27
|
person.set_custom_value('the key', 'the value 2')
|
28
|
-
|
28
|
+
|
29
29
|
value = person.custom_values[0]
|
30
30
|
field = value.field
|
31
31
|
|
@@ -78,7 +78,7 @@ describe "Person" do
|
|
78
78
|
org = GoImport::Organization.new({:integration_id => "123", :name => "Lundalogik"})
|
79
79
|
|
80
80
|
# when
|
81
|
-
person.
|
81
|
+
person.set_organization_reference = org
|
82
82
|
|
83
83
|
# then
|
84
84
|
person.organization.is_a?(GoImport::OrganizationReference).should eq true
|
@@ -86,7 +86,7 @@ describe "Person" do
|
|
86
86
|
|
87
87
|
# *** TODO:
|
88
88
|
# Enable this when sources are fixed, see comment in organization.add_employee
|
89
|
-
|
89
|
+
|
90
90
|
# it "should be immutable when added to an organization" do
|
91
91
|
# # given
|
92
92
|
# org = GoImport::Organization.new({:integration_id => "123", :name => "Lundalogik"})
|
@@ -127,4 +127,3 @@ describe "Person" do
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
|
-
|