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,362 @@
1
+ # encoding: UTF-8
2
+ require 'move-to-go'
3
+
4
+ # Customize this file to suit your input files.
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
+ # *** TODO:
14
+ #
15
+ # You must customize this template so it works with your LIME Easy
16
+ # database. Modify each to_* method and set properties on the LIME Go
17
+ # objects.
18
+ #
19
+ # Follow these steps:
20
+ #
21
+ # 1) Export all data from KONTAKT.mdb to a folder named Export located
22
+ # in the folder created by move-to-go new. Export data using the
23
+ # magical tool called PowerSellMigrationExport.exe that can be found
24
+ # in K:\Lundalogik\LIME Easy\Tillbehör\Migrationsexport.
25
+ #
26
+ # 2) Modify this file (the to_* methods) according to your customer's
27
+ # KONTAKT.mdb and wishes.
28
+ #
29
+ # 3) Run move-to-go run
30
+ #
31
+ # 4) Upload go.zip to LIME Go. First test your import on staging and
32
+ # when your customer has approved the import, run it on production.
33
+ #
34
+ # You will get a WARNING from 'move-to-go run' about FILES_FOLDER has
35
+ # not been set. You can ignore the warning since documents are
36
+ # exported with an absolute path from LIME Easy.
37
+
38
+ ############################################################################
39
+ ## Constants
40
+ # Edit these constants to fit your needs
41
+
42
+ # determines if documents should be imported.
43
+ # IMPORT_DOCUMENTS = true
44
+
45
+ # set the name of the company-resposible field.
46
+ # ORGANIZATION_RESPONSIBLE_FIELD = "Responsible"
47
+
48
+ # set the name of the deal-responsible field.
49
+ # DEAL_RESPONSIBLE_FIELD = "Responsible"
50
+
51
+ # If you are importing files then you must set the FILES_FOLDER
52
+ # constant. FILES_FOLDER should point to the folder where the files
53
+ # are stored. FILES_FOLDER can be relative to the project directory
54
+ # or absolute. Note that you need to escape \ with a \ so in order to
55
+ # write \ use \\.
56
+ FILES_FOLDER = "./files"
57
+
58
+ # If you are importing files with an absolute path (eg
59
+ # m:\documents\readme.doc) then you probably wont have files at that
60
+ # location on the computer where "move-to-go run" is executed. Set
61
+ # FILES_FOLDER_AT_CUSTOMER to the folder where documents are stored at
62
+ # the customers site. Ie, in this example m:\documents.
63
+ # Note that you need to escape \ with a \ so in order to write \ use
64
+ # \\.
65
+ FILES_FOLDER_AT_CUSTOMER = "m:\\documents\\"
66
+
67
+ class Converter
68
+ # Reads a row from the Easy exported Company.txt
69
+ # and ads custom fields to the move-to-go organization.
70
+ # NOTE!!! You should customize this method to include
71
+ # and transform the fields you want to import to LIME Go.
72
+ # The method includes examples of different types of
73
+ # fields and how you should handle them.
74
+ # Sometimes it's enough to uncomment some code and
75
+ # change the row name but in most cases you need to
76
+ # do some thinking of your own.
77
+
78
+ def configure(rootmodel)
79
+ #####################################################################
80
+ ## LIME Go custom fields.
81
+ # This is how you add a custom field in LIME Go.
82
+ # Custom fields can be added to organization, deal and person.
83
+ # Valid types are :String and :Link. If no type is specified
84
+ # :String is used as default.
85
+
86
+ #rootmodel.settings.with_organization do |organization|
87
+ #organization.set_custom_field( { :integration_id => 'building_size', :title => 'Building Size', :type => :String } )
88
+ #end
89
+
90
+ # rootmodel.settings.with_person do |person|
91
+ # person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
92
+ # end
93
+
94
+ # rootmodel.settings.with_deal do |deal|
95
+ # assessment is default DealState::NoEndState
96
+ # deal.add_status( {:label => '1. Kvalificering' })
97
+ # deal.add_status( {:label => '2. Deal closed', :assessment => MoveToGo::DealState::PositiveEndState })
98
+ # deal.add_status( {:label => '4. Deal lost', :assessment => MoveToGo::DealState::NegativeEndState })
99
+ # end
100
+ end
101
+
102
+
103
+ def to_organization(organization, row)
104
+ # Here are some standard fields that are present
105
+ # on a LIME Go organization and are usually represented
106
+ # as superfields in Easy.
107
+
108
+ # organization.email = row['e-mail']
109
+ # organization.organization_number = row['orgnr']
110
+ # organization.web_site = row['website']
111
+
112
+ ####################################################################
113
+ ## Bisnode ID fields
114
+
115
+ # NOTE!!! If a bisnode-id is present you dont need to set
116
+ # fields like address or website since they are reterived from
117
+ # PAR.
118
+
119
+ # bisnode_id = row['Bisnode-id']
120
+
121
+ # if bisnode_id && !bisnode_id.empty?
122
+ # organization.with_source do |source|
123
+ # source.par_se(bisnode_id)
124
+ # end
125
+ # end
126
+
127
+ # If a company is missing a bisnode ID then you should do this
128
+ # in order to capture any possible data that is written manually
129
+ # on that company card.
130
+
131
+ # if bisnode_id && bisnode_id.empty?
132
+ # organization.web_site = row['website']
133
+ # end
134
+
135
+ ####################################################################
136
+ # Address fields.
137
+ # Addresses consists of several parts in LIME Go. Lots of other
138
+ # systems have the address all in one line, to be able to
139
+ # match when importing it is way better to split the addresses
140
+
141
+ # organization.with_postal_address do |address|
142
+ # address.street = row['street']
143
+ # address.zip_code = row['zip']
144
+ # address.city = row['city']
145
+ # address.location = row['location']
146
+ # end
147
+
148
+ # Same as visting address
149
+
150
+ # organization.with_visit_address do |addr|
151
+ # addr.street = row['visit street']
152
+ # addr.zip_code = row['visit zip']
153
+ # addr.city = row['visit city']
154
+ # end
155
+
156
+ #####################################################################
157
+ ## Tags.
158
+ # Set tags for the organization. All organizations will get
159
+ # the tag "import" automagically
160
+
161
+ # organization.set_tag("Guldkund")
162
+
163
+ #####################################################################
164
+ ## Option fields.
165
+ # Option fields are normally translated into tags
166
+ # The option field customer category for instance,
167
+ # has the options "A-customer", "B-customer", and "C-customer"
168
+
169
+ # organization.set_tag(row['customer category'])
170
+
171
+ #####################################################################
172
+ ## LIME Go Relation.
173
+ # let's say that there is a option field in Easy called 'Customer relation'
174
+ # with the options '1.Customer', '2.Prospect' '3.Partner' and '4.Lost customer'
175
+
176
+ # if row['Customer relation'] == '1.Customer'
177
+ # We have made a deal with this organization.
178
+ # organization.relation = MoveToGo::Relation::IsACustomer
179
+ # elsif row['Customer relation'] == '3.Partner'
180
+ # We have made a deal with this organization.
181
+ # organization.relation = MoveToGo::Relation::IsACustomer
182
+ # elsif row['Customer relation'] == '2.Prospect'
183
+ # Something is happening with this organization, we might have
184
+ # booked a meeting with them or created a deal, etc.
185
+ # organization.relation = MoveToGo::Relation::WorkingOnIt
186
+ # elsif row['Customer relation'] == '4.Lost customer'
187
+ # We had something going with this organization but we
188
+ # couldn't close the deal and we don't think they will be a
189
+ # customer to us in the foreseeable future.
190
+ # organization.relation = MoveToGo::Relation::BeenInTouch
191
+ # else
192
+ # organization.relation = MoveToGo::Relation::NoRelation
193
+ # end
194
+
195
+ return organization
196
+ end
197
+
198
+ # Reads a row from the Easy exported Company-Person.txt
199
+ # and ads custom fields to the move-to-go organization.
200
+
201
+ # NOTE!!! You should customize this method to include
202
+ # and transform the fields you want to import to LIME Go.
203
+ # The method includes examples of different types of
204
+ # fields and how you should handle them.
205
+ # Sometimes it's enough to uncomment some code and
206
+ # change the row name but in most cases you need to
207
+ # do some thinking of your own.
208
+ def to_person(person, row)
209
+ ## Here are some standard fields that are present
210
+ # on a LIME Go person and are usually represented
211
+ # as superfields in Easy.
212
+
213
+ # person.direct_phone_number = row['Direktnummer']
214
+ # person.mobile_phone_number = row['Mobil']
215
+ # person.email = row['e-mail']
216
+ # person.position = row['position']
217
+
218
+ #####################################################################
219
+ ## Tags.
220
+ # Set tags for the person
221
+ # person.set_tag("VIP")
222
+
223
+ #####################################################################
224
+ ## Checkbox fields.
225
+ # Checkbox fields are normally translated into tags
226
+ # Xmas card field is a checkbox in Easy
227
+
228
+ # if row['Xmas card'] == "1"
229
+ # person.set_tag("Xmas card")
230
+ # end
231
+
232
+ #####################################################################
233
+ ## Multioption fields or "Set"- fields.
234
+ # Set fields are normally translated into multiple tags in LIME Go
235
+ # interests is an example of a set field in LIME Easy.
236
+
237
+ # if row['intrests']
238
+ # intrests = row['intrests'].split(';')
239
+ # intrests.each do |intrest|
240
+ # person.set_tag(intrest)
241
+ # end
242
+ # end
243
+
244
+ #####################################################################
245
+ ## LIME Go custom fields.
246
+ # This is how you populate a LIME Go custom field that was created in
247
+ # the configure method.
248
+
249
+ # person.set_custom_value("shoe_size", row['shoe size'])
250
+
251
+ return person
252
+ end
253
+
254
+ # Reads a row from the Easy exported Project.txt
255
+ # and ads custom fields to the move-to-go organization.
256
+
257
+ # NOTE!!! You should customize this method to include
258
+ # and transform the fields you want to import to LIME Go.
259
+ # The method includes examples of different types of
260
+ # fields and how you should handle them.
261
+ # Sometimes it's enough to uncomment some code and
262
+ # change the row name but in most cases you need to
263
+ # do some thinking of your own.
264
+ def to_deal(deal, row)
265
+ ## Here are some standard fields that are present
266
+ # on a LIME Go deal and are usually represented
267
+ # as superfields in Easy.
268
+
269
+ # deal.order_date = row['order date']
270
+
271
+ # Deal.value should be integer
272
+ # The currency used in Easy should match the one used in Go
273
+
274
+ # deal.value = row['value']
275
+
276
+ # should be between 0 - 100
277
+ # remove everything that is not an intiger
278
+
279
+ # deal.probability = row['probability'].gsub(/[^\d]/,"").to_i unless row['probability'].nil?
280
+
281
+ # Sets the deal's status to the value of the Easy field. This
282
+ # assumes that the status is already created in LIME Go. To
283
+ # create statuses during import add them to the settings
284
+ # during configure.
285
+
286
+ # if !row['Status'].nil? && !row['Status'].empty?
287
+ # deal.status = row['Status']
288
+ # end
289
+
290
+ #####################################################################
291
+ ## Tags.
292
+ # Set tags for the deal
293
+
294
+ # deal.set_tag("Product name")
295
+
296
+ return deal
297
+ end
298
+
299
+ def get_history_classification_for_activity_on_company(activity)
300
+ # When notes are added to LIME Go this method is called for
301
+ # every note that is connected to a company in LIME Easy. The
302
+ # note's activity from LIME Easy is supplied as an argument
303
+ # and this method should return a classification for the note
304
+ # in LIME Go. The return value must be a value from the
305
+ # MoveToGo::HistoryClassification enum. If no classification is
306
+ # return the note will get the default classification 'Comment'
307
+
308
+ # case activity
309
+ # when 'SalesCall'
310
+ # classification = MoveToGo::HistoryClassification::SalesCall
311
+ # when 'Customer Visit'
312
+ # classification = MoveToGo::HistoryClassification::ClientVisit
313
+ # when 'No answer'
314
+ # classification = MoveToGo::HistoryClassification::TriedToReach
315
+ # else
316
+ # classification = MoveToGo::HistoryClassification::Comment
317
+ # end
318
+
319
+ # return classification
320
+ end
321
+
322
+ def get_history_classification_for_activity_on_project(activity)
323
+ # When histories are added to LIME Go this method is called for
324
+ # every history that is connected to a project in LIME Easy. The
325
+ # histories activity from LIME Easy is supplied as an argument
326
+ # and this method should return a classification for the history
327
+ # in LIME Go. The return value must be a value from the
328
+ # MoveToGo::HistoryClassification enum. If no classification is
329
+ # return the history will get the default classification 'Comment'
330
+
331
+ # case activity
332
+ # when 'Installation'
333
+ # classification = MoveToGo::HistoryClassification::ClientVisit
334
+ # when 'No answer'
335
+ # classification = MoveToGo::HistoryClassification::TriedToReach
336
+ # else
337
+ # classification = MoveToGo::HistoryClassification::Comment
338
+ # end
339
+
340
+ # return classification
341
+ end
342
+
343
+
344
+
345
+ # HOOKS
346
+ #
347
+ # Sometimes you need to add exra information to the rootmodel, this can be done
348
+ # with hooks, below is an example of an organization hook that adds a comment to
349
+ # an organization if a field has a specific value
350
+ #def organization_hook(row, organization, rootmodel)
351
+ # if not row['fieldname'].empty?
352
+ # comment = MoveToGo::Comment.new
353
+ # comment.text = row['fieldname']
354
+ # comment.organization = organization
355
+ # comment.created_by = rootmodel.migrator_coworker
356
+ # rootmodel.add_comment(comment)
357
+ # end
358
+ #end
359
+
360
+
361
+ end
362
+
@@ -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 full export from SalesForce to LIME Go.