kuali_toolbox 0.30 → 0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 564392095ff5166b7637d290d9cc47c252152ec7
4
- data.tar.gz: 688dc11bb6e722a1d659343eee03ce09c4de31e1
3
+ metadata.gz: 61426bf943a693faacbdd6e65b107492979b22ec
4
+ data.tar.gz: e83c477f4620573a79375250ea88c15f60182ec9
5
5
  SHA512:
6
- metadata.gz: 2ce2e112072f920778f1dceae3385a772b1d8384aab7f99f9ada956dff1a574ffed4dac121e38132f9fc4f07cd68ca63c31f6f5887312bc2d49a4883bfae448f
7
- data.tar.gz: 8fb83d65016d3d23badda6fb57286a394be2c9426e9245d5e15dd31ed22ba01bcf50beee43ef71ff7b7b4f84b3784477ab0c2f1c0925651c48359e904c71ed8a
6
+ metadata.gz: 8e29fae6e9c6caa6ef52a7021c875e9d900b213b2dcc743b61d2ef865c64a48a2127b70470a8d757c15615fd751dbd43b33e4d09c5bc6ea8ee5001b45a5b4cb6
7
+ data.tar.gz: ecd14a53bc9403fd4eb49fd6aa952a3dec074827e1a0c501b813a3ae96a88281b79faeaf2a8c30f54930328cc8a8e3b89cfaf9618d97c305ee6ae7bcf53c446f
@@ -79,13 +79,243 @@ def self.parse_command_line_options(
79
79
  return opt
80
80
  end
81
81
 
82
+
83
+ def buildName(row)
84
+ nm = {}
85
+ nm_typ_cd = GRM.parse_name_code row[:nm_typ_cd]
86
+ prefix_nm = GRM.parse_prefix row[:prefix_nm]
87
+ first_nm = ETL.parse_string row[:first_nm], length: 40, name: 'FIRST_NM'
88
+ middle_nm = ETL.parse_string row[:middle_nm], length: 40, name: 'MIDDLE_NM'
89
+ last_nm = ETL.parse_string row[:last_nm], length: 80, name: 'LAST_NM'
90
+ suffix_nm = GRM.parse_suffix row[:suffix_nm]
91
+ title_nm = ETL.parse_string row[:title_nm], length: 20, name: 'TITLE_NM'
92
+ nm[:nameCode] = nm_typ_cd unless nm_typ_cd.empty?
93
+ nm[:prefix] = prefix_nm unless prefix_nm.empty?
94
+ nm[:firstName] = first_nm unless first_nm.empty?
95
+ nm[:middleName] = middle_nm unless middle_nm.empty?
96
+ nm[:lastName] = last_nm unless last_nm.empty?
97
+ nm[:suffix] = suffix_nm unless suffix_nm.empty?
98
+ nm[:title] = title_nm unless title_nm.empty?
99
+ nm[:default] = true
100
+ nm[:active] = true
101
+ return nm.empty? ? nil : nm
102
+ end
103
+
104
+ def buildExtendedAttributes(row)
105
+ ea = {}
106
+ visa_type = ETL.parse_string( row[:visa_type], length: 30, name: 'VISA_TYPE' )
107
+ county = ETL.parse_string( row[:county], length: 30, name: 'COUNTY' )
108
+ age_by_fiscal_year = ETL.parse_integer( row[:age_by_fiscal_year], length: 3, name: 'AGE_BY_FISCAL_YEAR' )
109
+ race = ETL.parse_string( row[:race], length: 30, name: 'RACE' )
110
+ education_level = ETL.parse_string( row[:education_level], length: 30, name: 'EDUCATION_LEVEL' )
111
+ degree = GRM.parse_degree( row[:degree], name: 'DEGREE' )
112
+ major = ETL.parse_string( row[:major], length: 30, name: 'MAJOR' )
113
+ is_handicapped = ETL.parse_boolean( row[:is_handicapped], name: 'IS_HANDICAPPED' )
114
+ handicap_type = ETL.parse_string( row[:handicap_type], length: 30, name: 'HANDICAP_TYPE' )
115
+ is_veteran = ETL.parse_boolean( row[:is_veteran], name: 'IS_VETERAN' )
116
+ veteran_type = ETL.parse_string( row[:veteran_type], length: 30, name: 'VETERAN_TYPE' )
117
+ has_visa = ETL.parse_boolean( row[:has_visa], name: 'HAS_VISA' )
118
+ visa_code = ETL.parse_string( row[:visa_code], length: 20, name: 'VISA_CODE' )
119
+ visa_renewal_date = ETL.parse_string( row[:visa_renewal_date], length: 19, name: 'VISA_RENEWAL_DATE' )
120
+ office_location = ETL.parse_string( row[:office_location], length: 30, name: 'OFFICE_LOCATION' )
121
+ secondry_office_location = ETL.parse_string( row[:secondry_office_location], length: 30, name: 'SECONDRY_OFFICE_LOCATION' )
122
+ school = ETL.parse_string( row[:school], length: 50, name: 'SCHOOL' )
123
+ year_graduated = GRM.parse_year( row[:year_graduated], name: 'YEAR_GRADUATED' )
124
+ directory_department = ETL.parse_string( row[:directory_department], length: 30, name: 'DIRECTORY_DEPARTMENT' )
125
+ directory_title = ETL.parse_string( row[:directory_title], length: 50, name: 'DIRECTORY_TITLE', strict: false )
126
+ primary_title = ETL.parse_string( row[:primary_title], length: 51, name: 'PRIMARY_TITLE', strict: false )
127
+ vacation_accural = ETL.parse_boolean( row[:vacation_accural], name: 'VACATION_ACCURAL' )
128
+ is_on_sabbatical = ETL.parse_boolean( row[:is_on_sabbatical], name: 'IS_ON_SABBATICAL' )
129
+ id_provided = ETL.parse_string( row[:id_provided], length: 30, name: 'ID_PROVIDED' )
130
+ id_verified = ETL.parse_string( row[:id_verified], length: 30, name: 'ID_VERIFIED' )
131
+ citizenship_type_code = GRM.parse_citizenship_type( row[:citizenship_type_code] )
132
+ multi_campus_principal_id = ETL.parse_string( row[:multi_campus_principal_id], length: 40, name: 'MULTI_CAMPUS_PRINCIPAL_ID' )
133
+ multi_campus_principal_name = ETL.parse_string( row[:multi_campus_principal_name], length: 100, name: 'MULTI_CAMPUS_PRINCIPAL_NAME' )
134
+ salary_anniversary_date = ETL.parse_string( row[:salary_anniversary_date], length: 10, name: 'SALARY_ANNIVERSARY_DATE' )
135
+ ea[:visaType] = visa_type unless visa_type.empty?
136
+ ea[:county] = county unless county.empty?
137
+ ea[:ageByFiscalYear] = age_by_fiscal_year unless age_by_fiscal_year.nil?
138
+ ea[:race] = race unless race.empty?
139
+ ea[:educationLevel] = education_level unless education_level.empty?
140
+ ea[:degree] = degree unless degree.empty?
141
+ ea[:major] = major unless major.empty?
142
+ ea[:handicapped] = is_handicapped unless is_handicapped.nil?
143
+ ea[:handicapType] = handicap_type unless handicap_type.empty?
144
+ ea[:veteran] = is_veteran unless is_veteran.nil?
145
+ ea[:veteranType] = veteran_type unless veteran_type.empty?
146
+ ea[:visa] = has_visa unless has_visa.nil?
147
+ ea[:visaCode] = visa_code unless visa_code.empty?
148
+ ea[:visaRenewalDate] = visa_renewal_date unless visa_renewal_date.empty?
149
+ ea[:officeLocation] = office_location unless office_location.empty?
150
+ ea[:secondaryOfficeLocation] = secondry_office_location unless secondry_office_location.empty?
151
+ ea[:school] = school unless school.empty?
152
+ ea[:yearGraduated] = year_graduated unless year_graduated.empty?
153
+ ea[:directoryDepartment] = directory_department unless directory_department.empty?
154
+ ea[:directoryTitle] = directory_title unless directory_title.empty?
155
+ ea[:primaryTitle] = primary_title unless primary_title.empty?
156
+ ea[:vacationAccrual] = vacation_accural unless vacation_accural.nil?
157
+ ea[:onSabbatical] = is_on_sabbatical unless is_on_sabbatical.nil?
158
+ ea[:idProvided] = id_provided unless id_provided.empty?
159
+ ea[:idVerified] = id_verified unless id_verified.empty?
160
+ ea[:citizenshipType] = citizenship_type_code unless citizenship_type_code.empty?
161
+ ea[:multiCampusPrincipalId] = multi_campus_principal_id unless multi_campus_principal_id.empty?
162
+ ea[:multiCampusPrincipalName] = multi_campus_principal_name unless multi_campus_principal_name.empty?
163
+ ea[:salaryAnniversaryDate] = salary_anniversary_date unless salary_anniversary_date.empty?
164
+ return ea
165
+ end
166
+
167
+ def buildAffiliations(row)
168
+ aff = {}
169
+ afltn_typ_cd = ETL.parse_string row[:afltn_typ_cd], name: 'AFLTN_TYP_CD', length: 40, required: true
170
+ campus = ETL.parse_string row[:campus_cd], name: 'CAMPUS_CD', length: 2
171
+ aff[:affiliationType] = afltn_typ_cd unless afltn_typ_cd.empty?
172
+ aff[:campus] = campus unless campus.empty?
173
+ aff[:default] = true
174
+ aff[:active] = true
175
+
176
+ emp = {}
177
+ emp_stat_cd = GRM.parse_emp_stat_cd row[:emp_stat_cd]
178
+ emp_typ_cd = GRM.parse_emp_typ_cd row[:emp_typ_cd]
179
+ base_slry_amt = ETL.parse_float row[:base_slry_amt], length: 15, name: 'BASE_SLRY_AMT'
180
+ prmry_dept_cd = ETL.parse_string row[:prmry_dept_cd], length: 40, name: 'PRMRY_DEPT_CD'
181
+ emp_id = ETL.parse_string row[:emp_id], length: 40, name: 'EMP_ID'
182
+ emp[:employeeStatus] = emp_stat_cd unless emp_stat_cd.empty?
183
+ emp[:employeeType] = emp_typ_cd unless emp_typ_cd.empty?
184
+ emp[:baseSalaryAmount] = base_slry_amt unless base_slry_amt.nil?
185
+ emp[:primaryDepartment] = prmry_dept_cd unless prmry_dept_cd.empty?
186
+ emp[:employeeId] = emp_id unless emp_id.empty?
187
+ emp[:primaryEmployment] = true
188
+
189
+ if (!emp.empty?)
190
+ aff[:employment] = []
191
+ aff[:employment].push(emp);
192
+ end
193
+ return aff.empty? ? nil : aff
194
+ end
195
+
196
+ def buildAddress(row)
197
+ address = {}
198
+ addr_typ_cd = GRM.parse_address_type_code( row[:addr_typ_cd] )
199
+ addr_line_1 = ETL.parse_string( row[:addr_line_1], name: 'ADDR_LINE_1', length: 45 )
200
+ addr_line_2 = ETL.parse_string( row[:addr_line_2], name: 'ADDR_LINE_2', length: 45 )
201
+ addr_line_3 = ETL.parse_string( row[:addr_line_3], name: 'ADDR_LINE_3', length: 45 )
202
+ city = ETL.parse_string( row[:city], name: 'CITY', length: 30 )
203
+ state_pvc_cd = ETL.parse_string( row[:state_pvc_cd], name: 'STATE_PVC_CD', length: 2 )
204
+ postal_cd = ETL.parse_string( row[:postal_cd], name: 'POSTAL_CD', length: 20 )
205
+ postal_cntry_cd = ETL.parse_string( row[:postal_cntry_cd], name: 'POSTAL_CNTRY_CD', length: 2 )
206
+ address[:addressTypeCode] = addr_typ_cd unless addr_typ_cd.empty?
207
+ address[:addressLine1] = addr_line_1 unless addr_line_1.empty?
208
+ address[:addressLine2] = addr_line_2 unless addr_line_2.empty?
209
+ address[:addressLine3] = addr_line_3 unless addr_line_3.empty?
210
+ address[:city] = city unless city.empty?
211
+ address[:stateOrProvince] = state_pvc_cd unless state_pvc_cd.empty?
212
+ address[:postalCode] = postal_cd unless postal_cd.empty?
213
+ address[:country] = postal_cntry_cd unless postal_cntry_cd.empty?
214
+ address[:default] = true
215
+ return address.empty? ? nil : address
216
+ end
217
+
218
+ def buildPhone(row)
219
+ ph = {}
220
+ phone_typ_cd = GRM.parse_phone_type row[:phone_typ_cd]
221
+ phone_nbr = GRM.parse_phone_number row[:phone_nbr]
222
+ phone_extn_nbr = ETL.parse_string row[:phone_extn_nbr], length: 8, name: 'PHONE_EXTN_NBR'
223
+ phone_cntry_cd = ETL.parse_string row[:phone_cntry_cd], length: 2, name: 'PHONE_CNTRY_CD'
224
+ ph[:phoneType] = phone_typ_cd unless phone_typ_cd.empty?
225
+ ph[:phoneNumber] = phone_nbr unless phone_nbr.empty?
226
+ ph[:extension] = phone_extn_nbr unless phone_extn_nbr.empty?
227
+ ph[:country] = phone_cntry_cd unless phone_cntry_cd.empty?
228
+ ph[:default] = true
229
+ ph[:active] = true
230
+ return ph.empty? ? nil : ph
231
+ end
232
+
233
+ def buildAppointment(row)
234
+ ap = {}
235
+ unit_number = ETL.parse_string( row[:unit_number], length: 8, name: 'UNIT_NUMBER' )
236
+ appointment_type_code = ETL.parse_string( row[:appointment_type_code], length: 3, name: 'APPOINTMENT_TYPE_CODE' )
237
+ job_code = ETL.parse_string( row[:job_code], length: 6, name: 'JOB_CODE' )
238
+ salary = ETL.parse_float( row[:salary], length: 15, name: 'SALARY' )
239
+ appointment_start_date = ETL.parse_string( row[:appointment_start_date], name: 'APPOINTMENT_START_DATE' )
240
+ appointment_end_date = ETL.parse_string( row[:appointment_end_date], name: 'APPOINTMENT_END_DATE' )
241
+ job_title = ETL.parse_string( row[:job_title], length: 50, name: 'JOB_TITLE', strict: false )
242
+ prefered_job_title = ETL.parse_string( row[:prefered_job_title], length: 51, name: 'PREFERED_JOB_TITLE', strict: false )
243
+ ap[:unitNumber] = unit_number unless unit_number.empty?
244
+ ap[:appointmentType] = appointment_type_code unless appointment_type_code.empty?
245
+ ap[:jobCode] = job_code unless job_code.empty?
246
+ ap[:salary] = salary unless salary.nil?
247
+ ap[:startDate] = appointment_start_date unless appointment_start_date.empty?
248
+ ap[:endDate] = appointment_end_date unless appointment_end_date.empty?
249
+ ap[:jobTitle] = job_title unless job_title.empty?
250
+ ap[:preferedJobTitle] = prefered_job_title unless prefered_job_title.empty?
251
+ return ap.empty? ? nil : ap
252
+ end
253
+
254
+ def buildEmail(row)
255
+ em = {}
256
+ email_typ_cd = GRM.parse_email_type( row[:email_typ_cd] )
257
+ email_addr = GRM.parse_email_address( row[:email_addr] )
258
+ em[:emailType] = email_typ_cd unless email_typ_cd.empty?
259
+ em[:emailAddress] = email_addr unless email_addr.empty?
260
+ em[:default] = true
261
+ em[:active] = true
262
+ return em.empty? ? nil : em
263
+ end
264
+
265
+ def addToListIfNotIncluded(item, list)
266
+ if (!item.nil? && list.nil?)
267
+ return [item]
268
+ elsif (!item.nil? && !list.include?(item))
269
+ if (item[:default] && !list.find{ |x| x[:default] }.nil?)
270
+ item[:default] = false
271
+ end
272
+ return list.push(item)
273
+ else
274
+ return list
275
+ end
276
+ end
277
+
82
278
  opt = parse_command_line_options (File.basename $0), ARGF.argv
83
279
 
84
280
  text_parse_errors = []
85
281
 
282
+ recordsByPrincipalId = {}
86
283
  CSV.open(opt[:csv_filename], opt[:csv_options]) do |csv|
87
284
  record_count = csv.readlines.count
88
285
  csv.rewind # go back to first row
286
+ csv.find_all do |row|
287
+ begin
288
+ principalId = GRM.parse_principal_id( row[:prncpl_id] )
289
+ record = recordsByPrincipalId.has_key?(principalId) ? recordsByPrincipalId[principalId] : {}
290
+ record[:principalId] = principalId
291
+ record[:principalName] = GRM.parse_principal_name( row[:prncpl_nm] )
292
+ record[:kcExtendedAttributes] = buildExtendedAttributes(row)
293
+
294
+ newAffiliation = buildAffiliations(row)
295
+ if (!newAffiliation.nil? && record[:affiliations].nil?)
296
+ record[:affiliations] = []
297
+ end
298
+ if (!record[:affiliations].include? newAffiliation)
299
+ record[:affiliations].push(newAffiliation)
300
+ end
301
+
302
+ record[:names] = addToListIfNotIncluded(buildName(row), record[:names])
303
+ record[:addresses] = addToListIfNotIncluded(buildAddress(row), record[:addresses])
304
+ record[:phones] = addToListIfNotIncluded(buildPhone(row), record[:phones])
305
+ record[:appointments] = addToListIfNotIncluded(buildAppointment(row), record[:appointments])
306
+ record[:emails] = addToListIfNotIncluded(buildEmail(row), record[:emails])
307
+
308
+ recordsByPrincipalId[principalId] = record
309
+
310
+ rescue TextParseError => e
311
+ puts e.message
312
+ text_parse_errors.push e
313
+ end
314
+ end # row
315
+
316
+ #puts "#{recordsByPrincipalId}\n";
317
+ csv.rewind # go back to first row
318
+
89
319
 
90
320
  File.open(opt[:xml_filename], 'w') do |xml_file|
91
321
  xml = Builder::XmlMarkup.new target: xml_file, indent: 2
@@ -96,208 +326,65 @@ CSV.open(opt[:csv_filename], opt[:csv_options]) do |csv|
96
326
  schemaVersion: "2.0",
97
327
  statusEmailRecipient: opt[:email_recipients],
98
328
  reportDate: Time.now.iso8601,
99
- recordCount: record_count do |hrmanifest|
329
+ recordCount: recordsByPrincipalId.length do |hrmanifest|
100
330
  hrmanifest.records do |record|
101
- csv.find_all do |row| # begin processing csv rows
102
- begin
103
- xml.record principalId: GRM.parse_principal_id( row[:prncpl_id] ),
104
- principalName: GRM.parse_principal_name( row[:prncpl_nm] ) do |record|
105
- record.affiliations do |affiliations|
106
- aff = {}
107
- afltn_typ_cd = ETL.parse_string row[:afltn_typ_cd], name: 'AFLTN_TYP_CD', length: 40, required: true
108
- campus = ETL.parse_string row[:campus_cd], name: 'CAMPUS_CD', length: 2
109
- aff[:affiliationType] = afltn_typ_cd unless afltn_typ_cd.empty?
110
- aff[:campus] = campus unless campus.empty?
111
- aff[:default] = true
112
- aff[:active] = true
113
-
114
- affiliations.affiliation aff do |affiliation|
115
- emp = {}
116
- emp_stat_cd = GRM.parse_emp_stat_cd row[:emp_stat_cd]
117
- emp_typ_cd = GRM.parse_emp_typ_cd row[:emp_typ_cd]
118
- base_slry_amt = ETL.parse_float row[:base_slry_amt], length: 15, name: 'BASE_SLRY_AMT'
119
- prmry_dept_cd = ETL.parse_string row[:prmry_dept_cd], length: 40, name: 'PRMRY_DEPT_CD'
120
- emp_id = ETL.parse_string row[:emp_id], length: 40, name: 'EMP_ID'
121
- emp[:employeeStatus] = emp_stat_cd unless emp_stat_cd.empty?
122
- emp[:employeeType] = emp_typ_cd unless emp_typ_cd.empty?
123
- emp[:baseSalaryAmount] = base_slry_amt unless base_slry_amt.nil?
124
- emp[:primaryDepartment] = prmry_dept_cd unless prmry_dept_cd.empty?
125
- emp[:employeeId] = emp_id unless emp_id.empty?
126
- emp[:primaryEmployment] = true
127
-
128
- affiliation.employment emp
331
+ recordsByPrincipalId.each do |principalId, info|
332
+ xml.record principalId: principalId,
333
+ principalName: info[:principalName] do |record|
334
+
335
+ record.affiliations do |affiliations|
336
+ info[:affiliations].each do |affilInfo|
337
+ affiliations.affiliation affilInfo.reject{ |k| k == :employment } do |affiliation|
338
+ affilInfo[:employment].each do |employmentInfo|
339
+ affiliation.employment employmentInfo
340
+ end
129
341
  end
130
- end # affiliations
131
-
132
- address = {}
133
- addr_typ_cd = GRM.parse_address_type_code( row[:addr_typ_cd] )
134
- addr_line_1 = ETL.parse_string( row[:addr_line_1], name: 'ADDR_LINE_1', length: 45 )
135
- addr_line_2 = ETL.parse_string( row[:addr_line_2], name: 'ADDR_LINE_2', length: 45 )
136
- addr_line_3 = ETL.parse_string( row[:addr_line_3], name: 'ADDR_LINE_3', length: 45 )
137
- city = ETL.parse_string( row[:city], name: 'CITY', length: 30 )
138
- state_pvc_cd = ETL.parse_string( row[:state_pvc_cd], name: 'STATE_PVC_CD', length: 2 )
139
- postal_cd = ETL.parse_string( row[:postal_cd], name: 'POSTAL_CD', length: 20 )
140
- postal_cntry_cd = ETL.parse_string( row[:postal_cntry_cd], name: 'POSTAL_CNTRY_CD', length: 2 )
141
- address[:addressTypeCode] = addr_typ_cd unless addr_typ_cd.empty?
142
- address[:addressLine1] = addr_line_1 unless addr_line_1.empty?
143
- address[:addressLine2] = addr_line_2 unless addr_line_2.empty?
144
- address[:addressLine3] = addr_line_3 unless addr_line_3.empty?
145
- address[:city] = city unless city.empty?
146
- address[:stateOrProvince] = state_pvc_cd unless state_pvc_cd.empty?
147
- address[:postalCode] = postal_cd unless postal_cd.empty?
148
- address[:country] = postal_cntry_cd unless postal_cntry_cd.empty?
149
- unless address.empty?
150
- record.addresses do |addresses|
151
- addresses.address address
152
- end # addresses
153
342
  end
343
+ end # affiliations
154
344
 
345
+ unless info[:addresses].nil? || info[:addresses].empty?
346
+ record.addresses do |addresses|
347
+ info[:addresses].each do |addrInfo|
348
+ addresses.address addrInfo
349
+ end
350
+ end # addresses
351
+ end
352
+
353
+ unless info[:names].nil?
155
354
  record.names do |names|
156
- nm = {}
157
- nm_typ_cd = GRM.parse_name_code row[:nm_typ_cd]
158
- prefix_nm = GRM.parse_prefix row[:prefix_nm]
159
- first_nm = ETL.parse_string row[:first_nm], length: 40, name: 'FIRST_NM'
160
- middle_nm = ETL.parse_string row[:middle_nm], length: 40, name: 'MIDDLE_NM'
161
- last_nm = ETL.parse_string row[:last_nm], length: 80, name: 'LAST_NM'
162
- suffix_nm = GRM.parse_suffix row[:suffix_nm]
163
- title_nm = ETL.parse_string row[:title_nm], length: 20, name: 'TITLE_NM'
164
- nm[:nameCode] = nm_typ_cd unless nm_typ_cd.empty?
165
- nm[:prefix] = prefix_nm unless prefix_nm.empty?
166
- nm[:firstName] = first_nm unless first_nm.empty?
167
- nm[:middleName] = middle_nm unless middle_nm.empty?
168
- nm[:lastName] = last_nm unless last_nm.empty?
169
- nm[:suffix] = suffix_nm unless suffix_nm.empty?
170
- nm[:title] = title_nm unless title_nm.empty?
171
- nm[:default] = true
172
- nm[:active] = true
173
-
174
- names.name nm
355
+ info[:names].each do |nameInfo|
356
+ names.name nameInfo
357
+ end
175
358
  end # names
359
+ end
176
360
 
177
- ph = {}
178
- phone_typ_cd = GRM.parse_phone_type row[:phone_typ_cd]
179
- phone_nbr = GRM.parse_phone_number row[:phone_nbr]
180
- phone_extn_nbr = ETL.parse_string row[:phone_extn_nbr], length: 8, name: 'PHONE_EXTN_NBR'
181
- phone_cntry_cd = ETL.parse_string row[:phone_cntry_cd], length: 2, name: 'PHONE_CNTRY_CD'
182
- ph[:phoneType] = phone_typ_cd unless phone_typ_cd.empty?
183
- ph[:phoneNumber] = phone_nbr unless phone_nbr.empty?
184
- ph[:extension] = phone_extn_nbr unless phone_extn_nbr.empty?
185
- ph[:country] = phone_cntry_cd unless phone_cntry_cd.empty?
186
- ph[:default] = true
187
- ph[:active] = true
188
-
189
- unless phone_typ_cd.empty? || phone_nbr.empty?
190
- record.phones do |phones|
191
- phones.phone ph
192
- end # phones
361
+ unless info[:phones].nil? || info[:phones].empty?
362
+ record.phones do |phones|
363
+ info[:phones].each do |phoneInfo|
364
+ phones.phone phoneInfo
365
+ end
193
366
  end
367
+ end
194
368
 
195
- em = {}
196
- email_typ_cd = GRM.parse_email_type( row[:email_typ_cd] )
197
- email_addr = GRM.parse_email_address( row[:email_addr] )
198
- em[:emailType] = email_typ_cd unless email_typ_cd.empty?
199
- em[:emailAddress] = email_addr unless email_addr.empty?
200
- em[:default] = true
201
- em[:active] = true
202
-
203
- unless email_typ_cd.empty? || email_addr.empty?
204
- record.emails do |emails|
205
- emails.email em unless email_addr.empty?
206
- end # emails
207
- end
369
+ unless info[:emails].nil? || info[:emails].empty?
370
+ record.emails do |emails|
371
+ info[:emails].each do |emailInfo|
372
+ emails.email emailInfo
373
+ end
374
+ end # emails
375
+ end
208
376
 
209
- ea = {}
210
- visa_type = ETL.parse_string( row[:visa_type], length: 30, name: 'VISA_TYPE' )
211
- county = ETL.parse_string( row[:county], length: 30, name: 'COUNTY' )
212
- age_by_fiscal_year = ETL.parse_integer( row[:age_by_fiscal_year], length: 3, name: 'AGE_BY_FISCAL_YEAR' )
213
- race = ETL.parse_string( row[:race], length: 30, name: 'RACE' )
214
- education_level = ETL.parse_string( row[:education_level], length: 30, name: 'EDUCATION_LEVEL' )
215
- degree = GRM.parse_degree( row[:degree], name: 'DEGREE' )
216
- major = ETL.parse_string( row[:major], length: 30, name: 'MAJOR' )
217
- is_handicapped = ETL.parse_boolean( row[:is_handicapped], name: 'IS_HANDICAPPED' )
218
- handicap_type = ETL.parse_string( row[:handicap_type], length: 30, name: 'HANDICAP_TYPE' )
219
- is_veteran = ETL.parse_boolean( row[:is_veteran], name: 'IS_VETERAN' )
220
- veteran_type = ETL.parse_string( row[:veteran_type], length: 30, name: 'VETERAN_TYPE' )
221
- has_visa = ETL.parse_boolean( row[:has_visa], name: 'HAS_VISA' )
222
- visa_code = ETL.parse_string( row[:visa_code], length: 20, name: 'VISA_CODE' )
223
- visa_renewal_date = ETL.parse_string( row[:visa_renewal_date], length: 19, name: 'VISA_RENEWAL_DATE' )
224
- office_location = ETL.parse_string( row[:office_location], length: 30, name: 'OFFICE_LOCATION' )
225
- secondry_office_location = ETL.parse_string( row[:secondry_office_location], length: 30, name: 'SECONDRY_OFFICE_LOCATION' )
226
- school = ETL.parse_string( row[:school], length: 50, name: 'SCHOOL' )
227
- year_graduated = GRM.parse_year( row[:year_graduated], name: 'YEAR_GRADUATED' )
228
- directory_department = ETL.parse_string( row[:directory_department], length: 30, name: 'DIRECTORY_DEPARTMENT' )
229
- directory_title = ETL.parse_string( row[:directory_title], length: 50, name: 'DIRECTORY_TITLE', strict: false )
230
- primary_title = ETL.parse_string( row[:primary_title], length: 51, name: 'PRIMARY_TITLE', strict: false )
231
- vacation_accural = ETL.parse_boolean( row[:vacation_accural], name: 'VACATION_ACCURAL' )
232
- is_on_sabbatical = ETL.parse_boolean( row[:is_on_sabbatical], name: 'IS_ON_SABBATICAL' )
233
- id_provided = ETL.parse_string( row[:id_provided], length: 30, name: 'ID_PROVIDED' )
234
- id_verified = ETL.parse_string( row[:id_verified], length: 30, name: 'ID_VERIFIED' )
235
- citizenship_type_code = GRM.parse_citizenship_type( row[:citizenship_type_code] )
236
- multi_campus_principal_id = ETL.parse_string( row[:multi_campus_principal_id], length: 40, name: 'MULTI_CAMPUS_PRINCIPAL_ID' )
237
- multi_campus_principal_name = ETL.parse_string( row[:multi_campus_principal_name], length: 100, name: 'MULTI_CAMPUS_PRINCIPAL_NAME' )
238
- salary_anniversary_date = ETL.parse_string( row[:salary_anniversary_date], length: 10, name: 'SALARY_ANNIVERSARY_DATE' )
239
- ea[:visaType] = visa_type unless visa_type.empty?
240
- ea[:county] = county unless county.empty?
241
- ea[:ageByFiscalYear] = age_by_fiscal_year unless age_by_fiscal_year.nil?
242
- ea[:race] = race unless race.empty?
243
- ea[:educationLevel] = education_level unless education_level.empty?
244
- ea[:degree] = degree unless degree.empty?
245
- ea[:major] = major unless major.empty?
246
- ea[:handicapped] = is_handicapped unless is_handicapped.nil?
247
- ea[:handicapType] = handicap_type unless handicap_type.empty?
248
- ea[:veteran] = is_veteran unless is_veteran.nil?
249
- ea[:veteranType] = veteran_type unless veteran_type.empty?
250
- ea[:visa] = has_visa unless has_visa.nil?
251
- ea[:visaCode] = visa_code unless visa_code.empty?
252
- ea[:visaRenewalDate] = visa_renewal_date unless visa_renewal_date.empty?
253
- ea[:officeLocation] = office_location unless office_location.empty?
254
- ea[:secondaryOfficeLocation] = secondry_office_location unless secondry_office_location.empty?
255
- ea[:school] = school unless school.empty?
256
- ea[:yearGraduated] = year_graduated unless year_graduated.empty?
257
- ea[:directoryDepartment] = directory_department unless directory_department.empty?
258
- ea[:directoryTitle] = directory_title unless directory_title.empty?
259
- ea[:primaryTitle] = primary_title unless primary_title.empty?
260
- ea[:vacationAccrual] = vacation_accural unless vacation_accural.nil?
261
- ea[:onSabbatical] = is_on_sabbatical unless is_on_sabbatical.nil?
262
- ea[:idProvided] = id_provided unless id_provided.empty?
263
- ea[:idVerified] = id_verified unless id_verified.empty?
264
- ea[:citizenshipType] = citizenship_type_code unless citizenship_type_code.empty?
265
- ea[:multiCampusPrincipalId] = multi_campus_principal_id unless multi_campus_principal_id.empty?
266
- ea[:multiCampusPrincipalName] = multi_campus_principal_name unless multi_campus_principal_name.empty?
267
- ea[:salaryAnniversaryDate] = salary_anniversary_date unless salary_anniversary_date.empty?
268
-
269
- record.kcExtendedAttributes ea
270
-
271
- ap = {}
272
- unit_number = ETL.parse_string( row[:unit_number], length: 8, name: 'UNIT_NUMBER' )
273
- appointment_type_code = ETL.parse_string( row[:appointment_type_code], length: 3, name: 'APPOINTMENT_TYPE_CODE' )
274
- job_code = ETL.parse_string( row[:job_code], length: 6, name: 'JOB_CODE' )
275
- salary = ETL.parse_float( row[:salary], length: 15, name: 'SALARY' )
276
- appointment_start_date = ETL.parse_string( row[:appointment_start_date], name: 'APPOINTMENT_START_DATE' )
277
- appointment_end_date = ETL.parse_string( row[:appointment_end_date], name: 'APPOINTMENT_END_DATE' )
278
- job_title = ETL.parse_string( row[:job_title], length: 50, name: 'JOB_TITLE', strict: false )
279
- prefered_job_title = ETL.parse_string( row[:prefered_job_title], length: 51, name: 'PREFERED_JOB_TITLE', strict: false )
280
- ap[:unitNumber] = unit_number unless unit_number.empty?
281
- ap[:appointmentType] = appointment_type_code unless appointment_type_code.empty?
282
- ap[:jobCode] = job_code unless job_code.empty?
283
- ap[:salary] = salary unless salary.nil?
284
- ap[:startDate] = appointment_start_date unless appointment_start_date.empty?
285
- ap[:endDate] = appointment_end_date unless appointment_end_date.empty?
286
- ap[:jobTitle] = job_title unless job_title.empty?
287
- ap[:preferedJobTitle] = prefered_job_title unless prefered_job_title.empty?
288
-
289
- unless unit_number.empty? || job_code.empty?
290
- record.appointments do |appointments|
291
- appointments.appointment ap
292
- end # appointments
293
- end
294
- end # record
377
+ record.kcExtendedAttributes info[:kcExtendedAttributes]
295
378
 
296
- rescue TextParseError => e
297
- puts e.message
298
- text_parse_errors.push e
299
- end
300
- end # row
379
+ unless info[:appointments].nil? || info[:appointments].empty?
380
+ record.appointments do |appointments|
381
+ info[:appointments].each do |appointmentInfo|
382
+ appointments.appointment appointmentInfo
383
+ end
384
+ end # appointments
385
+ end
386
+ end # record
387
+ end
301
388
  end # record
302
389
  end # hrmanifest
303
390
  end # xml_file
@@ -16,5 +16,5 @@
16
16
 
17
17
  module KualiCo
18
18
  # The gem version number.
19
- VERSION = "0.30"
19
+ VERSION = "0.40"
20
20
  end
@@ -586,9 +586,9 @@ RSpec.describe "KualiCo::ETL::GRM" do
586
586
  expect { GRM.parse_citizenship_type("Z") }.to raise_error(TextParseError)
587
587
  end
588
588
 
589
- it "raises an TextParseError if the citizenship_type is nil or empty" do
590
- expect(GRM.parse_citizenship_type(nil)).to eq("")
591
- expect(GRM.parse_citizenship_type("")).to eq("")
589
+ it "defaults to citizenship_type 1" do
590
+ expect(GRM.parse_citizenship_type(nil)).to eq("1")
591
+ expect(GRM.parse_citizenship_type("")).to eq("1")
592
592
  end
593
593
 
594
594
  it "raises an TextParseError if length exceeds 1 character" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuali_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.30'
4
+ version: '0.40'
5
5
  platform: ruby
6
6
  authors:
7
7
  - KualiCo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder