go_import 3.0.42 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,11 +58,11 @@ def convert_source
58
58
  end
59
59
  end
60
60
 
61
- if defined?(NOTE_SHEET)
62
- if excel_workbook.has_sheet?(NOTE_SHEET)
63
- note_rows = excel_workbook.rows_for_sheet NOTE_SHEET
61
+ if defined?(HISTORY_SHEET)
62
+ if excel_workbook.has_sheet?(HISTORY_SHEET)
63
+ history_rows = excel_workbook.rows_for_sheet HISTORY_SHEET
64
64
  else
65
- puts "WARNING: can't find sheet '#{NOTE_SHEET}'"
65
+ puts "WARNING: can't find sheet '#{HISTORY_SHEET}'"
66
66
  end
67
67
  end
68
68
 
@@ -83,7 +83,7 @@ def convert_source
83
83
 
84
84
  # Now start to read data from the excel file and add to the
85
85
  # rootmodel. We begin with coworkers since they are referenced
86
- # from everywhere (orgs, deals, notes)
86
+ # from everywhere (orgs, deals, histories)
87
87
  if defined?(coworker_rows) && !coworker_rows.nil?
88
88
  puts "Trying to convert coworkers..."
89
89
  coworker_rows.each do |row|
@@ -119,12 +119,12 @@ def convert_source
119
119
  end
120
120
  end
121
121
 
122
- # Notes must be owned by a coworker and the be added to
123
- # organizations and notes and might refernce a person
124
- if defined?(note_rows) && !note_rows.nil?
125
- puts "Trying to convert notes..."
126
- note_rows.with_progress().each do |row|
127
- rootmodel.add_note(converter.to_note(row, rootmodel))
122
+ # History must be owned by a coworker and the be added to
123
+ # organizations and histories and might refernce a person
124
+ if defined?(history_rows) && !history_rows.nil?
125
+ puts "Trying to convert histories..."
126
+ history_rows.with_progress().each do |row|
127
+ rootmodel.add_history(converter.to_history(row, rootmodel))
128
128
  end
129
129
  end
130
130
 
@@ -15,7 +15,7 @@ COWORKER_SHEET = "Medarbetare"
15
15
  ORGANIZATION_SHEET = "Företag"
16
16
  PERSON_SHEET = "Kontaktperson"
17
17
  DEAL_SHEET = "Affär"
18
- NOTE_SHEET = "Anteckningar"
18
+ HISTORY_SHEET = "Anteckningar"
19
19
  FILE_SHEET = "Dokument"
20
20
 
21
21
  # Then you need to modify the script below according to the TODO
@@ -143,19 +143,19 @@ class Converter
143
143
  return person
144
144
  end
145
145
 
146
- def to_note(row, rootmodel)
147
- note = GoImport::Note.new()
146
+ def to_history(row, rootmodel)
147
+ history = GoImport::History.new()
148
148
 
149
149
  # *** TODO:
150
150
  #
151
- # Set note properties from the row.
151
+ # Set history properties from the row.
152
152
 
153
- note.organization = rootmodel.find_organization_by_integration_id(row['ID'])
154
- note.created_by = rootmodel.find_coworker_by_integration_id(row['Skapad av'])
155
- note.text = row['Text']
156
- note.date = row['Skapad den']
153
+ history.organization = rootmodel.find_organization_by_integration_id(row['ID'])
154
+ history.created_by = rootmodel.find_coworker_by_integration_id(row['Skapad av'])
155
+ history.text = row['Text']
156
+ history.date = row['Skapad den']
157
157
 
158
- return note
158
+ return history
159
159
  end
160
160
 
161
161
  def to_file(row, rootmodel)
@@ -173,15 +173,15 @@ class Converter
173
173
  # HOOKS
174
174
  #
175
175
  # Sometimes you need to add exra information to the rootmodel, this can be done
176
- # with hooks, below is an example of an organization hook that adds a note to
176
+ # with hooks, below is an example of an organization hook that adds a history to
177
177
  # an organization if a field has a specific value
178
178
  #def organization_hook(row, organization, rootmodel)
179
179
  # if not row['fieldname'].empty?
180
- # note = GoImport::Note.new
181
- # note.text = row['fieldname']
182
- # note.organization = organization
183
- # note.created_by = rootmodel.import_coworker
184
- # rootmodel.add_note(note)
180
+ # history = GoImport::History.new
181
+ # history.text = row['fieldname']
182
+ # history.organization = organization
183
+ # history.created_by = rootmodel.import_coworker
184
+ # rootmodel.add_history(history)
185
185
  # end
186
186
  #end
187
187
 
@@ -57,11 +57,11 @@ def convert_source
57
57
  end
58
58
  end
59
59
 
60
- if defined?(NOTE_SHEET)
61
- if excel_workbook.has_sheet?(NOTE_SHEET)
62
- note_rows = excel_workbook.rows_for_sheet NOTE_SHEET
60
+ if defined?(HISTORY_SHEET)
61
+ if excel_workbook.has_sheet?(HISTORY_SHEET)
62
+ history_rows = excel_workbook.rows_for_sheet HISTORY_SHEET
63
63
  else
64
- puts "WARNING: can't find sheet '#{NOTE_SHEET}'"
64
+ puts "WARNING: can't find sheet '#{HISTORY_SHEET}'"
65
65
  end
66
66
  end
67
67
 
@@ -82,7 +82,7 @@ def convert_source
82
82
 
83
83
  # Now start to read data from the excel file and add to the
84
84
  # rootmodel. We begin with coworkers since they are referenced
85
- # from everywhere (orgs, deals, notes)
85
+ # from everywhere (orgs, deals, histories)
86
86
  if defined?(coworker_rows) && !coworker_rows.nil?
87
87
  puts "Trying to convert coworkers..."
88
88
  coworker_rows.each do |row|
@@ -118,12 +118,12 @@ def convert_source
118
118
  end
119
119
  end
120
120
 
121
- # Notes must be owned by a coworker and the be added to
122
- # organizations and notes and might refernce a person
123
- if defined?(note_rows) && !note_rows.nil?
124
- puts "Trying to convert notes..."
125
- note_rows.each do |row|
126
- rootmodel.add_note(converter.to_note(row, rootmodel))
121
+ # histories must be owned by a coworker and the be added to
122
+ # organizations and histories and might refernce a person
123
+ if defined?(histories_rows) && !histories_rows.nil?
124
+ puts "Trying to convert history..."
125
+ history_rows.each do |row|
126
+ rootmodel.add_history(converter.to_history(row, rootmodel))
127
127
  end
128
128
  end
129
129
 
@@ -14,7 +14,7 @@ EXCEL_FILE = "Exempelfil.xlsx"
14
14
  COWORKER_SHEET = "Medarbetare"
15
15
  ORGANIZATION_SHEET = "Företag"
16
16
  PERSON_SHEET = "Kontaktperson"
17
- NOTE_SHEET = "Anteckningar"
17
+ HISTORY_SHEET = "Anteckningar"
18
18
 
19
19
  # Then you need to modify the script below according to the TODO
20
20
  # comments.
@@ -158,18 +158,18 @@ class Converter
158
158
  return person
159
159
  end
160
160
 
161
- def to_note(row, rootmodel)
162
- note = GoImport::Note.new()
161
+ def to_history(row, rootmodel)
162
+ history = GoImport::History.new()
163
163
 
164
164
  # *** TODO:
165
165
  #
166
- # Set note properties from the row.
166
+ # Set history properties from the row.
167
167
 
168
- note.organization = rootmodel.find_organization_by_integration_id(row['Kundnummer/FöretagsID'])
169
- note.created_by = rootmodel.find_coworker_by_integration_id(row['Skapad av medarbetare'])
170
- note.text = row['Textanteckningar/Historik']
171
- note.date = row['Skapad den']
168
+ history.organization = rootmodel.find_organization_by_integration_id(row['Kundnummer/FöretagsID'])
169
+ history.created_by = rootmodel.find_coworker_by_integration_id(row['Skapad av medarbetare'])
170
+ history.text = row['Textanteckningar/Historik']
171
+ history.date = row['Skapad den']
172
172
 
173
- return note
173
+ return history
174
174
  end
175
175
  end
@@ -7,12 +7,12 @@ require_relative("../converter")
7
7
  EXPORT_FOLDER = 'export'
8
8
  COWORKER_FILE = "#{EXPORT_FOLDER}/User.txt"
