move-to-go 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/bin/move-to-go +210 -0
  3. data/lib/move-to-go/can_become_immutable.rb +29 -0
  4. data/lib/move-to-go/csv_helper.rb +47 -0
  5. data/lib/move-to-go/email_helper.rb +14 -0
  6. data/lib/move-to-go/errors.rb +31 -0
  7. data/lib/move-to-go/excel_helper.rb +10 -0
  8. data/lib/move-to-go/global_phone.json +6571 -0
  9. data/lib/move-to-go/model/address.rb +63 -0
  10. data/lib/move-to-go/model/class_settings.rb +50 -0
  11. data/lib/move-to-go/model/clientvisit.rb +10 -0
  12. data/lib/move-to-go/model/comment.rb +10 -0
  13. data/lib/move-to-go/model/coworker.rb +82 -0
  14. data/lib/move-to-go/model/coworker_reference.rb +33 -0
  15. data/lib/move-to-go/model/customfield.rb +87 -0
  16. data/lib/move-to-go/model/deal.rb +216 -0
  17. data/lib/move-to-go/model/deal_class_settings.rb +97 -0
  18. data/lib/move-to-go/model/deal_state.rb +15 -0
  19. data/lib/move-to-go/model/deal_status.rb +23 -0
  20. data/lib/move-to-go/model/deal_status_reference.rb +47 -0
  21. data/lib/move-to-go/model/deal_status_setting.rb +49 -0
  22. data/lib/move-to-go/model/documents.rb +76 -0
  23. data/lib/move-to-go/model/file.rb +193 -0
  24. data/lib/move-to-go/model/history.rb +148 -0
  25. data/lib/move-to-go/model/history_classification.rb +26 -0
  26. data/lib/move-to-go/model/link.rb +82 -0
  27. data/lib/move-to-go/model/organization.rb +250 -0
  28. data/lib/move-to-go/model/person.rb +164 -0
  29. data/lib/move-to-go/model/referencetosource.rb +58 -0
  30. data/lib/move-to-go/model/relation.rb +23 -0
  31. data/lib/move-to-go/model/rootmodel.rb +663 -0
  32. data/lib/move-to-go/model/salescall.rb +10 -0
  33. data/lib/move-to-go/model/settings.rb +61 -0
  34. data/lib/move-to-go/model/tag.rb +35 -0
  35. data/lib/move-to-go/model/talkedto.rb +10 -0
  36. data/lib/move-to-go/model/triedtoreach.rb +10 -0
  37. data/lib/move-to-go/model_helpers.rb +97 -0
  38. data/lib/move-to-go/phone_helper.rb +75 -0
  39. data/lib/move-to-go/roo_helper.rb +82 -0
  40. data/lib/move-to-go/serialize_helper.rb +199 -0
  41. data/lib/move-to-go/shard_helper.rb +96 -0
  42. data/lib/move-to-go/source.rb +108 -0
  43. data/lib/move-to-go/templating.rb +52 -0
  44. data/lib/move-to-go.rb +20 -0
  45. data/sources/VISMA/.gitignore +14 -0
  46. data/sources/VISMA/.move-to-go/readme.txt +1 -0
  47. data/sources/VISMA/.move-to-go/runner.rb +89 -0
  48. data/sources/VISMA/Database/KONTAKT.DBF +0 -0
  49. data/sources/VISMA/Database/KUND.DBF +0 -0
  50. data/sources/VISMA/Gemfile +5 -0
  51. data/sources/VISMA/converter.rb +120 -0
  52. data/sources/base-crm/.move-to-go/runner.rb +235 -0
  53. data/sources/base-crm/Gemfile +5 -0
  54. data/sources/base-crm/README.md +9 -0
  55. data/sources/base-crm/converter.rb +56 -0
  56. data/sources/base-crm/data/contacts.csv +13 -0
  57. data/sources/base-crm/data/coworkers.csv +3 -0
  58. data/sources/base-crm/data/deals.csv +5 -0
  59. data/sources/base-crm/data/histories.csv +6 -0
  60. data/sources/base-crm/data/leads.csv +4 -0
  61. data/sources/base-crm/data/tasks.csv +5 -0
  62. data/sources/csv/.gitignore +14 -0
  63. data/sources/csv/.move-to-go/readme.txt +1 -0
  64. data/sources/csv/.move-to-go/runner.rb +65 -0
  65. data/sources/csv/Gemfile +5 -0
  66. data/sources/csv/converter.rb +218 -0
  67. data/sources/csv/data/coworkers.csv +2 -0
  68. data/sources/csv/data/deals.csv +2 -0
  69. data/sources/csv/data/organizations.csv +2 -0
  70. data/sources/csv/data/persons.csv +2 -0
  71. data/sources/custom/.gitignore +14 -0
  72. data/sources/custom/.move-to-go/readme.txt +1 -0
  73. data/sources/custom/.move-to-go/runner.rb +30 -0
  74. data/sources/custom/Gemfile +4 -0
  75. data/sources/custom/converter.rb +45 -0
  76. data/sources/excel/.gitignore +14 -0
  77. data/sources/excel/.move-to-go/readme.txt +3 -0
  78. data/sources/excel/.move-to-go/runner.rb +140 -0
  79. data/sources/excel/Gemfile +7 -0
  80. data/sources/excel/converter.rb +188 -0
  81. data/sources/excel/files/avtal.docx +0 -0
  82. data/sources/excel/files/more/avtal.docx +0 -0
  83. data/sources/excel/files/more/offert-2.pdf +0 -0
  84. data/sources/excel/files/offert-2.docx +0 -0
  85. data/sources/excel/files/offert.docx +0 -0
  86. data/sources/excel/sample-data.xlsx +0 -0
  87. data/sources/excel-basic/.gitignore +14 -0
  88. data/sources/excel-basic/.move-to-go/readme.txt +3 -0
  89. data/sources/excel-basic/.move-to-go/runner.rb +139 -0
  90. data/sources/excel-basic/Exempelfil.xlsx +0 -0
  91. data/sources/excel-basic/Gemfile +6 -0
  92. data/sources/excel-basic/converter.rb +175 -0
  93. data/sources/excel-basic/files/avtal.docx +0 -0
  94. data/sources/excel-basic/files/more/avtal.docx +0 -0
  95. data/sources/excel-basic/files/more/offert-2.pdf +0 -0
  96. data/sources/excel-basic/files/offert-2.docx +0 -0
  97. data/sources/excel-basic/files/offert.docx +0 -0
  98. data/sources/lime-crm-basic/.gitignore +14 -0
  99. data/sources/lime-crm-basic/.move-to-go/readme.txt +1 -0
  100. data/sources/lime-crm-basic/.move-to-go/runner.rb +524 -0
  101. data/sources/lime-crm-basic/Gemfile +6 -0
  102. data/sources/lime-crm-basic/converter.rb +396 -0
  103. data/sources/lime-easy/.gitignore +14 -0
  104. data/sources/lime-easy/.move-to-go/readme.txt +1 -0
  105. data/sources/lime-easy/.move-to-go/runner.rb +348 -0
  106. data/sources/lime-easy/Export/readme.txt +6 -0
  107. data/sources/lime-easy/Gemfile +5 -0
  108. data/sources/lime-easy/converter.rb +362 -0
  109. data/sources/salesforce/.gitignore +14 -0
  110. data/sources/salesforce/.move-to-go/readme.txt +1 -0
  111. data/sources/salesforce/.move-to-go/runner.rb +404 -0
  112. data/sources/salesforce/Gemfile +6 -0
  113. data/sources/salesforce/Gemfile.lock +48 -0
  114. data/sources/salesforce/converter.rb +113 -0
  115. data/sources/salesforce/export/readme.txt +3 -0
  116. data/spec/address_spec.rb +49 -0
  117. data/spec/class_settings_spec.rb +37 -0
  118. data/spec/coworker_spec.rb +94 -0
  119. data/spec/custom_field_spec.rb +22 -0
  120. data/spec/deal_class_settings_spec.rb +116 -0
  121. data/spec/deal_spec.rb +232 -0
  122. data/spec/deal_status_reference_spec.rb +17 -0
  123. data/spec/documents_spec.rb +64 -0
  124. data/spec/file_spec.rb +178 -0
  125. data/spec/helpers/csv_helper_spec.rb +45 -0
  126. data/spec/helpers/email_helper_spec.rb +37 -0
  127. data/spec/helpers/phone_helper_spec.rb +119 -0
  128. data/spec/helpers/roo_helper_spec.rb +10 -0
  129. data/spec/helpers/serialize_helper_spec.rb +253 -0
  130. data/spec/helpers/shard_helper_spec.rb +141 -0
  131. data/spec/helpers/xsd_validate_spec.rb +57 -0
  132. data/spec/history_spec.rb +150 -0
  133. data/spec/link_spec.rb +107 -0
  134. data/spec/organization_spec.rb +221 -0
  135. data/spec/person_spec.rb +129 -0
  136. data/spec/rootmodel_spec.rb +993 -0
  137. data/spec/spec_helper.rb +30 -0
  138. metadata +362 -0