9
9
  ORGANIZATION_FILE = "#{EXPORT_FOLDER}/Company.txt"
10
- ORGANIZATION_NOTE_FILE = "#{EXPORT_FOLDER}/Company-History.txt"
10
+ ORGANIZATION_HISTORY_FILE = "#{EXPORT_FOLDER}/Company-History.txt"
11
11
  ORGANIZATION_DOCUMENT_FILE = "#{EXPORT_FOLDER}/Company-Document.txt"
12
12
  PERSON_FILE = "#{EXPORT_FOLDER}/Company-Person.txt"
13
13
  INCLUDE_FILE = "#{EXPORT_FOLDER}/Project-Included.txt"
14
14
  DEAL_FILE = "#{EXPORT_FOLDER}/Project.txt"
15
- DEAL_NOTE_FILE = "#{EXPORT_FOLDER}/Project-History.txt"
15
+ DEAL_HISTORY_FILE = "#{EXPORT_FOLDER}/Project-History.txt"
16
16
  PROJECT_DOCUMENT_FILE = "#{EXPORT_FOLDER}/Project-Document.txt"
17
17
 
18
18
  def convert_source
@@ -56,10 +56,10 @@ def convert_source
56
56
  converter.to_person(person, row)
57
57
  end
58
58
 
59
- # organization notes
60
- process_rows(" - Reading Organization Notes '#{ORGANIZATION_NOTE_FILE}'", ORGANIZATION_NOTE_FILE) do |row|
59
+ # organization histories
60
+ process_rows(" - Reading Organization History '#{ORGANIZATION_HISTORY_FILE}'", ORGANIZATION_HISTORY_FILE) do |row|
61
61
  # adds itself if applicable
62
- rootmodel.add_note(to_organization_note(converter, row, rootmodel))
62
+ rootmodel.add_history(to_organization_history(converter, row, rootmodel))
63
63
  end
64
64
 
65
65
  # Organization - Deal connection
@@ -77,10 +77,10 @@ def convert_source
77
77
  rootmodel.add_deal(converter.to_deal(deal, row))
78
78
  end
79
79
 
80
- # deal notes
81
- process_rows(" - Reading Deal Notes '#{DEAL_NOTE_FILE}'", DEAL_NOTE_FILE) do |row|
80
+ # deal histories
81
+ process_rows(" - Reading Deal Histories '#{DEAL_HISTORY_FILE}'", DEAL_HISTORY_FILE) do |row|
82
82
  # adds itself if applicable
83
- rootmodel.add_note(to_deal_note(converter, row, rootmodel))
83
+ rootmodel.add_history(to_deal_history(converter, row, rootmodel))
84
84
  end
85
85
 
86
86
  # documents
@@ -152,37 +152,37 @@ end
152
152
 
153
153
  # Turns a row from the Easy exported Company-History.txt file into
154
154
  # a go_import model that is used to generate xml.
155
- def to_organization_note(converter, row, rootmodel)
155
+ def to_organization_history(converter, row, rootmodel)
156
156
  organization = rootmodel.find_organization_by_integration_id(row['idCompany'])
157
157
  coworker = rootmodel.find_coworker_by_integration_id(row['idUser'])
158
158
 
159
159
  if organization && coworker
160
- note = GoImport::Note.new()
161
- note.organization = organization
162
- note.created_by = coworker
163
- note.person = organization.find_employee_by_integration_id(row['idPerson'])
164
- note.date = row['Date']
160
+ history = GoImport::History.new()
161
+ history.organization = organization
162
+ history.created_by = coworker
163
+ history.person = organization.find_employee_by_integration_id(row['idPerson'])
164
+ history.date = row['Date']
165
165
 
166
- if converter.respond_to?(:get_note_classification_for_activity_on_company)
167
- # we will get an InvalidNoteClassificationError if we are
166
+ if converter.respond_to?(:get_history_classification_for_activity_on_company)
167
+ # we will get an InvalidHistoryClassificationError if we are
168
168
  # setting and invalid classification. So no need to verify
169
169
  # return value from converter.
170
170
  classification =
171
- converter.get_note_classification_for_activity_on_company(row['Category'])
171
+ converter.get_history_classification_for_activity_on_company(row['Category'])
172
172
 
173
173
  if classification.nil?
174
- classification = GoImport::NoteClassification::Comment
174
+ classification = GoImport::HistoryClassification::Comment
175
175
  end
176
176
 
177
- note.classification = classification
177
+ history.classification = classification
178
178
 
179
- note.text = row['History']
179
+ history.text = row['History']
180
180
  else
181
- note.classification = GoImport::NoteClassification::Comment
182
- note.text = "#{row['Category']}: #{row['History']}"
181
+ history.classification = GoImport::HistoryClassification::Comment
182
+ history.text = "#{row['Category']}: #{row['History']}"
183
183
  end
184
184
 
185
- return note.text.empty? ? nil : note
185
+ return history.text.empty? ? nil : history
186
186
  end
187
187
 
188
188
  return nil
@@ -257,7 +257,7 @@ end
257
257
 
258
258
  # Turns a row from the Easy exported Project-History.txt file into
259
259
  # a go_import model that is used to generate xml
260
- def to_deal_note(converter, row, rootmodel)
260
+ def to_deal_history(converter, row, rootmodel)
261
261
  # TODO: This could be improved to read a person from an
262
262
  # organization connected to this deal if any, but since it is
263
263
  # a many to many connection between organizations and deals
@@ -266,34 +266,34 @@ def to_deal_note(converter, row, rootmodel)
266
266
  coworker = rootmodel.find_coworker_by_integration_id(row['idUser'])
267
267
 
268
268
  if deal && coworker
269
- note = GoImport::Note.new()
270
- note.deal = deal
271
- note.created_by = coworker
272
- note.date = row['Date']
269
+ history = GoImport::History.new()
270
+ history.deal = deal
271
+ history.created_by = coworker
272
+ history.date = row['Date']
273
273
  # Raw history looks like this <category>: <person>: <text>
274
- note.text = row['RawHistory']
274
+ history.text = row['RawHistory']
275
275
 
276
- if converter.respond_to?(:get_note_classification_for_activity_on_project)
277
- # we will get an InvalidNoteClassificationError if we are
276
+ if converter.respond_to?(:get_history_classification_for_activity_on_project)
277
+ # we will get an InvalidHistoryClassificationError if we are
278
278
  # setting and invalid classification. So no need to verify
279
279
  # return value from converter.
280
280
 
281
281
  classification =
282
- converter.get_note_classification_for_activity_on_project(row['Category'])
282
+ converter.get_history_classification_for_activity_on_project(row['Category'])
283
283
 
284
284
  if classification.nil?
285
- classification = GoImport::NoteClassification::Comment
285
+ classification = GoImport::HistoryClassification::Comment
286
286
  end
287
287
 
288
- note.classification = classification
289
- note.text = row['RawHistory'].to_s.sub("#{row['Category']}:", "")
288
+ history.classification = classification
289
+ history.text = row['RawHistory'].to_s.sub("#{row['Category']}:", "")
290
290
  else
291
- note.classification = GoImport::NoteClassification::Comment
292
- note.text = row['RawHistory']
291
+ history.classification = GoImport::HistoryClassification::Comment
292
+ history.text = row['RawHistory']
293
293
  end
294
294
 
295
295
 
296
- return note.text.empty? ? nil : note
296
+ return history.text.empty? ? nil : history
297
297
  end
298
298
 
299
299
  return nil
@@ -338,11 +338,11 @@ end
338
338
  def make_sure_database_has_been_exported()
339
339
  return File.exists?(COWORKER_FILE) &&
340
340
  File.exists?(ORGANIZATION_FILE) &&
341
- File.exists?(ORGANIZATION_NOTE_FILE) &&
341
+ File.exists?(ORGANIZATION_HISTORY_FILE) &&
342
342
  File.exists?(ORGANIZATION_DOCUMENT_FILE) &&
343
343
  File.exists?(PERSON_FILE) &&
344
344
  File.exists?(INCLUDE_FILE) &&
345
345
  File.exists?(DEAL_FILE) &&
346
- File.exists?(DEAL_NOTE_FILE) &&
346
+ File.exists?(DEAL_HISTORY_FILE) &&
347
347
  File.exists?(PROJECT_DOCUMENT_FILE)
348
348
  end
@@ -296,45 +296,45 @@ class Converter
296
296
  return deal
297
297
  end
298
298
 