@@ -0,0 +1,396 @@
1
+ # encoding: UTF-8
2
+ require 'move-to-go'
3
+
4
+ # Customize this file to suit your LIME Pro database structure.
5
+ #
6
+ # Documentation move-to-go can be found at
7
+ # http://rubygems.org/gems/move-to-go
8
+ #
9
+ # move-to-go contains all objects in LIME Go such as organization,
10
+ # people, deals, etc. What properties each object has is described in
11
+ # the documentation.
12
+ #
13
+ # *** NOTE:
14
+ #
15
+ # Integration-ID and LIME-links are automatically created for each
16
+ # object
17
+
18
+ # *** TODO:
19
+ #
20
+ # You must customize this template so it works with your LIME Pro
21
+ # database. Modify each to_* method and set properties on the LIME Go
22
+ # object.
23
+ #
24
+
25
+ ############################################################################
26
+ # Constants
27
+ # Edit these constants to fit your needs
28
+
29
+ # Connection to the SQL-server
30
+ # You can use either an AD-account or SQL-user credentials to authenticate.
31
+ # You will be prompted for the password when you run the import.
32
+ #
33
+ # Remove SQL_SERVER_USER or leave it empty if you want to connect with
34
+ # the user that is running move-to-go.
35
+ SQL_SERVER = ''
36
+ SQL_SERVER_DATABASE = ''
37
+ SQL_SERVER_USER = ''
38
+
39
+ # LIME Server
40
+ LIME_SERVER = ''
41
+ LIME_DATABASE = ''
42
+ LIME_LANGUAGE = 'sv' # Used for the values in set and option fields
43
+
44
+ # Companies
45
+ # Set the name of the relation field to the responsible coworker
46
+ ORGANIZATION_RESPONSIBLE_FIELD = 'coworker'
47
+
48
+ # Deals
49
+ # Set if deals should be imported and name of relationfields.
50
+ # Defaults should work well.
51
+ IMPORT_DEALS = false
52
+ DEAL_RESPONSIBLE_FIELD = 'coworker'
53
+ DEAL_COMPANY_FIELD = 'company'
54
+
55
+ # Notes
56
+ # Set if notes should be imported and name of relationfields.
57
+ # Defaults should work well
58
+ IMPORT_HISTORY = true
59
+ HISTORY_COWORKER_FIELD = 'coworker'
60
+ HISTORY_COMPANY_FIELD = 'company'
61
+ HISTORY_PERSON_FIELD = 'person'
62
+ HISTORY_DEAL_FIELD = 'business'
63
+
64
+ ############################################################################
65
+
66
+ class Converter
67
+
68
+ # The to_coworker, to_organization, etc methods takes a LIME Go
69
+ # object (a coworker or organization etc) where some basic
70
+ # properties already has been set. The methods will also have a
71
+ # row argument that represents the database row in LIME Pro. Some
72
+ # methods will also get the rootmodel. You can use the rootmodel
73
+ # if you need to lookup coworkers or other object.
74
+ #
75
+ # The to_ methods should return the object that is provided as argument.
76
+ #
77
+ # We have included some sample code that shows how to set
78
+ # different properties. However, the goal is that you should NOT
79
+ # have to modify anything to get a basic import of a LIME Pro Core
80
+ # database.
81
+
82
+
83
+ # The following properties are set on the coworker by default:
84
+ #
85
+ # LIME Go field LIME Pro field label
86
+ # coworker.first_name and coworker.last_name Name
87
+ # coworker.email PrimaryEmail
88
+ # coworker.direct_phone_number BusinessTelephoneNumber
89
+ # coworker.mobile_phone_number MobileTelephoneNumber
90
+ def to_coworker(coworker, row)
91
+ # If your database dont have fields with the specifed labels,
92
+ # you must set properties as below.
93
+
94
+ # coworker.first_name = row["firstname"]
95
+ # coworker.last_name = row["lastname"]
96
+ # coworker.direct_phone_number = row["phone"]
97
+ # coworker.mobile_phone_number = row["cellphone"]
98
+ # coworker.email = row["email"]
99
+
100
+ return coworker
101
+ end
102
+
103
+ # The following properties are set on the organization by default:
104
+ #
105
+ # LIME Go field LIME Pro field label
106
+ # organization.name Name
107
+ # organization.organization_number CompanyNumber
108
+ # organization.email PrimaryEmailAddress
109
+ # organization.web_site BusinessHomePage
110
+ # organization.central_phone_number BusinessTelephoneNumber
111
+ # organization.postal_address.street StreetAddress + StreetAddress2
112
+ # organization.postal_address.zip_code ZipCode
113
+ # organization.postal_address.city City
114
+ # organization.postal_address.country Country
115
+ # organization.visit_address.street VisitingAddressStreetAddress + VisitingAddressStreetAddress2
116
+ # organization.visit_address.zip_code VisitingAddressZipCode
117
+ # organization.visit_address.city VisitingAddressCity
118
+ # organization.visit_address.country VisitingAddressCountry
119
+ def to_organization(organization, row)
120
+ # If your database dont have fields with the specifed labels,
121
+ # you must set properties as below.
122
+
123
+ # organization.name = row['name']
124
+ # organization.organization_number = row['registrationno']
125
+
126
+ ####################################################################
127
+ ## Bisnode ID fields
128
+
129
+ # NOTE!!! If a bisnode-id is present you dont need to set
130
+ # fields like address or website since they are reterived from
131
+ # PAR.
132
+
133
+ # bisnode_id = row['parid']
134
+
135
+ # if bisnode_id && !bisnode_id.empty?
136
+ # organization.with_source do |source|
137
+ # source.par_se(bisnode_id)
138
+ # end
139
+ # end
140
+
141
+ # If a company is missing a bisnode ID then you should do this
142
+ # in order to capture any possible data that is written manually
143
+ # on that company.
144
+
145
+ # if bisnode_id && bisnode_id.empty?
146
+ # organization.web_site = row['website']
147
+ # organization.central_phone_number = row['phone']
148
+
149
+
150
+ # ####################################################################
151
+ # # Address fields.
152
+ # # Addresses consists of several parts in LIME Go. Lots of other
153
+ # # systems have the address all in one line, to be able to
154
+ # # match when importing it is way better to split the addresses
155
+
156
+ # organization.with_postal_address do |address|
157
+ # address.street = row['potstaladdress1']
158
+ # address.zip_code = row['postalzipcode']
159
+ # address.city = row['postalcity']
160
+ # address.location = row['country']
161
+ # end
162
+
163
+ # # Same as visting address
164
+
165
+ # organization.with_visit_address do |addr|
166
+ # addr.street = row['visitingaddress1']
167
+ # addr.zip_code = row['visitingzipcode']
168
+ # addr.city = row['visitingcity']
169
+ # end
170
+ # end
171
+ #####################################################################
172
+ ## Tags.
173
+ # Set tags for the organization. All organizations will get
174
+ # the tag "import" automagically
175
+
176
+ # organization.set_tag("Guldkund")
177
+
178
+ #####################################################################
179
+ ## Option fields.
180
+ # Option fields are normally translated into tags
181
+ # The option field customer category for instance,
182
+ # has the options "A-customer", "B-customer", and "C-customer"
183
+
184
+ # case row['businessarea']
185
+ # when 'Marketing', 'Sales'
186
+ # organization.set_tag(row['businessarea'])
187
+ # end
188
+
189
+ #####################################################################
190
+ ## Set fields.
191
+ # Set fields are normally translated into tags
192
+ # A field is a ";"- separated list. We must first split them into
193
+ # an array.
194
+
195
+ # values = row["mailings"].split(";")
196
+ # values.each do |value|
197
+ # if value = "Newsletter"
198
+ # organization.set_tag(value)
199
+ # end
200
+ # end
201
+
202
+ #####################################################################
203
+ ## LIME Go Relation.
204
+ # let's say that there is a option field in Easy called 'Customer relation'
205
+ # with the options '1.Customer', '2.Prospect' '3.Partner' and '4.Lost customer'
206
+
207
+ # case row['relation']
208
+ # when '1.Customer'
209
+ # We have made a deal with this organization.
210
+ # organization.relation = MoveToGo::Relation::IsACustomer
211
+ # when '2.Prospect'
212
+ # Something is happening with this organization, we might have
213
+ # booked a meeting with them or created a deal, etc.
214
+ # organization.relation = MoveToGo::Relation::WorkingOnIt
215
+ # when '4.Lost customer'
216
+ # We had something going with this organization but we
217
+ # couldn't close the deal and we don't think they will be a
218
+ # customer to us in the foreseeable future.
219
+ # organization.relation = MoveToGo::Relation::BeenInTouch
220
+ # else
221
+ # organization.relation = MoveToGo::Relation::NoRelation
222
+ # end
223
+
224
+ return organization
225
+ end
226
+
227
+ # The following properties are set on the person by default:
228
+ #
229
+ # LIME Go field LIME Pro field label
230
+ # person.first_name Name
231
+ # person.last_name Name
232
+ # person.direct_phone_number BusinessTelephoneNumber
233
+ # person.mobile_phone_number MobileTelephoneNumber
234
+ # person.position JobTitle
235
+ # person.email PrimaryEmailAddress
236
+ def to_person(person, row)
237
+ ## Here are some standard fields that are present
238
+ # on a LIME Go person that might be represented as custom
239
+ # fields in Pro.
240
+ # person.first_name = row["firstname"]
241
+ # person.last_name = row["lastname"]
242
+
243
+ # person.direct_phone_number = row['phone']
244
+ # person.mobile_phone_number = row['cellphone']
245
+ # person.email = row['email']
246
+ # person.position = row['position']
247
+
248
+ #####################################################################
249
+ ## Tags.
250
+ # Set tags for the person
251
+ # person.set_tag("VIP")
252
+
253
+ #####################################################################
254
+ ## Checkbox fields.
255
+ # Checkbox fields are normally translated into tags
256
+ # Xmas card field is a checkbox in Easy
257
+
258
+ # if row['Xmascard'] == "1"
259
+ # person.set_tag("Xmas card")
260
+ # end
261
+
262
+ #####################################################################
263
+ ## Multioption fields or "Set"- fields.
264
+ # Set fields are normally translated into multiple tags in LIME Go
265
+ # interests is an example of a set field in LIME Pro.
266
+
267
+ # if row['intrests']
268
+ # intrests = row['intrests'].split(';')
269
+ # intrests.each do |intrest|
270
+ # person.set_tag(intrest)
271
+ # end
272
+ # end
273
+
274
+ #####################################################################
275
+ ## LIME Go custom fields.
276
+ # This is how you populate a LIME Go custom field that was created in
277
+ # the configure method.
278
+
279
+ # person.set_custom_value("shoe_size", row['shoe size'])
280
+
281
+ return person
282
+ end
283
+
284
+ # The following properties are set on the person by default:
285
+ #
286
+ # LIME Go field LIME Pro field NAME
287
+ # deal.name name
288
+ # deal.description wonlostreason
289
+ # deal.value businessvalue
290
+ def to_deal(deal, row)
291
+
292
+ # deal.name = row['name']
293
+ ## Here are some standard fields that are present
294
+ # on a LIME Go deal and are usually represented
295
+ # as custom fields in Pro.
296
+
297
+ # deal.order_date = row['orderdate']
298
+
299
+ # Deal.value should be integer
300
+ # The currency used in Pro should match the one used in Go
301
+
302
+ # deal.value = row['value']
303
+
304
+ # should be between 0 - 100
305
+ # remove everything that is not an intiger
306
+
307
+ # deal.probability = row['probability'].gsub(/[^\d]/,"").to_i unless row['probability'].nil?
308
+
309
+ # Sets the deal's status to the value of the Pro field. This
310
+ # assumes that the status is already created in LIME Go. To
311
+ # create statuses during import add them to the settings
312
+ # during configure.
313
+
314
+ # if !row['businessstatus'].nil? && !row['businessstatus'].empty?
315
+ # deal.status = row['status']
316
+ # end
317
+
318
+ #####################################################################
319
+ ## Tags.
320
+ # Set tags for the deal
321
+
322
+ # deal.set_tag("productname")
323
+
324
+ return deal
325
+ end
326
+
327
+ # Reads a row from the History table
328
+ # and ads custom fields to the move-to-go history.
329
+
330
+ # NOTE!!! You should customize this method to include
331
+ # and transform the fields you want to import to LIME Go.
332
+ # The method includes examples of different types of
333
+ # fields and how you should handle them.
334
+ # Sometimes it's enough to uncomment some code and
335
+ # change the row name but in most cases you need to
336
+ # do some thinking of your own.
337
+ def to_history(history, row)
338
+
339
+ # history.text = row['text']
340
+
341
+ # Set the history classification. The value must be a value from the
342
+ # MoveToGo::HistoryClassification enum. If no classification is
343
+ # set the history will get the default classification 'Comment'
344
+
345
+ # case row['type']
346
+ # when 'Sales call'
347
+ # history.classification = MoveToGo::HistoryClassification::SalesCall
348
+ # when 'Customer Visit'
349
+ # history.classification = MoveToGo::historyClassification::ClientVisit
350
+ # when 'No answer'
351
+ # history.classification = MoveToGo::HistoryClassification::TriedToReach
352
+ # else
353
+ # history.classification = MoveToGo::HistoryClassification::Comment
354
+ # end
355
+
356
+ return history
357
+ end
358
+
359
+
360
+ def configure(rootmodel)
361
+ #####################################################################
362
+ ## LIME Go custom fields.
363
+ # This is how you add a custom field in LIME Go.
364
+ # Custom fields can be added to organization, deal and person.
365
+ # Valid types are :String and :Link. If no type is specified
366
+ # :String is used as default.
367
+
368
+ # rootmodel.settings.with_person do |person|
369
+ # person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
370
+ # end
371
+
372
+ # rootmodel.settings.with_deal do |deal|
373
+ # assessment is default DealState::NoEndState
374
+ # deal.add_status( {:label => '1. Kvalificering' })
375
+ # deal.add_status( {:label => '2. Deal closed', :assessment => MoveToGo::DealState::PositiveEndState })
376
+ # deal.add_status( {:label => '4. Deal lost', :assessment => MoveToGo::DealState::NegativeEndState })
377
+ # end
378
+ end
379
+
380
+ # HOOKS
381
+ #
382
+ # Sometimes you need to add exra information to the rootmodel, this can be done
383
+ # with hooks, below is an example of an organization hook that adds a comment to
384
+ # an organization if a field has a specific value
385
+ #def organization_hook(row, organization, rootmodel)
386
+ # if not row['fieldname'].empty?
387
+ # comment = MoveToGo::Comment.new
388
+ # comment.text = row['fieldname']
389
+ # comment.organization = organization
390
+ # comment.created_by = rootmodel.migrator_coworker
391
+ # rootmodel.add_comment(comment)
392
+ # end
393
+ #end
394
+
395
+ end
396
+
@@ -0,0 +1,14 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+ # Ignore built gems
10
+ /*.gem
11
+ # Ignore all logfiles and tempfiles.
12
+ /tmp
13
+ /spec/tmp
14
+ pkg
@@ -0,0 +1 @@
1
+ This source converts a LIME Easy database to LIME Go.