299
- def get_note_classification_for_activity_on_company(activity)
299
+ def get_history_classification_for_activity_on_company(activity)
300
300
  # When notes are added to LIME Go this method is called for
301
301
  # every note that is connected to a company in LIME Easy. The
302
302
  # note's activity from LIME Easy is supplied as an argument
303
303
  # and this method should return a classification for the note
304
304
  # in LIME Go. The return value must be a value from the
305
- # GoImport::NoteClassification enum. If no classification is
305
+ # GoImport::HistoryClassification enum. If no classification is
306
306
  # return the note will get the default classification 'Comment'
307
307
 
308
308
  # case activity
309
309
  # when 'SalesCall'
310
- # classification = GoImport::NoteClassification::SalesCall
310
+ # classification = GoImport::HistoryClassification::SalesCall
311
311
  # when 'Customer Visit'
312
- # classification = GoImport::NoteClassification::ClientVisit
312
+ # classification = GoImport::HistoryClassification::ClientVisit
313
313
  # when 'No answer'
314
- # classification = GoImport::NoteClassification::TriedToReach
314
+ # classification = GoImport::HistoryClassification::TriedToReach
315
315
  # else
316
- # classification = GoImport::NoteClassification::Comment
316
+ # classification = GoImport::HistoryClassification::Comment
317
317
  # end
318
318
 
319
319
  # return classification
320
320
  end
321
321
 
322
- def get_note_classification_for_activity_on_project(activity)
323
- # When notes are added to LIME Go this method is called for
324
- # every note that is connected to a project in LIME Easy. The
325
- # note's activity from LIME Easy is supplied as an argument
326
- # and this method should return a classification for the note
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
327
  # in LIME Go. The return value must be a value from the
328
- # GoImport::NoteClassification enum. If no classification is
329
- # return the note will get the default classification 'Comment'
328
+ # GoImport::HistoryClassification enum. If no classification is
329
+ # return the history will get the default classification 'Comment'
330
330
 
331
331
  # case activity
332
332
  # when 'Installation'
333
- # classification = GoImport::NoteClassification::ClientVisit
333
+ # classification = GoImport::HistoryClassification::ClientVisit
334
334
  # when 'No answer'
335
- # classification = GoImport::NoteClassification::TriedToReach
335
+ # classification = GoImport::HistoryClassification::TriedToReach
336
336
  # else
337
- # classification = GoImport::NoteClassification::Comment
337
+ # classification = GoImport::HistoryClassification::Comment
338
338
  # end
339
339
 
340
340
  # return classification
@@ -345,15 +345,15 @@ class Converter
345
345
  # HOOKS
346
346
  #
347
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 note to
348
+ # with hooks, below is an example of an organization hook that adds a history to
349
349
  # an organization if a field has a specific value
350
350
  #def organization_hook(row, organization, rootmodel)
351
351
  # if not row['fieldname'].empty?
352
- # note = GoImport::Note.new
353
- # note.text = row['fieldname']
354
- # note.organization = organization
355
- # note.created_by = rootmodel.import_coworker
356
- # rootmodel.add_note(note)
352
+ # history = GoImport::History.new
353
+ # history.text = row['fieldname']
354
+ # history.organization = organization
355
+ # history.created_by = rootmodel.import_coworker
356
+ # rootmodel.add_history(history)
357
357
  # end
358
358
  #end
359
359
 
@@ -132,15 +132,15 @@ def convert_source
132
132
  puts "Deals are not imported. To enable set IMPORT_DEALS = true in converter.rb."
133
133
  end
134
134
 
135
- if defined?(IMPORT_NOTES) && IMPORT_NOTES == true
135
+ if defined?(IMPORT_HISTORY) && IMPORT_HISTORY == true
136
136
  con.fetch_data 'history' do |row|
137
- note = converter.to_note(init_note(row, con.get_class_by_name('history'), rootmodel), row)
138
- #if !note.organization.nil? || !note.person.nil?
139
- rootmodel.add_note(note)
137
+ history = converter.to_history(init_history(row, con.get_class_by_name('history'), rootmodel), row)
138
+ #if !history.organization.nil? || !history.person.nil?
139
+ rootmodel.add_history(history)
140
140
  #end
141
141
  end
142
142
  else
143
- puts "Notes/history is not imported. To enable set IMPORT_NOTES = true in converter.rb."
143
+ puts "History is not imported. To enable set IMPORT_HISTORY = true in converter.rb."
144
144
  end
145
145
 
146
146
  """
@@ -258,27 +258,27 @@ def init_deal(row, table, rootmodel)
258
258
  return deal
259
259
  end
260
260
 
261
- def init_note(row, table, rootmodel)
262
- note = GoImport::Note.new
261
+ def init_history(row, table, rootmodel)
262
+ history = GoImport::History.new
263
263
 
264
- note.integration_id = row['idhistory'].to_s
264
+ history.integration_id = row['idhistory'].to_s
265
265
 
266
- coworker = rootmodel.find_coworker_by_integration_id(row[NOTE_COWORKER_FIELD].to_s)
267
- note.created_by = coworker if coworker
266
+ coworker = rootmodel.find_coworker_by_integration_id(row[HISTORY_COWORKER_FIELD].to_s)
267
+ history.created_by = coworker if coworker
268
268
 
269
- organization = rootmodel.find_organization_by_integration_id(row[NOTE_COMPANY_FIELD].to_s)
270
- note.organization = organization if organization
269
+ organization = rootmodel.find_organization_by_integration_id(row[HISTORY_COMPANY_FIELD].to_s)
270
+ history.organization = organization if organization
271
271
 
272
- person = rootmodel.find_person_by_integration_id(row[NOTE_PERSON_FIELD].to_s)
273
- note.person = person if person
272
+ person = rootmodel.find_person_by_integration_id(row[HISTORY_PERSON_FIELD].to_s)
273
+ history.person = person if person
274
274
 
275
- deal = rootmodel.find_deal_by_integration_id(row[NOTE_DEAL_FIELD].to_s)
276
- note.deal = deal if deal
275
+ deal = rootmodel.find_deal_by_integration_id(row[HISTORY_DEAL_FIELD].to_s)
276
+ history.deal = deal if deal
277
277
 
278
- note.text = table.get_value_for_field_with_label(row, FieldLabel::Notes)
279
- note.date = table.get_value_for_field_with_label(row, FieldLabel::StartDate)
278
+ history.text = table.get_value_for_field_with_label(row, FieldLabel::historys)
279
+ history.date = table.get_value_for_field_with_label(row, FieldLabel::StartDate)
280
280
 
281
- return note
281
+ return history
282
282
  end
283
283
 
284
284
 
@@ -55,11 +55,11 @@ DEAL_COMPANY_FIELD = 'company'
55
55
  # Notes
56
56
  # Set if notes should be imported and name of relationfields.
57
57
  # Defaults should work well
58
- IMPORT_NOTES = true
59
- NOTE_COWORKER_FIELD = 'coworker'
60
- NOTE_COMPANY_FIELD = 'company'
61
- NOTE_PERSON_FIELD = 'person'
62
- NOTE_DEAL_FIELD = 'business'
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
63
 
64
64
  ############################################################################
65
65
 
@@ -325,7 +325,7 @@ class Converter
325
325
  end
326
326
 
327
327
  # Reads a row from the History table
328
- # and ads custom fields to the go_import note.
328
+ # and ads custom fields to the go_import history.
329
329
 
330
330
  # NOTE!!! You should customize this method to include
331
331
  # and transform the fields you want to import to LIME Go.
@@ -334,26 +334,26 @@ class Converter
334
334
  # Sometimes it's enough to uncomment some code and
335
335
  # change the row name but in most cases you need to
336
336
  # do some thinking of your own.
337
- def to_note(note, row)
337
+ def to_history(history, row)
338
338
 
339
- # note.text = row['text']
339
+ # history.text = row['text']
340
340
 
341
- # Set the note classification. The value must be a value from the
342
- # GoImport::NoteClassification enum. If no classification is
343
- # set the note will get the default classification 'Comment'
341
+ # Set the history classification. The value must be a value from the
342
+ # GoImport::HistoryClassification enum. If no classification is
343
+ # set the history will get the default classification 'Comment'
344
344
 
345
345
  # case row['type']
346
346
  # when 'Sales call'
347
- # note.classification = GoImport::NoteClassification::SalesCall
347
+ # history.classification = GoImport::HistoryClassification::SalesCall
348
348
  # when 'Customer Visit'
349
- # note.classification = GoImport::NoteClassification::ClientVisit
349
+ # history.classification = GoImport::historyClassification::ClientVisit
350
350
  # when 'No answer'
351
- # note.classification = GoImport::NoteClassification::TriedToReach
351
+ # history.classification = GoImport::HistoryClassification::TriedToReach
352
352
  # else
353
- # note.classification = GoImport::NoteClassification::Comment
353
+ # history.classification = GoImport::HistoryClassification::Comment
354
354
  # end
355
355
 
356
- return note
356
+ return history
357
357
  end
358
358
 
359
359
 
@@ -380,15 +380,15 @@ class Converter
380
380
  # HOOKS
381
381
  #
382
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 note to
383
+ # with hooks, below is an example of an organization hook that adds a history to
384
384
  # an organization if a field has a specific value
385
385
  #def organization_hook(row, organization, rootmodel)
386
386
  # if not row['fieldname'].empty?
387
- # note = GoImport::Note.new
388
- # note.text = row['fieldname']
389
- # note.organization = organization
390
- # note.created_by = rootmodel.import_coworker
391
- # rootmodel.add_note(note)
387
+ # history = GoImport::History.new
388
+ # history.text = row['fieldname']
389
+ # history.organization = organization
390
+ # history.created_by = rootmodel.import_coworker
391
+ # rootmodel.add_history(history)
392
392
  # end
393
393
  #end
394
394
 
@@ -267,25 +267,25 @@ def to_deal(row, rootmodel, converter)
267
267
  return deal
268
268
  end
269
269
 
270
- def to_note(row, rootmodel)
270
+ def to_history(row, rootmodel)
271
271
  if row['IsDeleted'] != '0'
272
272
  return nil
273
273
  end
274
274
 
275
- note = GoImport::Note.new
275
+ history = GoImport::History.new
276
276
 
277
- note.integration_id = row['Id']
278
- note.text = row['Title'] + ' ' + row['Body']
277
+ history.integration_id = row['Id']
278
+ history.text = row['Title'] + ' ' + row['Body']
279
279
 
280
- note.date = row['CreatedDate']
280
+ history.date = row['CreatedDate']
281
281
 
282
- note.created_by = rootmodel.find_coworker_by_integration_id(row['CreatedById'])
283
- note.organization = rootmodel.find_organization_by_integration_id(row['AccountId'])
282
+ history.created_by = rootmodel.find_coworker_by_integration_id(row['CreatedById'])
283
+ history.organization = rootmodel.find_organization_by_integration_id(row['AccountId'])
284
284
 
285
285
  # TODO: we should probably set the classification in the same was
286
286
  # a a deal's status is set.
287
287
 
288
- return note
288
+ return history
289
289
  end
290
290
 
291
291
  def add_opportunity_stages_as_deal_status_to_model(rootmodel)
@@ -389,9 +389,9 @@ def convert_source
389
389
  rootmodel.add_deal(to_deal(row, rootmodel, converter))
390
390
  end
391
391
 
392
- puts "Trying to import notes..."
392
+ puts "Trying to import history..."
393
393
  process_rows(NOTE_FILE) do |row|
394
- rootmodel.add_note(to_note(row, rootmodel))
394
+ rootmodel.add_history(to_history(row, rootmodel))
395
395
  end
396
396
  end
397
397
 
@@ -98,15 +98,15 @@ class Converter
98
98
  # HOOKS
99
99
  #
100
100
  # Sometimes you need to add exra information to the rootmodel, this can be done
101
- # with hooks, below is an example of an organization hook that adds a note to
101
+ # with hooks, below is an example of an organization hook that adds a history to
102
102
  # an organization if a field has a specific value
103
103
  #def organization_hook(row, organization, rootmodel)
104
104
  # if not row['fieldname'].empty?
105
- # note = GoImport::Note.new
106
- # note.text = row['fieldname']
107
- # note.organization = organization
108
- # note.created_by = rootmodel.import_coworker
109
- # rootmodel.add_note(note)
105
+ # history = GoImport::History.new
106
+ # history.text = row['fieldname']
107
+ # history.organization = organization
108
+ # history.created_by = rootmodel.import_coworker
109
+ # rootmodel.add_history(history)
110
110
  # end
111
111
  #end
112
112