[Home] [Help]
PACKAGE BODY: APPS.IGS_UC_PROC_APPLICATION_DATA
Source
1 PACKAGE BODY igs_uc_proc_application_data AS
2 /* $Header: IGSUC68B.pls 120.8 2006/09/07 06:39:13 jchakrab noship $ */
3
4 g_success_rec_cnt NUMBER;
5 g_error_rec_cnt NUMBER;
6 g_error_code igs_uc_istark_ints.error_code%TYPE;
7 g_crnt_institute igs_uc_defaults.current_inst_code%TYPE;
8
9 --JCHAKRAB made the config_cycle variable global for UCFD308 - UCAS 2005 Changes
10 g_config_cycle igs_uc_defaults.configured_cycle%TYPE;
11
12 PROCEDURE appl_data_setup (errbuf OUT NOCOPY VARCHAR2,
13 retcode OUT NOCOPY NUMBER)
14 IS
15 /******************************************************************
16 Created By : rgangara
17 Date Created By : 12-JUNE-2003
18 Purpose : Called from Main procedure Process_ucas_data
19 for general setup validations needed before
20 processing Application data views.
21 Known limitations,enhancements,remarks:
22 Change History
23 Who When What
24 jchakrab 27-JUL-04 Modified for UCFD308 - UCAS - 2005 Regulatory Changes
25 ******************************************************************/
26
27 -- Get the current institution code set in UCAS Setup for FTUG as all systems have the same.
28 CURSOR crnt_inst_cur IS
29 SELECT DISTINCT current_inst_code
30 FROM igs_uc_defaults
31 WHERE current_inst_code IS NOT NULL;
32
33 -- Get the Configured cycle value
34 CURSOR get_config_cycle_cur IS
35 SELECT MAX(configured_cycle) configured_cycle
36 FROM igs_uc_defaults ;
37
38 BEGIN
39
40 OPEN crnt_inst_cur;
41 FETCH crnt_inst_cur INTO g_crnt_institute;
42 CLOSE crnt_inst_cur;
43
44 IF g_crnt_institute IS NULL THEN
45 fnd_message.set_name('IGS','IGS_UC_CURR_INST_NOT_SET');
46 errbuf := fnd_message.get;
47 fnd_file.put_line(fnd_file.log, errbuf);
48 retcode := 2;
49 END IF;
50
51
52 OPEN get_config_cycle_cur;
53 FETCH get_config_cycle_cur INTO g_config_cycle; --JCHAKRAB - modified for UCAS 2005 changes
54 CLOSE get_config_cycle_cur;
55
56 IF g_config_cycle IS NULL THEN
57 fnd_message.set_name('IGS','IGS_UC_CYCLE_NOT_FOUND');
58 errbuf := fnd_message.get;
59 fnd_file.put_line(fnd_file.log, errbuf);
60 retcode := 2;
61 END IF;
62
63 EXCEPTION
64 WHEN OTHERS THEN
65 ROLLBACK;
66 Fnd_Message.set_name('IGS','IGS_GE_UNHANDLED_EXP');
67 fnd_message.set_token('NAME', 'PROCESS_UCAS_DATA.APPL_DATA_SETUP');
68 retcode := 2;
69 errbuf := fnd_message.get;
70 fnd_file.put_line(fnd_file.log, errbuf);
71 END appl_data_setup;
72
73 PROCEDURE validate_applicant (p_appno igs_uc_applicants.app_no%TYPE,
74 p_error_cd OUT NOCOPY g_error_code%TYPE) IS
75 /******************************************************************
76 Created By : rgangara
77 Date Created By : 12-JUNE-2003
78 Purpose : LOCAL PROCEDURE for validation whether application Number
79 is valid and that person ID is associated to it.
80 Known limitations,enhancements,remarks:
81 Change History
82 Who When What
83 ******************************************************************/
84
85 -- For getting Application details from IGS_UC_APPLICANTS.
86 CURSOR get_applicant_cur IS
87 SELECT app_no,
88 oss_person_id
89 FROM igs_uc_applicants
90 WHERE app_no = p_appno;
91
92 l_applicant_rec get_applicant_cur%ROWTYPE;
93
94 BEGIN
95
96 OPEN get_applicant_cur;
97 FETCH get_applicant_cur INTO l_applicant_rec;
98 CLOSE get_applicant_cur;
99
100 IF l_applicant_rec.app_no IS NULL THEN
101 p_error_cd := '1000';
102
103 ELSIF l_applicant_rec.oss_person_id IS NULL THEN
104 p_error_cd := '1001';
105 END IF;
106
107 EXCEPTION
108 WHEN OTHERS THEN
109 p_error_cd := '1000';
110
111 -- Close any Open cursors
112 IF get_applicant_cur%ISOPEN THEN
113 CLOSE get_applicant_cur;
114 END IF;
115
116 END validate_applicant;
117
118
119
120
121 PROCEDURE proc_update_ivstarn_status IS
122 /******************************************************************
123 Created By : rgangara
124 Date Created By : 12-JUN-03
125 Purpose : LOCAL PROCEDURE called from process_IVSTARN Procedure.
126 This process picks up all the records from the IVSTARN
127 interface table where status = 'I' and checks whether
128 corresponding record exists in IGS_AD_INTERFACE table.
129 This could be due to some data error or Adm import process
130 exitting due to some reason.
131 If corresponding record found then retain the status to I
132 and popuate Error code ELSE update the status to 'D'.
133 Known limitations,enhancements,remarks:
134 Change History
135 Who When What
136 rgangara 31-DEC-03 Enhanced logging of Person Creation Details Bug# 3327176.
137 ***************************************************************** */
138
139 -- get all the records which have been populated successfully into UCAS tables
140 -- but have encountered errors while creating person using Adm Import process
141 CURSOR cur_ivstarn IS
142 SELECT stn.rowid,
143 stn.appno,
144 stn.ad_batch_id,
145 stn.ad_interface_id,
146 stn.ad_api_id ,
147 stn.record_status ,
148 stn.error_code
149 FROM igs_uc_istarn_ints stn
150 WHERE stn.record_status = 'I';
151
152 l_starn_rec cur_ivstarn%ROWTYPE;
153
154 CURSOR ad_interface_cur (p_interface_id igs_uc_istarn_ints.ad_interface_id%TYPE) IS
155 SELECT 'X'
156 FROM igs_ad_interface_all
157 WHERE interface_id = p_interface_id;
158
159 l_exists_flag VARCHAR2(1);
160 l_success_cnt NUMBER;
161 l_failure_cnt NUMBER;
162
163 BEGIN
164 l_success_cnt := 0;
165 l_failure_cnt := 0;
166
167 FOR ivstarn_rec IN cur_ivstarn
168 LOOP
169
170 l_exists_flag := NULL; -- initialize
171
172 OPEN ad_interface_cur (ivstarn_rec.ad_interface_id);
173 FETCH ad_interface_cur INTO l_exists_flag;
174 CLOSE ad_interface_cur;
175
176 IF l_exists_flag IS NULL THEN
177 -- update the record with status = 'D'.
178 UPDATE igs_uc_istarn_ints
179 SET record_status = 'D'
180 WHERE rowid = ivstarn_rec.rowid;
181
182 -- update count for success records
183 l_success_cnt := l_success_cnt + 1;
184
185 ELSE
186
187 -- update the error code with status = 'D'.
188 UPDATE igs_uc_istarn_ints
189 SET error_code = '3001'
190 WHERE rowid = ivstarn_rec.rowid;
191
192 -- update count for failure records
193 l_failure_cnt := l_failure_cnt + 1;
194
195 -- log error message/meaning.
196 fnd_Message.Set_name('IGS','IGS_UC_ERR_CREATE_PRSN');
197 fnd_message.set_token('APPNO', ivstarn_rec.appno);
198 fnd_message.set_token('INTERFACE_ID', ivstarn_rec.ad_interface_id);
199 fnd_message.set_token('BATCH', ivstarn_rec.ad_batch_id);
200 fnd_file.put_line(fnd_file.LOG, fnd_message.get());
201
202 END IF;
203
204 END LOOP;
205
206 -- log processing complete for this part of processing - Bug# 3327176.
207 igs_uc_proc_ucas_data.log_proc_complete('PERSON CREATION ', l_success_cnt, l_failure_cnt);
208
209 EXCEPTION
210 WHEN OTHERS THEN
211 -- Close any Open cursors
212 IF ad_interface_cur%ISOPEN THEN
213 CLOSE ad_interface_cur;
214 END IF;
215
216 -- even though the admission import process completes in error , this process should continue processing
217 Fnd_Message.Set_name('IGS','IGS_GE_UNHANDLED_EXP');
218 fnd_message.set_token('NAME','IGS_UC_PROC_APPLICATION_DATA.PROC_UPDATE_IVSTARN_STATUS'||' - '||SQLERRM);
219 fnd_file.put_line(fnd_file.LOG,fnd_message.get());
220
221 END proc_update_ivstarn_status;
222
223
224
225
226 PROCEDURE proc_populate_oss_person IS
227 /******************************************************************
228 Created By : rgangara
229 Date Created By : 12-JUN-03
230 Purpose : LOCAL PROCEDURE called from process_IVSTARN Procedure.
231 This process picks up all the records from
232 IGS_UC_APPLICANTS where OSS PERSON ID IS NULL
233 and gets the Person ID from Alternate person ID
234 table based on Alternate Person ID which is the
235 type as that of the system to which the App belongs.
236 Known limitations,enhancements,remarks:
237 Change History
238 Who When What
239 ***************************************************************** */
240
241 -- get all the records with NULL Person ID
242 CURSOR ucas_app_person_cur IS
243 SELECT ucap.rowid,
244 ucap.*
245 FROM igs_uc_applicants ucap
246 WHERE oss_person_id IS NULL;
247
248
249 -- get all the records with NULL Person ID
250 CURSOR get_person_cur (p_ucas_appno igs_pe_alt_pers_id.api_person_id%TYPE,
251 p_ucas_system igs_pe_alt_pers_id.person_id_type%TYPE) IS
252 SELECT pe_person_id
253 FROM igs_pe_alt_pers_id
254 WHERE api_person_id = p_ucas_appno
255 AND person_id_type = p_ucas_system;
256
257
258 l_oss_person_id igs_uc_applicants.oss_person_id%TYPE;
259 l_system_type igs_pe_alt_pers_id.person_id_type%TYPE;
260
261 BEGIN
262
263 -- log Processing message
264 fnd_file.put_line(fnd_file.log, '==========================================================================');
265 fnd_Message.Set_name('IGS','IGS_UC_PRSN_UPDATE_FOR_APPNO');
266 fnd_message.set_token('TIME', TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
267 fnd_file.put_line(fnd_file.LOG,fnd_message.get);
268 fnd_file.put_line(fnd_file.log, '==========================================================================');
269
270 FOR ucas_app_person_rec IN ucas_app_person_cur
271 LOOP
272
273 BEGIN
274
275 -- initialize variables.
276 l_system_type := NULL;
277 l_oss_person_id := NULL;
278
279
280 -- identify the Alternate Person ID Type
281 IF ucas_app_person_rec.system_code = 'U' THEN
282 l_system_type := 'UCASID';
283
284 ELSIF ucas_app_person_rec.system_code = 'G' THEN
285 l_system_type := 'GTTRID';
286
287 ELSIF ucas_app_person_rec.system_code = 'N' THEN
288 l_system_type := 'NMASID';
289
290 ELSIF ucas_app_person_rec.system_code = 'S' THEN
291 l_system_type := 'SWASID';
292
293 END IF;
294
295 -- Check whether the Alternate Person ID type record exists
296 OPEN get_person_cur (ucas_app_person_rec.app_no, l_system_type);
297 FETCH get_person_cur INTO l_oss_person_id;
298 CLOSE get_person_cur;
299
300 IF l_oss_person_id IS NOT NULL THEN
301
302 -- log Processing message
303 fnd_Message.Set_name('IGS','IGS_UC_PRSN_POPULATE_APPNO');
304 fnd_message.set_token('APPNO', TO_CHAR(ucas_app_person_rec.app_no));
305 fnd_file.put_line(fnd_file.LOG,fnd_message.get);
306
307 -- update UCAS Applicants table with Person ID.
308 BEGIN
309 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
310 (
311 x_rowid => ucas_app_person_rec.rowid
312 ,x_app_id => ucas_app_person_rec.app_id
313 ,x_app_no => ucas_app_person_rec.app_no
314 ,x_check_digit => ucas_app_person_rec.check_digit
315 ,x_personal_id => ucas_app_person_rec.personal_id
316 ,x_enquiry_no => ucas_app_person_rec.enquiry_no
317 ,x_oss_person_id => l_oss_person_id
318 ,x_application_source => ucas_app_person_rec.application_source
319 ,x_name_change_date => ucas_app_person_rec.name_change_date
320 ,x_student_support => ucas_app_person_rec.student_support
321 ,x_address_area => ucas_app_person_rec.address_area
322 ,x_application_date => ucas_app_person_rec.application_date
323 ,x_application_sent_date => ucas_app_person_rec.application_sent_date
324 ,x_application_sent_run => ucas_app_person_rec.application_sent_run
325 ,x_lea_code => NULL -- obsoleted by UCAS
326 ,x_fee_payer_code => ucas_app_person_rec.fee_payer_code
327 ,x_fee_text => ucas_app_person_rec.fee_text
328 ,x_domicile_apr => ucas_app_person_rec.domicile_apr
329 ,x_code_changed_date => ucas_app_person_rec.code_changed_date
330 ,x_school => ucas_app_person_rec.school
331 ,x_withdrawn => ucas_app_person_rec.withdrawn
332 ,x_withdrawn_date => ucas_app_person_rec.withdrawn_date
333 ,x_rel_to_clear_reason => ucas_app_person_rec.rel_to_clear_reason
334 ,x_route_b => ucas_app_person_rec.route_b
335 ,x_exam_change_date => ucas_app_person_rec.exam_change_date
336 ,x_a_levels => NULL -- obsoleted by UCAS
337 ,x_as_levels => NULL -- obsoleted by UCAS
338 ,x_highers => NULL -- obsoleted by UCAS
339 ,x_csys => NULL -- obsoleted by UCAS
340 ,x_winter => ucas_app_person_rec.winter
341 ,x_previous => ucas_app_person_rec.previous
342 ,x_gnvq => NULL -- obsoleted by UCAS
343 ,x_btec => ucas_app_person_rec.btec
344 ,x_ilc => ucas_app_person_rec.ilc
345 ,x_ailc => ucas_app_person_rec.ailc
346 ,x_ib => ucas_app_person_rec.ib
347 ,x_manual => ucas_app_person_rec.manual
348 ,x_reg_num => ucas_app_person_rec.reg_num
349 ,x_oeq => ucas_app_person_rec.oeq
350 ,x_eas => ucas_app_person_rec.eas
351 ,x_roa => ucas_app_person_rec.roa
352 ,x_status => ucas_app_person_rec.status
353 ,x_firm_now => ucas_app_person_rec.firm_now
354 ,x_firm_reply => ucas_app_person_rec.firm_reply
355 ,x_insurance_reply => ucas_app_person_rec.insurance_reply
356 ,x_conf_hist_firm_reply => ucas_app_person_rec.conf_hist_firm_reply
357 ,x_conf_hist_ins_reply => ucas_app_person_rec.conf_hist_ins_reply
358 ,x_residential_category => ucas_app_person_rec.residential_category
359 ,x_personal_statement => ucas_app_person_rec.personal_statement
360 ,x_match_prev => ucas_app_person_rec.match_prev
361 ,x_match_prev_date => ucas_app_person_rec.match_prev_date
362 ,x_match_winter => ucas_app_person_rec.match_winter
363 ,x_match_summer => ucas_app_person_rec.match_summer
364 ,x_gnvq_date => ucas_app_person_rec.gnvq_date
365 ,x_ib_date => ucas_app_person_rec.ib_date
366 ,x_ilc_date => ucas_app_person_rec.ilc_date
367 ,x_ailc_date => ucas_app_person_rec.ailc_date
368 ,x_gcseqa_date => ucas_app_person_rec.gcseqa_date
369 ,x_uk_entry_date => ucas_app_person_rec.uk_entry_date
370 ,x_prev_surname => ucas_app_person_rec.prev_surname
371 ,x_criminal_convictions => ucas_app_person_rec.criminal_convictions
372 ,x_sent_to_hesa => ucas_app_person_rec.sent_to_hesa
373 ,x_sent_to_oss => ucas_app_person_rec.sent_to_oss
374 ,x_batch_identifier => ucas_app_person_rec.batch_identifier
375 ,x_mode => 'R'
376 ,x_gce => ucas_app_person_rec.gce
377 ,x_vce => ucas_app_person_rec.vce
378 ,x_sqa => ucas_app_person_rec.sqa
379 ,x_previousas => ucas_app_person_rec.previousas
380 ,x_keyskills => ucas_app_person_rec.keyskills
381 ,x_vocational => ucas_app_person_rec.vocational
382 ,x_scn => ucas_app_person_rec.scn
383 ,x_PrevOEQ => ucas_app_person_rec.PrevOEQ
384 ,x_choices_transparent_ind => ucas_app_person_rec.choices_transparent_ind
385 ,x_extra_status => ucas_app_person_rec.extra_status
386 ,x_extra_passport_no => ucas_app_person_rec.extra_passport_no
387 ,x_request_app_dets_ind => ucas_app_person_rec.request_app_dets_ind
388 ,x_request_copy_app_frm_ind => ucas_app_person_rec.request_copy_app_frm_ind
389 ,x_cef_no => ucas_app_person_rec.cef_no
390 ,x_system_code => ucas_app_person_rec.system_code
391 ,x_gcse_eng => ucas_app_person_rec.gcse_eng
392 ,x_gcse_math => ucas_app_person_rec.gcse_math
393 ,x_degree_subject => ucas_app_person_rec.degree_subject
394 ,x_degree_status => ucas_app_person_rec.degree_status
395 ,x_degree_class => ucas_app_person_rec.degree_class
396 ,x_gcse_sci => ucas_app_person_rec.gcse_sci
397 ,x_welshspeaker => ucas_app_person_rec.welshspeaker
398 ,x_ni_number => ucas_app_person_rec.ni_number
399 ,x_earliest_start => ucas_app_person_rec.earliest_start
400 ,x_near_inst => ucas_app_person_rec.near_inst
401 ,x_pref_reg => ucas_app_person_rec.pref_reg
402 ,x_qual_eng => ucas_app_person_rec.qual_eng
403 ,x_qual_math => ucas_app_person_rec.qual_math
404 ,x_qual_sci => ucas_app_person_rec.qual_sci
405 ,x_main_qual => ucas_app_person_rec.main_qual
406 ,x_qual_5 => ucas_app_person_rec.qual_5
407 ,x_future_serv => ucas_app_person_rec.future_serv
408 ,x_future_set => ucas_app_person_rec.future_set
409 ,x_present_serv => ucas_app_person_rec.present_serv
410 ,x_present_set => ucas_app_person_rec.present_set
411 ,x_curr_employment => ucas_app_person_rec.curr_employment
412 ,x_edu_qualification => ucas_app_person_rec.edu_qualification
413 ,x_ad_batch_id => ucas_app_person_rec.ad_batch_id
414 ,x_ad_interface_id => ucas_app_person_rec.ad_interface_id
415 ,x_nationality => ucas_app_person_rec.nationality
416 ,x_dual_nationality => ucas_app_person_rec.dual_nationality
417 ,x_special_needs => ucas_app_person_rec.special_needs
418 ,x_country_birth => ucas_app_person_rec.country_birth
419 );
420
421 EXCEPTION
422 WHEN OTHERS THEN
423 fnd_file.put_line(fnd_file.log, SQLERRM);
424
425 END;
426
427 END IF;
428
429 EXCEPTION
430 WHEN OTHERS THEN
431 -- Close any Open cursors
432 IF get_person_cur%ISOPEN THEN
433 CLOSE get_person_cur;
434 END IF;
435
436 fnd_file.put_line(fnd_file.LOG, SQLERRM);
437 fnd_Message.Set_name('IGS','IGS_UC_ERR_PRSN_POPULATION');
438 fnd_message.set_token('APPNO', TO_CHAR(ucas_app_person_rec.app_no));
439 fnd_file.put_line(fnd_file.LOG,fnd_message.get);
440 END;
441
442 END LOOP;
443
444 EXCEPTION
445 WHEN OTHERS THEN
446 -- even though Exception is raised in this process, process should continue.
447 Fnd_Message.Set_name('IGS','IGS_GE_UNHANDLED_EXP');
448 fnd_message.set_token('NAME','IGS_UC_PROC_APPLICATION_DATA.PROC_POPULATE_OSS_PERSON'||' - '||SQLERRM);
449 fnd_file.put_line(fnd_file.LOG,fnd_message.get());
450 END proc_populate_oss_person ;
451
452
453
454
455 PROCEDURE proc_invoke_adm_imp_process(p_batch_id NUMBER,
456 p_source_type_id igs_pe_src_types_all.source_type_id%TYPE) IS
457 /******************************************************************
458 Created By : rgangara
459 Date Created By : 12-JUN-03
460 Purpose : LOCAL PROCEDURE called from process_IVSTARN Procedure to
461 Submit the request for admission import process to create basic person in OSS
462 Known limitations,enhancements,remarks:
463 Change History
464 Who When What
465 ***************************************************************** */
466
467 l_row_id VARCHAR2(26);
468 l_errbuff VARCHAR2(100) ;
469 l_retcode NUMBER ;
470 l_interface_run_id igs_ad_interface_ctl.interface_run_id%TYPE;
471
472 CURSOR cur_match_set IS
473 SELECT match_set_id
474 FROM igs_pe_match_sets
475 WHERE source_type_id = p_source_type_id;
476
477 match_set_rec cur_match_set%ROWTYPE;
478
479 BEGIN
480
481 fnd_file.put_line(fnd_file.log, '==========================================================================');
482 fnd_Message.Set_name('IGS','IGS_UC_ADM_IMP_PROC_LAUNCH');
483 fnd_message.set_token('REQ_ID', TO_CHAR(p_batch_id) || ' At ' || TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
484 fnd_file.put_line(fnd_file.LOG, fnd_message.get);
485 fnd_file.put_line(fnd_file.log, '==========================================================================');
486
487 -- Get the match set criteria corresponding to the ucas source type to be used for the person import
488 match_set_rec := NULL ;
489 OPEN cur_match_set;
490 FETCH cur_match_set INTO match_set_rec;
491 CLOSE cur_match_set;
492
493 l_interface_run_id := NULL ;
494 l_errbuff:= NULL ;
495 l_retcode := NULL ;
496
497 -- Call admission application import process procedure because current process has to wait until import process is finished
498 igs_ad_imp_001.imp_adm_data
499 ( errbuf => l_errbuff,
500 retcode => l_retcode ,
501 p_batch_id => p_batch_id,
502 p_source_type_id => p_source_type_id,
503 p_match_set_id => match_set_rec.match_set_id,
504 p_acad_cal_type => NULL ,
505 p_acad_sequence_number => NULL ,
506 p_adm_cal_type => NULL ,
507 p_adm_sequence_number => NULL ,
508 p_admission_cat => NULL ,
509 p_s_admission_process_type => NULL ,
510 p_interface_run_id => l_interface_run_id ,
511 P_org_id => NULL
512 );
513
514 fnd_file.put_line(fnd_file.log, '==========================================================================');
515 fnd_Message.Set_name('IGS', 'IGS_UC_RTRN_ADM_IMP_PROC') ;
516 fnd_message.set_token('TIME', TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
517 fnd_file.put_line(fnd_file.log, fnd_message.get);
518 fnd_file.put_line(fnd_file.log, '==========================================================================');
519
520 EXCEPTION
521 WHEN OTHERS THEN
522 -- even though the admission import process completes in error , this process should continue processing
523
524 -- Close any open cursors
525 IF cur_match_set%ISOPEN THEN
526 CLOSE cur_match_set;
527 END IF;
528
529 fnd_Message.Set_name('IGS','IGS_GE_UNHANDLED_EXP');
530 fnd_message.set_token('NAME','IGS_UC_PROC_APPLICATION_DATA.PROC_INVOKE_ADM_IMP_PROCESS'||' - '||SQLERRM);
531 fnd_file.put_line(fnd_file.LOG,fnd_message.get());
532
533 END proc_invoke_adm_imp_process;
534
535
536
537
538 PROCEDURE process_ivstarn IS
539 /******************************************************************
540 Created By : rgangara
541 Date Created By : 12-JUNE-2003
542 Purpose : For processing IVSTARN - Applicant Name details from UCAS.
543 Known limitations,enhancements,remarks:
544 Change History
545 Who When What
546 rgangara 29-APR-04 Bug# 3601118. Modified processing of IVSTARN record to flag|
547 and generate Adm Imp Batch ID even when the APPNO rec exists
548 in IGS_UC_APPLICANTS table and does not in App Names.
549 jchakrab 27-JUL-04 Modified for UCFD308 - UCAS - 2005 Regulatory Changes
550 jbaber 11-JUL-06 Modified for UCFD325 - UCAS - 2007 Regulatory Changes
551 ******************************************************************/
552
553 -- get the records from interface tables where status is NEW.
554 CURSOR new_ivstarn_cur IS
555 SELECT ivstn.rowid,
556 ivstn.*
557 FROM igs_uc_istarn_ints ivstn
558 WHERE ivstn.record_status = 'N';
559
560
561 -- check for corresponding record in UCAS Names table.
562 CURSOR old_starn_cur(p_appno igs_uc_app_names.app_no%TYPE) IS
563 SELECT uapn.rowid,
564 uapn.*
565 FROM igs_uc_app_names uapn
566 WHERE uapn.app_no = p_appno;
567
568
569 -- check for corresponding record in UCAS Applicants table.
570 CURSOR old_appl_cur(p_appno igs_uc_applicants.app_no%TYPE) IS
571 SELECT ucap.rowid,
572 ucap.*
573 FROM igs_uc_applicants ucap
574 WHERE ucap.app_no = p_appno;
575
576
577 appl_rec old_appl_cur%ROWTYPE;
578
579 -- Get the system to which the APplication belongs
580 -- Cursor to fetch the Application Number Range of all the Systems supported by UCAS
581 CURSOR cur_ucas_control (p_appno igs_uc_ucas_control.appno_maximum%TYPE) IS
582 SELECT system_code
583 FROM igs_uc_ucas_control
584 WHERE ucas_cycle = (2000 + TO_NUMBER(SUBSTR(LPAD(TO_CHAR(p_appno),8,'0'),0,2)))
585 AND p_appno BETWEEN appno_first AND appno_maximum;
586
587
588 -- To get the OSS eqvivalent value for UCAS Value.
589 CURSOR cur_map (p_assoc igs_he_code_map_val.association_code%TYPE ,
590 p_map1 igs_he_code_map_val.map1%TYPE ) IS
591 SELECT map2
592 FROM igs_he_code_map_val
593 WHERE association_code = p_assoc
594 AND map1 = p_map1;
595
596 -- TITLE validation
597 CURSOR cur_chk_adjunct (p_adjunct fnd_lookup_values.lookup_code%TYPE) IS
598 SELECT lookup_code
599 FROM fnd_lookup_values
600 WHERE lookup_Type = 'CONTACT_TITLE'
601 AND lookup_code = p_adjunct
602 AND enabled_flag = 'Y'
603 AND LANGUAGE = USERENV('LANG') AND view_application_id = 222 AND security_group_id(+) = 0;
604
605 -- Get the Source Type ID value
606 CURSOR src_types_cur IS
607 SELECT source_type_id
608 FROM igs_pe_src_types_all
609 WHERE source_type = 'UCAS PER';
610
611 -- Cursor to get the Interface ID needed while populating records into Adm Interface table.
612 CURSOR get_interface_id IS
613 SELECT igs_ad_interface_s.NEXTVAL
614 FROM DUAL;
615
616 -- cursor to get the batch ID from sequence.
617 CURSOR get_batch_id_cur IS
618 SELECT igs_ad_interface_batch_id_s.NEXTVAL
619 FROM DUAL;
620
621 -- cursor to get the batch ID from sequence.
622 CURSOR get_alt_pers_id_cur IS
623 SELECT igs_ad_api_int_s.NEXTVAL
624 FROM DUAL;
625
626 old_starn_rec old_starn_cur%ROWTYPE;
627 l_oss_title igs_pe_person_base_v.title%TYPE;
628 l_system_code igs_uc_ucas_control.system_code%TYPE;
629 l_invoke_adm_import_Proc_flag VARCHAR2(1) ; -- Flag to identify atleast one new rec imported
630 l_new_rec_flag VARCHAR2(1); -- flag to check whether a new record (i.e. insert) or old record(i.e.update)
631 l_recs_inserted NUMBER := 0;
632 l_alt_pers_id_type igs_ad_api_int.person_id_type%TYPE;
633
634 -- for populating into Adm Int tables
635 l_created_by NUMBER ;
636 l_last_updated_by NUMBER ;
637 l_last_update_login NUMBER ;
638 l_creation_date DATE ;
639 l_last_update_date DATE ;
640 l_alt_pers_seq_id igs_ad_api_int.interface_api_id%TYPE; -- for holding Alternate Person ID sequence
641 l_adm_batch_id igs_ad_imp_batch_det.batch_id%TYPE; -- for holding Adm Imp Proc batch ID.
642 l_source_type_id igs_pe_src_types_all.source_type_id%TYPE;
643 l_interface_id igs_ad_interface_all.interface_id%TYPE;
644 l_oss_sex_val igs_ad_interface_all.sex%TYPE;
645
646 BEGIN
647 -- initialize variables
648 l_created_by := fnd_global.user_id;
649 l_last_updated_by := l_created_by;
650 l_last_update_login := fnd_global.login_id;
651 l_creation_date := SYSDATE;
652 l_last_update_date := l_creation_date;
653
654 -- initialize variables
655 g_success_rec_cnt := 0;
656 g_error_rec_cnt := 0;
657 g_error_code := NULL;
658 l_invoke_adm_import_Proc_flag := 'N';
659
660 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
661 fnd_message.set_token('VIEW', 'IVSTARN ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
662 fnd_file.put_line(fnd_file.log, fnd_message.get);
663
664 ----------------------------------------------------
665 -- Derive the SOURCE TYPE ID value for UCAS PER.
666 -- Derived only once per execution of this procedure
667 -----------------------------------------------------
668 OPEN src_types_cur;
669 FETCH src_types_cur INTO l_source_type_id;
670
671 IF (src_types_cur%NOTFOUND) THEN
672 CLOSE src_types_cur;
673 fnd_message.set_name('IGS','IGS_UC_NO_UCAS_SRC_TYP');
674 fnd_file.put_line(fnd_file.log, fnd_message.get);
675 App_Exception.Raise_Exception;
676 END IF;
677 CLOSE src_types_cur;
678
679
680 ------------------------------------------
681 -- RECORD LEVEL PROCESSING BEGINS
682 ------------------------------------------
683
684 -- Get all the reocords from interface table with status = 'N'
685 FOR new_ivstarn_rec IN new_ivstarn_cur
686 LOOP
687
688 BEGIN
689 -- initialize record level variables.
690 g_error_code := NULL;
691 old_starn_rec := NULL;
692 l_system_code := NULL;
693 l_oss_title := NULL;
694 appl_rec := NULL;
695 l_new_rec_flag := 'N';
696 l_interface_id := 0;
697 l_alt_pers_seq_id := 0;
698
699 -- log record processing info.
700 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
701 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstarn_rec.appno));
702 fnd_file.put_line(fnd_file.log, fnd_message.get);
703
704
705 SAVEPOINT ivstarn_rec_savepoint;
706
707 -- no mandatory field validations as this is an update
708 IF new_ivstarn_rec.appno IS NULL OR new_ivstarn_rec.surname IS NULL
709 THEN
710 g_error_code := '1037';
711 END IF;
712
713
714 ----------------------------------------------------
715 -- Derive the SYSTEM to which the Application belongs
716 -----------------------------------------------------
717 -- Find the UCAS System Code of the Application being processed
718 IF g_error_code IS NULL THEN
719 l_system_code := NULL ;
720 OPEN cur_ucas_control (new_ivstarn_rec.appno);
721 FETCH cur_ucas_control INTO l_system_code;
722 CLOSE cur_ucas_control;
723
724 -- If the Application Number is not falling in the application range of any of the UCAS Systems,
725 -- raise an error message and stop processing
726 IF l_system_code IS NULL THEN
727 -- raise error message
728 g_error_code := '1041';
729 END IF;
730
731 -- JCHAKRAB added for UCFD308 - UCAS 2005 changes
732 IF l_system_code = 'S' and g_config_cycle>2004 THEN
733 l_system_code := 'U';
734 END IF;
735
736 END IF;
737
738
739 ------------------------------------------
740 -- Validate PERSONAL ID
741 -- jbaber added for UC325 - UCAS 2007 Support
742 ------------------------------------------
743
744 IF g_error_code IS NULL THEN
745
746 IF new_ivstarn_rec.personalid IS NOT NULL THEN
747
748 IF NOT igs_uc_gen_001.validate_personal_id(new_ivstarn_rec.personalid) THEN
749 g_error_code := '1063';
750 END IF;
751
752 END IF;
753
754 END IF;
755
756
757
758 ------------------------------------------
759 -- Derive OSS SEX value from HESA Mappings
760 ------------------------------------------
761
762 IF g_error_code IS NULL THEN
763 -- get the mapping value for Sex
764 l_oss_sex_val := NULL;
765 OPEN cur_map('UC_OSS_HE_GEN_ASSOC', new_ivstarn_rec.sex);
766 FETCH cur_map INTO l_oss_sex_val;
767 CLOSE cur_map;
768
769 IF l_oss_sex_val IS NULL THEN
770 fnd_message.set_name('IGS','IGS_UC_INV_MAPPING_VAL');
771 fnd_message.set_token('CODE', new_ivstarn_rec.sex);
772 fnd_message.set_token('TYPE', 'SEX');
773 fnd_file.put_line(fnd_file.log, fnd_message.get);
774 g_error_code := '1054';
775 END IF;
776
777 END IF;
778
779
780 ------------------------------------------
781 -- Birthdate value check
782 ------------------------------------------
783
784 IF g_error_code IS NULL THEN
785 IF new_ivstarn_rec.birthdate > SYSDATE THEN
786 g_error_code := '1007';
787 END IF;
788
789 END IF;
790
791
792 ------------------------------------------
793 -- Validate/Derive OSS TITLE value
794 ------------------------------------------
795 -- get the corresponding OSS title value for the incoming UCAS Title
796 l_oss_title := NULL;
797 IF new_ivstarn_rec.title IS NOT NULL THEN
798
799 -- Validating the data against the Lookups
800 OPEN cur_chk_adjunct(new_ivstarn_rec.title);
801 FETCH cur_chk_adjunct INTO l_oss_title;
802 IF cur_chk_adjunct%NOTFOUND THEN
803 CLOSE cur_chk_adjunct;
804
805 -- check whether no match found was because of the FULLSTOP in the end. and recheck with '.'
806 OPEN cur_chk_adjunct(new_ivstarn_rec.title || '.');
807 FETCH cur_chk_adjunct INTO l_oss_title;
808
809 IF cur_chk_adjunct%NOTFOUND THEN
810 -- log appropriate message and pass UCAS Title as NULL to OSS Pre name adjunct field.
811 -- The record should get processed with TITLE as NULL.
812 fnd_message.set_name('IGS','IGS_UC_INVALID_TITLE');
813 fnd_message.set_token('UCAS_TITLE', new_ivstarn_rec.title);
814 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarn_rec.appno));
815 fnd_file.put_line(fnd_file.log, fnd_message.get);
816 new_ivstarn_rec.title := NULL;
817
818 ELSE -- since found with '.', append it to Title.
819 new_ivstarn_rec.title := new_ivstarn_rec.title || '.';
820 END IF;
821 CLOSE cur_chk_adjunct;
822
823 ELSE
824 CLOSE cur_chk_adjunct;
825 END IF;
826 END IF;
827 -- end of UCAS Title validation
828
829
830 ----------------------------------------------------------------------------------
831 -- Insert/Update data into UCAS Applicants table.
832 -- Though this could be the first step. It has been put here after all validations
833 -- to avoid an insert till all validations are successful. Since a ROLLBACK happens
834 -- whenever any validation fails an insert before such failure is also rolled back.
835 ------------------------------------------------------------------------------------
836
837 IF g_error_code IS NULL THEN
838
839 -- log appropriate message
840 fnd_message.set_name('IGS','IGS_UC_PROC_UCAS_APP');
841 fnd_file.put_line(fnd_file.log, fnd_message.get);
842
843 -- check whether the Application rec already exists in UCAS Applicants table.
844 OPEN old_appl_cur(new_ivstarn_rec.appno);
845 FETCH old_appl_cur INTO appl_rec;
846 CLOSE old_appl_cur;
847
848 IF appl_rec.rowid IS NULL THEN
849
850 -- since corresponding record does not exist in UCAS APplicants, Insert a record with basic details.
851 BEGIN
852 igs_uc_applicants_pkg.insert_row -- IGSXI01B.pls
853 (
854 x_rowid => appl_rec.rowid
855 ,x_app_id => appl_rec.app_id -- can be used since this rec variable would be null
856 ,x_app_no => new_ivstarn_rec.appno
857 ,x_check_digit => new_ivstarn_rec.checkdigit
858 ,x_personal_id => new_ivstarn_rec.personalid
859 ,x_enquiry_no => appl_rec.enquiry_no -- IN OUT parameter. hence rec variable is used.
860 ,x_oss_person_id => NULL
861 ,x_application_source => 'U' -- hard coded for UCAS
862 ,x_name_change_date => NULL
863 ,x_student_support => NULL
864 ,x_address_area => NULL
865 ,x_application_date => NULL
866 ,x_application_sent_date => NULL
867 ,x_application_sent_run => NULL
868 ,x_lea_code => NULL
869 ,x_fee_payer_code => NULL
870 ,x_fee_text => NULL
871 ,x_domicile_apr => NULL
872 ,x_code_changed_date => NULL
873 ,x_school => NULL
874 ,x_withdrawn => NULL
875 ,x_withdrawn_date => NULL
876 ,x_rel_to_clear_reason => NULL
877 ,x_route_b => 'N' -- default initialization
878 ,x_exam_change_date => NULL
879 ,x_a_levels => NULL
880 ,x_as_levels => NULL
881 ,x_highers => NULL
882 ,x_csys => NULL
883 ,x_winter => NULL
884 ,x_previous => NULL
885 ,x_gnvq => NULL
886 ,x_btec => NULL
887 ,x_ilc => NULL
888 ,x_ailc => NULL
889 ,x_ib => NULL
890 ,x_manual => NULL
891 ,x_reg_num => NULL
892 ,x_oeq => NULL
893 ,x_eas => NULL
894 ,x_roa => NULL
895 ,x_status => NULL
896 ,x_firm_now => NULL
897 ,x_firm_reply => NULL
898 ,x_insurance_reply => NULL
899 ,x_conf_hist_firm_reply => NULL
900 ,x_conf_hist_ins_reply => NULL
901 ,x_residential_category => NULL
902 ,x_personal_statement => NULL
903 ,x_match_prev => NULL
904 ,x_match_prev_date => NULL
905 ,x_match_winter => NULL
906 ,x_match_summer => NULL
907 ,x_gnvq_date => NULL
908 ,x_ib_date => NULL
909 ,x_ilc_date => NULL
910 ,x_ailc_date => NULL
911 ,x_gcseqa_date => NULL
912 ,x_uk_entry_date => NULL
913 ,x_prev_surname => NULL
914 ,x_criminal_convictions => NULL
915 ,x_sent_to_hesa => 'N'
916 ,x_sent_to_oss => 'N'
917 ,x_batch_identifier => NULL
918 ,x_mode => 'R'
919 ,x_GCE => NULL
920 ,x_VCE => NULL
921 ,x_SQA => NULL
922 ,x_PREVIOUSAS => NULL
923 ,x_KEYSKILLS => NULL
924 ,x_VOCATIONAL => NULL
925 ,x_SCN => NULL
926 ,x_PrevOEQ => NULL
927 ,x_choices_transparent_ind => NULL
928 ,x_extra_status => NULL
929 ,x_extra_passport_no => NULL
930 ,x_request_app_dets_ind => NULL
931 ,x_request_copy_app_frm_ind => NULL
932 ,x_cef_no => NULL
933 ,x_system_code => l_system_code
934 ,x_gcse_eng => NULL
935 ,x_gcse_math => NULL
936 ,x_degree_subject => NULL
937 ,x_degree_status => NULL
938 ,x_degree_class => NULL
939 ,x_gcse_sci => NULL
940 ,x_welshspeaker => NULL
941 ,x_ni_number => NULL
942 ,x_earliest_start => NULL
943 ,x_near_inst => NULL
944 ,x_pref_reg => NULL
945 ,x_qual_eng => NULL
946 ,x_qual_math => NULL
947 ,x_qual_sci => NULL
948 ,x_main_qual => NULL
949 ,x_qual_5 => NULL
950 ,x_future_serv => NULL
951 ,x_future_set => NULL
952 ,x_present_serv => NULL
953 ,x_present_set => NULL
954 ,x_curr_employment => NULL
955 ,x_edu_qualification => NULL
956 );
957
958 -- l_new_rec_flag := 'Y'; -- flag identifying a new record i.e. insert into UC Applicants.
959
960 EXCEPTION
961 WHEN OTHERS THEN
962 g_error_code := '1056';
963 fnd_file.put_line(fnd_file.log, SQLERRM);
964 END;
965
966 ELSE
967 -- no update to IGS_UC_APPLICANTS from this procedure. Only insert is allowed
968 -- first time to ensure that this remains the main table for all further validations
969 -- All the other field values for the above record are populated in IVSTARK.
970 NULL;
971 END IF; -- uc appliants insert check
972
973 END IF; -- error code check for inserting into UC applicants
974
975
976 ----------------------------------------------------------------------------------------
977 -- Beginning processing for IGS_UC_APP_NAMES table
978 -- Ideally, an insert into UC_APPLICANTS must result in Insert into UC_APP_NAMES.
979 ----------------------------------------------------------------------------------------
980 IF g_error_code IS NULL THEN
981
982 -- log appropriate message
983 fnd_message.set_name('IGS','IGS_UC_PROC_UCAS_NAMES');
984 fnd_file.put_line(fnd_file.log, fnd_message.get);
985
986
987 -- check whether the Application rec already exists in UCAS NAMES table.
988 OPEN old_starn_cur(new_ivstarn_rec.appno);
989 FETCH old_starn_cur INTO old_starn_rec;
990 CLOSE old_starn_cur;
991
992 IF old_starn_rec.rowid IS NULL THEN
993 -- since corresponding record does not exist in UCAS APplicants, Insert a record with basic details.
994 BEGIN
995 -- call the insert row to insert a new record
996 igs_uc_app_names_pkg.insert_row
997 (
998 x_rowid => old_starn_rec.rowid, -- while insert this rec variable would be null.
999 x_app_no => new_ivstarn_rec.appno,
1000 x_check_digit => new_ivstarn_rec.checkdigit,
1001 x_name_change_date => new_ivstarn_rec.namechangedate,
1002 x_title => new_ivstarn_rec.title,
1003 x_fore_names => new_ivstarn_rec.forenames,
1004 x_surname => new_ivstarn_rec.surname,
1005 x_birth_date => new_ivstarn_rec.birthdate,
1006 x_sex => new_ivstarn_rec.sex,
1007 x_sent_to_oss_flag => 'N',
1008 x_mode => 'R'
1009 );
1010
1011 l_new_rec_flag := 'Y'; -- flag identifying a new record i.e. insert into UC Applicants.
1012
1013 EXCEPTION
1014 WHEN OTHERS THEN
1015 g_error_code := '9999';
1016 fnd_file.put_line(fnd_file.log, SQLERRM);
1017 END;
1018
1019 ELSE -- Corr. rec exists in UCAS Names table hence going for update.
1020
1021 BEGIN
1022 -- call the update row to update existing record in UC APP NAMES table.
1023 igs_uc_app_names_pkg.update_row
1024 (
1025 x_rowid => old_starn_rec.rowid, -- while insert this rec variable would be null.
1026 x_app_no => old_starn_rec.app_no,
1027 x_check_digit => old_starn_rec.check_digit,
1028 x_name_change_date => new_ivstarn_rec.namechangedate,
1029 x_title => new_ivstarn_rec.title,
1030 x_fore_names => new_ivstarn_rec.forenames,
1031 x_surname => new_ivstarn_rec.surname,
1032 x_birth_date => new_ivstarn_rec.birthdate,
1033 x_sex => new_ivstarn_rec.sex,
1034 x_sent_to_oss_flag => 'N',
1035 x_mode => 'R'
1036 );
1037
1038 EXCEPTION
1039 WHEN OTHERS THEN
1040 g_error_code := '9998';
1041 fnd_file.put_line(fnd_file.log, SQLERRM);
1042 END;
1043
1044 END IF; -- insert/update APP NAMES table.
1045
1046 END IF; -- beginning of processing for APP NAMES table
1047 -----------------------------------------------
1048 -- End of processing for IGS_UC_APP_NAMES table
1049 -----------------------------------------------
1050
1051
1052 -----------------------------------------------
1053 -- POPULATING ADMISSION IMPORT PROCESS TABLES
1054 -----------------------------------------------
1055 IF g_error_code IS NULL AND l_new_rec_flag = 'Y' THEN
1056
1057 -- Flag control to check so that it is only exectued once for getting Batch ID.
1058 IF l_invoke_adm_import_Proc_flag = 'N' THEN
1059
1060 BEGIN
1061
1062 -- i.e. atleast one record is new and need to be populated into Adm Imp table
1063 -- set the flag to Y
1064 l_invoke_adm_import_Proc_flag := 'Y'; -- to indicate that Adm Imp Proc has to be called
1065
1066 -- Derive the Adm Import process Batch ID as there is atleast one new record.
1067 ----------------------------------------------------------------------------
1068 -- Derive the ADM BATCH ID for this run and populate a record in Batch table.
1069 -----------------------------------------------------------------------------
1070 -- get the Batch ID from sequence
1071 OPEN get_batch_id_cur;
1072 FETCH get_batch_id_cur INTO l_adm_batch_id;
1073 CLOSE get_batch_id_cur ;
1074
1075 -- log appropriate message
1076 fnd_message.set_name('IGS','IGS_UC_ADM_IMP_BATCH_ID');
1077 fnd_message.set_token('BATCHID', TO_CHAR(l_adm_batch_id));
1078 fnd_file.put_line(fnd_file.log, fnd_message.get);
1079
1080 -- Populate a batch record into Adm Batch table
1081 INSERT INTO igs_ad_imp_batch_det ( batch_id,
1082 batch_desc,
1083 created_by,
1084 creation_date,
1085 last_updated_by,
1086 last_update_date,
1087 last_update_login,
1088 request_id,
1089 program_application_id,
1090 program_update_date,
1091 program_id)
1092 VALUES ( l_adm_batch_id,
1093 fnd_message.get_string('IGS','IGS_UC_IMP_FROM_UCAS_BATCH_ID'),
1094 fnd_global.user_id,
1095 SYSDATE,
1096 fnd_global.user_id,
1097 SYSDATE,
1098 fnd_global.login_id,
1099 DECODE(fnd_global.conc_request_id,-1,NULL,fnd_global.conc_request_id),
1100 DECODE(fnd_global.conc_request_id,-1,NULL,fnd_global.prog_appl_id),
1101 DECODE(fnd_global.conc_request_id,-1,NULL,SYSDATE),
1102 DECODE(fnd_global.conc_request_id,-1,NULL,fnd_global.conc_program_id)
1103 );
1104
1105 EXCEPTION
1106 WHEN OTHERS THEN
1107 g_error_code := '9999';
1108 fnd_file.put_line(fnd_file.log, SQLERRM);
1109 END;
1110
1111 END IF; -- Flag check
1112
1113 -- Populating person details into Adm Interface table
1114 IF g_error_code IS NULL THEN
1115 BEGIN
1116 fnd_message.set_name('IGS','IGS_UC_APP_REC_INTO_ADM');
1117 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarn_rec.appno));
1118 fnd_file.put_line(fnd_file.log, fnd_message.get);
1119
1120 -- get the IGS_AD_INTERFACE ID.
1121 OPEN get_interface_id;
1122 FETCH get_interface_id INTO l_interface_id;
1123 CLOSE get_interface_id ;
1124
1125
1126 -- Populate Adm Interface table.
1127 INSERT INTO igs_ad_interface_all
1128 (
1129 interface_id,
1130 batch_id,
1131 source_type_id,
1132 surname,
1133 given_names,
1134 sex,
1135 birth_dt,
1136 pre_name_adjunct,
1137 status,
1138 record_status,
1139 pref_alternate_id,
1140 created_by,
1141 creation_date,
1142 last_updated_by,
1143 last_update_date,
1144 last_update_login
1145 )
1146 VALUES
1147 (
1148 l_interface_id,
1149 l_adm_batch_id,
1150 l_source_type_id,
1151 new_ivstarn_rec.surname,
1152 NVL(new_ivstarn_rec.forenames,'*'), -- given name
1153 l_oss_sex_val, -- sex
1154 new_ivstarn_rec.birthdate,
1155 new_ivstarn_rec.title,
1156 '2', -- status
1157 '2', -- record status
1158 NULL,
1159 l_created_by,
1160 l_creation_date,
1161 l_last_updated_by,
1162 l_last_update_date,
1163 l_last_update_login
1164 );
1165
1166 -- log appropriate message
1167 fnd_message.set_name('IGS','IGS_UC_ADM_IMP_INT_ID');
1168 fnd_message.set_token('INT_ID', TO_CHAR(l_interface_id));
1169 fnd_file.put_line(fnd_file.log, fnd_message.get);
1170
1171
1172 EXCEPTION
1173 WHEN OTHERS THEN
1174 g_error_code := '1057'; -- insert error
1175 fnd_file.put_line(fnd_file.log, SQLERRM);
1176
1177 -- Close any Open cursors
1178 IF get_interface_id%ISOPEN THEN
1179 CLOSE get_interface_id;
1180 END IF;
1181 END;
1182 END IF; -- error check
1183
1184 -- Processing for Populating Alternate Person ID table.
1185 IF g_error_code IS NULL THEN
1186
1187 fnd_message.set_name('IGS','IGS_UC_APP_REC_INTO_ALT_PRSN');
1188 fnd_file.put_line(fnd_file.log, fnd_message.get);
1189
1190 --Derive the Alternate Person ID Type based on the system to which the Application belongs.
1191 IF l_system_code = 'U' THEN
1192 l_alt_pers_id_type := 'UCASID';
1193
1194 ELSIF l_system_code = 'G' THEN
1195 l_alt_pers_id_type := 'GTTRID';
1196
1197 ELSIF l_system_code = 'N' THEN
1198 l_alt_pers_id_type := 'NMASID';
1199
1200 ELSIF l_system_code = 'S' THEN
1201 l_alt_pers_id_type := 'SWASID';
1202
1203 ELSE
1204 g_error_code := '1041';
1205
1206 END IF;
1207
1208
1209 -- insert a record into Adm Alternate Person ID Interface table
1210 BEGIN
1211
1212 -- get Alternate Person ID sequence number value.
1213 OPEN get_alt_pers_id_cur;
1214 FETCH get_alt_pers_id_cur INTO l_alt_pers_seq_id;
1215 CLOSE get_alt_pers_id_cur ;
1216
1217 -- insert into table
1218 INSERT INTO igs_ad_api_int
1219 (
1220 interface_api_id
1221 ,interface_id
1222 ,person_id_type
1223 ,alternate_id
1224 ,status
1225 ,created_by
1226 ,creation_date
1227 ,last_updated_by
1228 ,last_update_date
1229 ,last_update_login
1230 )
1231 VALUES
1232 (
1233 l_alt_pers_seq_id
1234 ,l_interface_id
1235 ,l_alt_pers_id_type -- Alternate Person ID Type - Based on system
1236 ,new_ivstarn_rec.appno -- Appno as Alternate Person ID
1237 ,'2'
1238 ,l_created_by
1239 ,l_creation_date
1240 ,l_last_updated_by
1241 ,l_last_update_date
1242 ,l_last_update_login
1243 );
1244
1245 -- log appropriate message
1246 fnd_message.set_name('IGS','IGS_UC_ADM_IMP_API_INT_ID');
1247 fnd_message.set_token('INT_ID', TO_CHAR(l_alt_pers_seq_id));
1248 fnd_file.put_line(fnd_file.log, fnd_message.get);
1249
1250
1251 EXCEPTION
1252 WHEN OTHERS THEN
1253 g_error_code := '1058';
1254 fnd_file.put_line(fnd_file.log, SQLERRM);
1255
1256 -- Close any Open cursors
1257 IF get_alt_pers_id_cur%ISOPEN THEN
1258 CLOSE get_alt_pers_id_cur;
1259 END IF;
1260
1261 END;
1262
1263 END IF; -- processing alternate person ID
1264
1265
1266 IF g_error_code IS NULL THEN
1267 -- update the count for records populated into Adm int table
1268 l_recs_inserted := l_recs_inserted + 1;
1269 END IF;
1270
1271 END IF; -- processing adm import process tables.
1272
1273 EXCEPTION
1274 WHEN OTHERS THEN
1275 -- catch any unhandled/unexpected errors while processing a record.
1276 -- This would enable processing to continue with subsequent records.
1277 ROLLBACK TO ivstarn_rec_savepoint;
1278 g_error_code := '1055';
1279 fnd_file.put_line(fnd_file.log, SQLERRM);
1280
1281 -- Close any Open cursors
1282 IF cur_ucas_control%ISOPEN THEN
1283 CLOSE cur_ucas_control;
1284 END IF;
1285
1286 -- Close any Open cursors
1287 IF cur_map%ISOPEN THEN
1288 CLOSE cur_map;
1289 END IF;
1290
1291 -- Close any Open cursors
1292 IF cur_chk_adjunct%ISOPEN THEN
1293 CLOSE cur_chk_adjunct;
1294 END IF;
1295
1296 -- Close any Open cursors
1297 IF old_appl_cur%ISOPEN THEN
1298 CLOSE old_appl_cur;
1299 END IF;
1300
1301 END;
1302 -----------------------------------------------
1303 -- End of Processing Adm import process tables.
1304 -----------------------------------------------
1305
1306
1307 -----------------------------------------------
1308 -- Updating Interface table record with success or failure
1309 -----------------------------------------------
1310 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
1311 -- while processing the record.
1312 IF g_error_code IS NOT NULL THEN
1313
1314 fnd_message.set_name('IGS','IGS_UC_REC_FAIL_PROC');
1315 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarn_rec.appno));
1316 fnd_file.put_line(fnd_file.log, fnd_message.get);
1317
1318
1319 -- rollback the insert/updates made for this record
1320 ROLLBACK TO ivstarn_rec_savepoint;
1321
1322 UPDATE igs_uc_istarn_ints
1323 SET error_code = g_error_code
1324 WHERE rowid = new_ivstarn_rec.rowid;
1325
1326 -- log error message/meaning.
1327 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
1328
1329 -- update error count
1330 g_error_rec_cnt := g_error_rec_cnt + 1;
1331
1332 ELSE
1333
1334 -- record processed successfully
1335 UPDATE igs_uc_istarn_ints
1336 SET record_status = 'I' , -- 'I' signifies intermediate stage of processing.
1337 error_code = NULL ,
1338 ad_batch_id = l_adm_batch_id,
1339 ad_interface_id = l_interface_id,
1340 ad_api_id = l_alt_pers_seq_id
1341 WHERE rowid = new_ivstarn_rec.rowid;
1342
1343 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
1344 END IF;
1345
1346
1347 END LOOP;
1348
1349 fnd_file.put_line(fnd_file.log, ''); -- to get a blank line
1350 fnd_file.put_line(fnd_file.log, ''); -- to get a blank line
1351 fnd_file.put_line(fnd_file.log, '==========================================================================');
1352 fnd_message.set_name('IGS','IGS_UC_RECS_INTO_AD_INT');
1353 fnd_message.set_token('RECCNT', TO_CHAR(l_recs_inserted));
1354 fnd_file.put_line(fnd_file.log, fnd_message.get);
1355 fnd_file.put_line(fnd_file.log, '==========================================================================');
1356 fnd_file.put_line(fnd_file.log, ''); -- to get a blank line
1357 fnd_file.put_line(fnd_file.log, ''); -- to get a blank line
1358
1359
1360 COMMIT;
1361
1362 --------------------------------------------------------------------------------------------------
1363 -- CALLING ADMISSION IMPORT PROCESS
1364 --------------------------------------------------------------------------------------------------
1365 IF l_invoke_adm_import_Proc_flag = 'Y' AND l_recs_inserted > 0 THEN
1366
1367 -- invoke procedure that calls Adm import process to process the person details populated.
1368 proc_invoke_adm_imp_process (l_adm_batch_id, l_source_type_id);
1369 END IF;
1370
1371
1372 -- call the process to check for successful person creation and update the Inteface record status accordingly.
1373 proc_update_ivstarn_status;
1374
1375
1376 -- call the procedure to populate OSS Person ID into IGS_UC_APPLICANTS.
1377 -- processing continues even if some unhandled excpetion is raised in the called procedure.
1378 proc_populate_oss_person;
1379
1380
1381 -- log processing complete for this view
1382 igs_uc_proc_ucas_data.log_proc_complete('IVSTARN', g_success_rec_cnt, g_error_rec_cnt);
1383
1384 EXCEPTION
1385 WHEN OTHERS THEN
1386 ROLLBACK;
1387 fnd_message.set_name('IGS','IGS_UC_VW_PROC_ERROR');
1388 fnd_message.set_token('VIEW_NAME', 'IVSTARN'||' - '||SQLERRM);
1389 fnd_file.put_line(fnd_file.log, fnd_message.get);
1390 END process_ivstarn;
1391
1392
1393
1394
1395 PROCEDURE process_ivstara IS
1396 /******************************************************************
1397 Created By : rgangara
1398 Date Created By : 12-JUNE-2003
1399 Purpose : For processing Applicant Address info. details from UCAS.
1400 Known limitations,enhancements,remarks:
1401 Change History
1402 Who When What
1403 dsridhar 25-AUG-2003 Bug No: 3108562. Since the Address data has changed,
1404 the sent_to_oss flag in IGS_UC_APPLICANTS has to be reset to 'N'.
1405 jbaber 11-Jul-2006 Added mobile, countrycode and homecountrycode for UCAS 2007 Support
1406 ******************************************************************/
1407
1408 CURSOR new_ivstara_cur IS
1409 SELECT ivsta.rowid,
1410 ivsta.*
1411 FROM igs_uc_istara_ints ivsta
1412 WHERE record_status = 'N';
1413
1414
1415 CURSOR old_stara_cur(p_appno igs_uc_applicants.app_no%TYPE) IS
1416 SELECT appaddr.rowid,
1417 appaddr.*
1418 FROM igs_uc_app_addreses appaddr
1419 WHERE appaddr.app_no = p_appno;
1420
1421 CURSOR appl_details (cp_appno igs_uc_applicants.app_no%TYPE) IS
1422 SELECT app.rowid, app.*
1423 FROM igs_uc_applicants app
1424 WHERE app.app_no = cp_appno;
1425
1426 -- To validate against Country code.
1427 CURSOR validate_country_cur (p_code igs_uc_ref_country.country_code%TYPE) IS
1428 SELECT 'X'
1429 FROM igs_uc_ref_country
1430 WHERE country_code = p_code;
1431
1432 l_valid VARCHAR2(1); -- for holding fetch from cursors for rec exists check.
1433
1434 app_rec appl_details%ROWTYPE;
1435 old_stara_rec old_stara_cur%ROWTYPE ;
1436
1437 BEGIN
1438
1439 -- initialize variables
1440 g_success_rec_cnt := 0;
1441 g_error_rec_cnt := 0;
1442 g_error_code := NULL;
1443 l_valid := NULL;
1444
1445 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
1446 fnd_message.set_token('VIEW', 'IVSTARA ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
1447 fnd_file.put_line(fnd_file.log, fnd_message.get);
1448
1449 -- Get all the reocords from interface table with status = 'N'
1450 FOR new_ivstara_rec IN new_ivstara_cur
1451 LOOP
1452
1453 BEGIN
1454 -- initialize record level variables.
1455 g_error_code := NULL;
1456 old_stara_rec := NULL;
1457 app_rec := NULL;
1458
1459 -- log Application processing message.
1460 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
1461 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstara_rec.appno));
1462 fnd_file.put_line(fnd_file.log, fnd_message.get);
1463
1464
1465 -- mandatory field validations
1466 IF new_ivstara_rec.appno IS NULL THEN
1467 g_error_code := '1037';
1468 END IF;
1469
1470 IF g_error_code IS NULL THEN
1471 -- validate Applicant record details in UCAS Applicants table.
1472 validate_applicant (new_ivstara_rec.appno, g_error_code);
1473 END IF;
1474
1475 ----------------------------
1476 -- COUNTRYCODE validation
1477 ----------------------------
1478 IF g_error_code IS NULL THEN
1479
1480 -- validate Country Code
1481 IF new_ivstara_rec.countrycode IS NOT NULL THEN
1482
1483 OPEN validate_country_cur (new_ivstara_rec.countrycode);
1484 FETCH validate_country_cur INTO l_valid;
1485
1486 IF validate_country_cur%NOTFOUND THEN
1487 g_error_code := '1061';
1488 END IF;
1489
1490 CLOSE validate_country_cur;
1491 END IF;
1492 END IF;
1493 --- end of COUNTRYCODE validation
1494
1495 ----------------------------
1496 -- HOMECOUNTRYCODE validation
1497 ----------------------------
1498 IF g_error_code IS NULL THEN
1499
1500 -- validate Home Country Code
1501 IF new_ivstara_rec.homecountrycode IS NOT NULL THEN
1502
1503 OPEN validate_country_cur (new_ivstara_rec.homecountrycode);
1504 FETCH validate_country_cur INTO l_valid;
1505
1506 IF validate_country_cur%NOTFOUND THEN
1507 g_error_code := '1062';
1508 END IF;
1509
1510 CLOSE validate_country_cur;
1511 END IF;
1512 END IF;
1513 --- end of COUNTRYCODE validation
1514
1515
1516 -- begining main processing
1517 IF g_error_code IS NULL THEN --
1518 -- Check wether the Application record already exists.
1519 -- If exists , update the records otherwise insert a new record.
1520 OPEN old_stara_cur(new_ivstara_rec.appno);
1521 FETCH old_stara_cur INTO old_stara_rec;
1522 CLOSE old_stara_cur;
1523
1524 IF old_stara_rec.rowid IS NULL THEN
1525
1526 BEGIN
1527 --Insert a new record as no corresponding record exists.
1528 igs_uc_app_addreses_pkg.insert_row --
1529 (
1530 x_rowid => old_stara_rec.rowid
1531 ,x_app_no => new_ivstara_rec.appno
1532 ,x_address_area => new_ivstara_rec.addressarea
1533 ,x_address1 => new_ivstara_rec.address1
1534 ,x_address2 => new_ivstara_rec.address2
1535 ,x_address3 => new_ivstara_rec.address3
1536 ,x_address4 => new_ivstara_rec.address4
1537 ,x_post_code => new_ivstara_rec.postcode
1538 ,x_mail_sort => new_ivstara_rec.mailsort
1539 ,x_telephone => new_ivstara_rec.telephone
1540 ,x_fax => new_ivstara_rec.fax
1541 ,x_email => new_ivstara_rec.email
1542 ,x_home_address1 => new_ivstara_rec.homeaddress1
1543 ,x_home_address2 => new_ivstara_rec.homeaddress2
1544 ,x_home_address3 => new_ivstara_rec.homeaddress3
1545 ,x_home_address4 => new_ivstara_rec.homeaddress4
1546 ,x_home_postcode => new_ivstara_rec.homepostcode
1547 ,x_home_phone => new_ivstara_rec.homephone
1548 ,x_home_fax => new_ivstara_rec.homefax
1549 ,x_home_email => new_ivstara_rec.homeemail
1550 ,x_sent_to_oss_flag => 'N'
1551 ,x_mobile => new_ivstara_rec.mobile
1552 ,x_country_code => new_ivstara_rec.countrycode
1553 ,x_home_country_code => new_ivstara_rec.homecountrycode
1554 ,x_ad_batch_id => NULL
1555 ,x_ad_interface_id => NULL
1556 ,x_mode => 'R'
1557 );
1558
1559 EXCEPTION
1560 WHEN OTHERS THEN
1561 g_error_code := '9999';
1562 fnd_file.put_line(fnd_file.log, SQLERRM);
1563 END;
1564
1565 ELSE /* Update the record */
1566
1567 BEGIN
1568 -- call the TBH to update the record
1569 igs_uc_app_addreses_pkg.update_row --
1570 (
1571 x_rowid => old_stara_rec.rowid
1572 ,x_app_no => old_stara_rec.app_no
1573 ,x_address_area => new_ivstara_rec.addressarea
1574 ,x_address1 => new_ivstara_rec.address1
1575 ,x_address2 => new_ivstara_rec.address2
1576 ,x_address3 => new_ivstara_rec.address3
1577 ,x_address4 => new_ivstara_rec.address4
1578 ,x_post_code => new_ivstara_rec.postcode
1579 ,x_mail_sort => new_ivstara_rec.mailsort
1580 ,x_telephone => new_ivstara_rec.telephone
1581 ,x_fax => new_ivstara_rec.fax
1582 ,x_email => new_ivstara_rec.email
1583 ,x_home_address1 => new_ivstara_rec.homeaddress1
1584 ,x_home_address2 => new_ivstara_rec.homeaddress2
1585 ,x_home_address3 => new_ivstara_rec.homeaddress3
1586 ,x_home_address4 => new_ivstara_rec.homeaddress4
1587 ,x_home_postcode => new_ivstara_rec.homepostcode
1588 ,x_home_phone => new_ivstara_rec.homephone
1589 ,x_home_fax => new_ivstara_rec.homefax
1590 ,x_home_email => new_ivstara_rec.homeemail
1591 ,x_sent_to_oss_flag => 'N'
1592 ,x_mobile => new_ivstara_rec.mobile
1593 ,x_country_code => new_ivstara_rec.countrycode
1594 ,x_home_country_code => new_ivstara_rec.homecountrycode
1595 ,x_ad_batch_id => old_stara_rec.ad_batch_id
1596 ,x_ad_interface_id => old_stara_rec.ad_interface_id
1597 ,x_mode => 'R'
1598 );
1599
1600 -- Bug No: 3108562. Since the Address data has changed, the sent_to_oss flag in
1601 -- IGS_UC_APPLICANTS has to be reset to 'N'.
1602 OPEN appl_details(old_stara_rec.app_no);
1603 FETCH appl_details INTO app_rec;
1604 CLOSE appl_details;
1605
1606 IF app_rec.app_no IS NULL THEN
1607 g_error_code := '1000';
1608 ELSE
1609
1610 -- call the TBH to update the record setting sent to OSS as No.
1611 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
1612 (
1613 x_rowid => app_rec.rowid
1614 ,x_app_id => app_rec.app_id
1615 ,x_app_no => app_rec.app_no
1616 ,x_check_digit => app_rec.check_digit
1617 ,x_personal_id => app_rec.personal_id
1618 ,x_enquiry_no => app_rec.enquiry_no
1619 ,x_oss_person_id => app_rec.oss_person_id
1620 ,x_application_source => app_rec.application_source
1621 ,x_name_change_date => app_rec.name_change_date
1622 ,x_student_support => app_rec.student_support
1623 ,x_address_area => app_rec.address_area
1624 ,x_application_date => app_rec.application_date
1625 ,x_application_sent_date => app_rec.application_sent_date
1626 ,x_application_sent_run => app_rec.application_sent_run
1627 ,x_lea_code => NULL -- obsoleted by UCAS
1628 ,x_fee_payer_code => app_rec.fee_payer_code
1629 ,x_fee_text => app_rec.fee_text
1630 ,x_domicile_apr => app_rec.domicile_apr
1631 ,x_code_changed_date => app_rec.code_changed_date
1632 ,x_school => app_rec.school
1633 ,x_withdrawn => app_rec.withdrawn
1634 ,x_withdrawn_date => app_rec.withdrawn_date
1635 ,x_rel_to_clear_reason => app_rec.rel_to_clear_reason
1636 ,x_route_b => app_rec.route_b
1637 ,x_exam_change_date => app_rec.exam_change_date
1638 ,x_a_levels => NULL -- obsoleted by UCAS
1639 ,x_as_levels => NULL -- obsoleted by UCAS
1640 ,x_highers => NULL -- obsoleted by UCAS
1641 ,x_csys => NULL -- obsoleted by UCAS
1642 ,x_winter => app_rec.winter
1643 ,x_previous => app_rec.previous
1644 ,x_gnvq => NULL -- obsoleted by UCAS
1645 ,x_btec => app_rec.btec
1646 ,x_ilc => app_rec.ilc
1647 ,x_ailc => app_rec.ailc
1648 ,x_ib => app_rec.ib
1649 ,x_manual => app_rec.manual
1650 ,x_reg_num => app_rec.reg_num
1651 ,x_oeq => app_rec.oeq
1652 ,x_eas => app_rec.eas
1653 ,x_roa => app_rec.roa
1654 ,x_status => app_rec.status
1655 ,x_firm_now => app_rec.firm_now
1656 ,x_firm_reply => app_rec.firm_reply
1657 ,x_insurance_reply => app_rec.insurance_reply
1658 ,x_conf_hist_firm_reply => app_rec.conf_hist_firm_reply
1659 ,x_conf_hist_ins_reply => app_rec.conf_hist_ins_reply
1660 ,x_residential_category => app_rec.residential_category
1661 ,x_personal_statement => app_rec.personal_statement
1662 ,x_match_prev => app_rec.match_prev
1663 ,x_match_prev_date => app_rec.match_prev_date
1664 ,x_match_winter => app_rec.match_winter
1665 ,x_match_summer => app_rec.match_summer
1666 ,x_gnvq_date => app_rec.gnvq_date
1667 ,x_ib_date => app_rec.ib_date
1668 ,x_ilc_date => app_rec.ilc_date
1669 ,x_ailc_date => app_rec.ailc_date
1670 ,x_gcseqa_date => app_rec.gcseqa_date
1671 ,x_uk_entry_date => app_rec.uk_entry_date
1672 ,x_prev_surname => app_rec.prev_surname
1673 ,x_criminal_convictions => app_rec.criminal_convictions
1674 ,x_sent_to_hesa => app_rec.sent_to_hesa
1675 ,x_sent_to_oss => 'N'
1676 ,x_batch_identifier => app_rec.batch_identifier
1677 ,x_mode => 'R'
1678 ,x_GCE => app_rec.GCE
1679 ,x_VCE => app_rec.VCE
1680 ,x_SQA => app_rec.SQA
1681 ,x_PREVIOUSAS => app_rec.previousas
1682 ,x_KEYSKILLS => app_rec.keyskills
1683 ,x_VOCATIONAL => app_rec.vocational
1684 ,x_SCN => app_rec.SCN
1685 ,x_PrevOEQ => app_rec.PrevOEQ
1686 ,x_choices_transparent_ind => app_rec.choices_transparent_ind
1687 ,x_extra_status => app_rec.extra_status
1688 ,x_extra_passport_no => app_rec.extra_passport_no
1689 ,x_request_app_dets_ind => app_rec.request_app_dets_ind
1690 ,x_request_copy_app_frm_ind => app_rec.request_copy_app_frm_ind
1691 ,x_cef_no => app_rec.cef_no
1692 ,x_system_code => app_rec.system_code
1693 ,x_gcse_eng => app_rec.gcse_eng
1694 ,x_gcse_math => app_rec.gcse_math
1695 ,x_degree_subject => app_rec.degree_subject
1696 ,x_degree_status => app_rec.degree_status
1697 ,x_degree_class => app_rec.degree_class
1698 ,x_gcse_sci => app_rec.gcse_sci
1699 ,x_welshspeaker => app_rec.welshspeaker
1700 ,x_ni_number => app_rec.ni_number
1701 ,x_earliest_start => app_rec.earliest_start
1702 ,x_near_inst => app_rec.near_inst
1703 ,x_pref_reg => app_rec.pref_reg
1704 ,x_qual_eng => app_rec.qual_eng
1705 ,x_qual_math => app_rec.qual_math
1706 ,x_qual_sci => app_rec.qual_sci
1707 ,x_main_qual => app_rec.main_qual
1708 ,x_qual_5 => app_rec.qual_5
1709 ,x_future_serv => app_rec.future_serv
1710 ,x_future_set => app_rec.future_set
1711 ,x_present_serv => app_rec.present_serv
1712 ,x_present_set => app_rec.present_set
1713 ,x_curr_employment => app_rec.curr_employment
1714 ,x_edu_qualification => app_rec.edu_qualification
1715 ,x_ad_batch_id => app_rec.ad_batch_id
1716 ,x_ad_interface_id => app_rec.ad_interface_id
1717 ,x_nationality => app_rec.nationality
1718 ,x_dual_nationality => app_rec.dual_nationality
1719 ,x_special_needs => app_rec.special_needs
1720 ,x_country_birth => app_rec.country_birth
1721 );
1722 END IF;
1723
1724 EXCEPTION
1725 WHEN OTHERS THEN
1726 g_error_code := '9998';
1727 fnd_file.put_line(fnd_file.log, SQLERRM);
1728 END;
1729
1730 END IF; -- insert / update
1731
1732 END IF;
1733
1734 EXCEPTION
1735 WHEN OTHERS THEN
1736 -- catch any unhandled/unexpected errors while processing a record.
1737 -- This would enable processing to continue with subsequent records.
1738 g_error_code := '1055';
1739 fnd_file.put_line(fnd_file.log, SQLERRM);
1740
1741 -- Close any Open cursors
1742 IF old_stara_cur%ISOPEN THEN
1743 CLOSE old_stara_cur;
1744 END IF;
1745
1746 END;
1747
1748 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
1749 -- while processing the record.
1750 IF g_error_code IS NOT NULL THEN
1751 UPDATE igs_uc_istara_ints
1752 SET error_code = g_error_code
1753 WHERE rowid = new_ivstara_rec.rowid;
1754
1755 -- log error message/meaning.
1756 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
1757
1758 -- update error count
1759 g_error_rec_cnt := g_error_rec_cnt + 1;
1760
1761 ELSE
1762 UPDATE igs_uc_istara_ints
1763 SET record_status = 'D',
1764 error_code = NULL
1765 WHERE rowid = new_ivstara_rec.rowid;
1766
1767 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
1768 END IF;
1769
1770 END LOOP;
1771
1772 COMMIT;
1773 -- log processing complete for this view
1774 igs_uc_proc_ucas_data.log_proc_complete('IVSTARA', g_success_rec_cnt, g_error_rec_cnt);
1775
1776 EXCEPTION
1777 WHEN OTHERS THEN
1778 ROLLBACK;
1779 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
1780 fnd_message.set_token('VIEW', 'IVSTARA'||' - '||SQLERRM);
1781 fnd_file.put_line(fnd_file.log, fnd_message.get);
1782 END process_ivstara;
1783
1784
1785
1786 PROCEDURE process_ivstark IS
1787 /******************************************************************
1788 Created By : rgangara
1789 Date Created By : 12-JUNE-2003
1790 Purpose : For processing Applicant info. details from UCAS.
1791 Known limitations,enhancements,remarks:
1792 Change History
1793 Who When What
1794 smaddali 8-aug-03 Modified igs_uc_applicants.update call to update ni_number, criminal_conv,ukentry_date fields,bug#3088436
1795 rgangara 05-FEB-04 Added update to App Stats table for Sent_to_HESA flag as the Domicile data comes in *K transaction but
1796 is exported to OSS along with App Stats data. Without this, the Modified Domicile data cannot be exported
1797 since the process picks only when the said flag is 'N'. Bug# 3405245
1798 jchakrab 23-AUG-04 Modified for Bug#3838781 - Update the system code for existing SWAS applicants in igs_uc_applicants
1799 when applications are re-sent by UCAS, as SWAS applicants need to be identified as FTUG applicants for
1800 ucas_cycle > 2004.
1801 jbaber 15-Sep-05 Modified for bug 4589994 - do not update routeb with NULL value
1802 jchakrab 06-Sep-06 Modified for bug 5481963 - update app-choice records when IVSTARK withdrawn value is W or C
1803 ******************************************************************/
1804
1805 CURSOR new_ivstark_cur IS
1806 SELECT ivstk.rowid,
1807 ivstk.*
1808 FROM igs_uc_istark_ints ivstk
1809 WHERE record_status = 'N';
1810
1811
1812 CURSOR old_stark_cur(p_appno igs_uc_applicants.app_no%TYPE) IS
1813 SELECT appl.rowid,
1814 appl.*
1815 FROM igs_uc_applicants appl
1816 WHERE appl.app_no = p_appno;
1817
1818 -- To validate SPECIALNEEDS, RESCAT, FEEPAYER, STATUS against Reference codes.
1819 CURSOR validate_refcodes_cur (p_type igs_uc_ref_codes.code_type%TYPE,
1820 p_code igs_uc_ref_codes.code%TYPE) IS
1821 SELECT 'X'
1822 FROM igs_uc_ref_codes
1823 WHERE code_type = p_type
1824 AND code = p_code;
1825
1826
1827 -- To validate against Reference code.
1828 CURSOR validate_school_cur (p_school igs_uc_com_sch.school%TYPE) IS
1829 SELECT 'X'
1830 FROM igs_uc_com_sch
1831 WHERE school = p_school;
1832
1833
1834 -- To validate against REF APR table.
1835 CURSOR validate_ref_apr_cur (p_id igs_uc_ref_apr.dom%TYPE) IS
1836 SELECT 'X'
1837 FROM igs_uc_ref_apr
1838 WHERE dom = p_id;
1839
1840 -- To validate against Country code.
1841 CURSOR validate_country_cur (p_code igs_uc_ref_country.country_code%TYPE) IS
1842 SELECT 'X'
1843 FROM igs_uc_ref_country
1844 WHERE country_code = p_code;
1845
1846
1847 -- To Update Sent_to_HESA flag in IGS_UC_APP_STATS when Domicile APR value gets updated in Applicant's table.
1848 -- This is because Domicile code is stored in Applicants table and need to be exported to OSS along with other
1849 -- details held in IGS_UC_APP_STATS table through Export HESA data to OSS porcess.
1850 CURSOR Cur_app_stats (cp_appno igs_uc_app_stats.app_no%TYPE) IS
1851 SELECT stat.rowid,
1852 stat.*
1853 FROM igs_uc_app_stats stat
1854 WHERE app_no = cp_appno;
1855
1856 -- jchakrab added for Bug 5481963 - 06-Sep-2006
1857 -- Retrieves choice records for an applicant in configured cycle and current institution
1858 CURSOR cur_uc_app_choices(p_appno igs_uc_app_choices.app_no%TYPE,
1859 p_ucas_cycle igs_uc_app_choices.ucas_cycle%TYPE,
1860 p_inst_code igs_uc_app_choices.institute_code%TYPE) IS
1861 SELECT uacc.rowid,
1862 uacc.*
1863 FROM igs_uc_app_choices uacc
1864 WHERE uacc.app_no = p_appno
1865 AND uacc.ucas_cycle = p_ucas_cycle
1866 AND uacc.institute_code = p_inst_code;
1867
1868 old_stark_rec old_stark_cur%ROWTYPE ;
1869 l_valid VARCHAR2(1); -- for holding fetch from cursors for rec exists check.
1870
1871 -- jchakrab added for deriving system_code - Bug# 3838781 - 23-Aug-2004
1872 l_system_code igs_uc_applicants.system_code%TYPE;
1873 BEGIN
1874
1875 -- initialize variables
1876 g_success_rec_cnt := 0;
1877 g_error_rec_cnt := 0;
1878 g_error_code := NULL;
1879
1880 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
1881 fnd_message.set_token('VIEW', 'IVSTARK ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
1882 fnd_file.put_line(fnd_file.log, fnd_message.get);
1883
1884 -- Get all the reocords from interface table with status = 'N'
1885 FOR new_ivstark_rec IN new_ivstark_cur
1886 LOOP
1887
1888 BEGIN
1889 -- initialize record level variables.
1890 g_error_code := NULL;
1891 old_stark_rec := NULL;
1892 l_valid := NULL;
1893
1894 -- log Application processing message.
1895 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
1896 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstark_rec.appno));
1897 fnd_file.put_line(fnd_file.log, fnd_message.get);
1898
1899 -- Mandatory field validations.
1900 IF new_ivstark_rec.appno IS NULL THEN
1901 g_error_code := '1037';
1902 END IF;
1903
1904 -- appno validation
1905 IF g_error_code IS NULL THEN
1906 -- validate Applicant record details in UCAS Applicants table.
1907 -- This is because record gets inserted into IGS_UC_APPLICANTS as part of
1908 -- IVSTARN processing and hence at this stage the record must exist.
1909 validate_applicant (new_ivstark_rec.appno, g_error_code);
1910 END IF;
1911
1912
1913 ----------------------------
1914 -- SPECIALNEEDS validation
1915 -- NOTE : The values coming from UCAS have UCAS codes. However, for this field the OSS values are different. While populating
1916 -- these values into ADM Import tables, corresponding OSS values are being derived as part of IGSUCJ44 process from Code Mapping val table.
1917 -- Hence as part of this process UCAS values are being stored in UCAS Applicants table.
1918 ----------------------------
1919 IF g_error_code IS NULL THEN
1920
1921 -- validate specialneeds
1922 IF new_ivstark_rec.specialneeds IS NOT NULL THEN
1923 OPEN validate_refcodes_cur ('DC', new_ivstark_rec.specialneeds);
1924 FETCH validate_refcodes_cur INTO l_valid;
1925
1926 IF validate_refcodes_cur%NOTFOUND THEN
1927 g_error_code := '1009';
1928 END IF;
1929
1930 CLOSE validate_refcodes_cur;
1931 END IF;
1932 END IF;
1933 --- end of SPECIALNEEDS validation
1934
1935
1936 ----------------------------
1937 -- SCHOOL validation
1938 ----------------------------
1939 IF g_error_code IS NULL THEN
1940
1941 -- validate School
1942 IF new_ivstark_rec.school IS NOT NULL THEN
1943
1944 OPEN validate_school_cur (new_ivstark_rec.school);
1945 FETCH validate_school_cur INTO l_valid;
1946
1947 IF validate_school_cur%NOTFOUND THEN
1948 g_error_code := '1010';
1949 END IF;
1950
1951 CLOSE validate_school_cur;
1952 END IF;
1953 END IF;
1954 --- end of SCHOOL validation
1955
1956
1957 ----------------------------
1958 -- RESCAT validation
1959 ----------------------------
1960 IF g_error_code IS NULL THEN
1961
1962 -- validate RESCAT
1963 IF new_ivstark_rec.rescat IS NOT NULL THEN
1964
1965 OPEN validate_refcodes_cur ('RC', new_ivstark_rec.rescat);
1966 FETCH validate_refcodes_cur INTO l_valid;
1967
1968 IF validate_refcodes_cur%NOTFOUND THEN
1969 g_error_code := '1011';
1970 END IF;
1971
1972 CLOSE validate_refcodes_cur;
1973 END IF;
1974 END IF;
1975 --- end of RESCAT validation
1976
1977
1978 ----------------------------
1979 -- FEEPAYER validation
1980 ----------------------------
1981 IF g_error_code IS NULL THEN
1982
1983 -- validate FEEPAYER
1984 IF new_ivstark_rec.feepayer IS NOT NULL THEN
1985
1986 OPEN validate_refcodes_cur ('FC', new_ivstark_rec.feepayer);
1987 FETCH validate_refcodes_cur INTO l_valid;
1988
1989 IF validate_refcodes_cur%NOTFOUND THEN
1990 g_error_code := '1012';
1991 END IF;
1992
1993 CLOSE validate_refcodes_cur;
1994 END IF;
1995 END IF;
1996 --- end of FEEPAYER validation
1997
1998
1999 ----------------------------
2000 -- STATUS validation
2001 ----------------------------
2002 IF g_error_code IS NULL THEN
2003
2004 -- validate STATUS
2005 IF new_ivstark_rec.status IS NOT NULL THEN
2006
2007 OPEN validate_refcodes_cur ('SC', new_ivstark_rec.status);
2008 FETCH validate_refcodes_cur INTO l_valid;
2009
2010 IF validate_refcodes_cur%NOTFOUND THEN
2011 g_error_code := '1017';
2012 END IF;
2013
2014 CLOSE validate_refcodes_cur;
2015 END IF;
2016 END IF;
2017 --- end of STATUS validation
2018
2019
2020 ----------------------------
2021 -- APR validation
2022 ----------------------------
2023 IF g_error_code IS NULL THEN
2024
2025 -- validate APR
2026 IF new_ivstark_rec.apr IS NOT NULL THEN
2027
2028 OPEN validate_ref_apr_cur (new_ivstark_rec.apr);
2029 FETCH validate_ref_apr_cur INTO l_valid;
2030
2031 IF validate_ref_apr_cur%NOTFOUND THEN
2032 g_error_code := '1013';
2033 END IF;
2034
2035 CLOSE validate_ref_apr_cur;
2036 END IF;
2037 END IF;
2038 --- end of APR validation
2039
2040
2041 ----------------------------
2042 -- COUNTRYBIRTH validation
2043 ----------------------------
2044 IF g_error_code IS NULL THEN
2045
2046 -- validate CountryBirth
2047 IF new_ivstark_rec.countrybirth IS NOT NULL THEN
2048
2049 IF g_config_cycle > 2006 THEN
2050
2051 OPEN validate_country_cur (new_ivstark_rec.countrybirth);
2052 FETCH validate_country_cur INTO l_valid;
2053
2054 IF validate_country_cur%NOTFOUND THEN
2055 g_error_code := '1014';
2056 END IF;
2057
2058 CLOSE validate_country_cur;
2059
2060 ELSE
2061
2062 OPEN validate_ref_apr_cur (new_ivstark_rec.countrybirth);
2063 FETCH validate_ref_apr_cur INTO l_valid;
2064
2065 IF validate_ref_apr_cur%NOTFOUND THEN
2066 g_error_code := '1014';
2067 END IF;
2068
2069 CLOSE validate_ref_apr_cur;
2070
2071 END IF;
2072
2073 END IF;
2074
2075 END IF;
2076 --- end of Country Birth validation
2077
2078
2079 ----------------------------
2080 -- NATIONALITY validation
2081 ----------------------------
2082 IF g_error_code IS NULL THEN
2083
2084 -- validate Nationality
2085 IF new_ivstark_rec.nationality IS NOT NULL THEN
2086
2087 IF g_config_cycle > 2006 THEN
2088
2089 OPEN validate_refcodes_cur ('NC', new_ivstark_rec.nationality);
2090 FETCH validate_refcodes_cur INTO l_valid;
2091
2092 IF validate_refcodes_cur%NOTFOUND THEN
2093 g_error_code := '1015';
2094 END IF;
2095
2096 CLOSE validate_refcodes_cur;
2097
2098 ELSE
2099
2100 OPEN validate_ref_apr_cur (new_ivstark_rec.nationality);
2101 FETCH validate_ref_apr_cur INTO l_valid;
2102
2103 IF validate_ref_apr_cur%NOTFOUND THEN
2104 g_error_code := '1015';
2105 END IF;
2106
2107 CLOSE validate_ref_apr_cur;
2108
2109 END IF;
2110
2111 END IF;
2112
2113 END IF;
2114 --- end of Nationality validation
2115
2116
2117
2118 ----------------------------
2119 -- DUALNATIONALITY validation
2120 ----------------------------
2121 IF g_error_code IS NULL THEN
2122
2123 -- validate Dual Nationality
2124 IF new_ivstark_rec.dualnationality IS NOT NULL THEN
2125
2126 IF g_config_cycle > 2006 THEN
2127
2128 OPEN validate_refcodes_cur ('NC', new_ivstark_rec.dualnationality);
2129 FETCH validate_refcodes_cur INTO l_valid;
2130
2131 IF validate_refcodes_cur%NOTFOUND THEN
2132 g_error_code := '1016';
2133 END IF;
2134
2135 CLOSE validate_refcodes_cur;
2136
2137 ELSE
2138
2139 OPEN validate_ref_apr_cur (new_ivstark_rec.dualnationality);
2140 FETCH validate_ref_apr_cur INTO l_valid;
2141
2142 IF validate_ref_apr_cur%NOTFOUND THEN
2143 g_error_code := '1016';
2144 END IF;
2145
2146 CLOSE validate_ref_apr_cur;
2147
2148 END IF;
2149
2150 END IF;
2151
2152 END IF;
2153 --- end of Dual Nationality validation
2154
2155
2156 ----------------------------
2157 -- MAIN PROCESSING Begins
2158 ----------------------------
2159 IF g_error_code IS NULL THEN --
2160
2161 -- Check wether the Application record already exists.
2162 -- If exists , update the records otherwise insert a new record.
2163 OPEN old_stark_cur(new_ivstark_rec.appno);
2164 FETCH old_stark_cur INTO old_stark_rec;
2165 CLOSE old_stark_cur;
2166
2167 IF old_stark_rec.rowid IS NULL THEN
2168 -- this actually is not required as this error would
2169 -- get reported in the validate_applicant procedure itself. However, for
2170 -- logic clarity this has been retained.
2171 g_error_code := '1000';
2172
2173 ELSE /* Update the record */
2174
2175
2176 -- jchakrab added to identify SWAS applicants in cycle > 2004
2177 -- as FTUG applicants - Bug#3838781 - 23-Aug-2004
2178 l_system_code := old_stark_rec.system_code;
2179 IF l_system_code = 'S' and g_config_cycle>2004 THEN
2180 l_system_code := 'U';
2181 END IF;
2182
2183 BEGIN
2184 -- call the TBH to update the record
2185 -- smaddali updating criminal_conv, ukentrydate,ni_number with interface record values as per bug#3088436
2186 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
2187 (
2188 x_rowid => old_stark_rec.rowid
2189 ,x_app_id => old_stark_rec.app_id
2190 ,x_app_no => old_stark_rec.app_no
2191 ,x_check_digit => old_stark_rec.check_digit
2192 ,x_personal_id => old_stark_rec.personal_id
2193 ,x_enquiry_no => old_stark_rec.enquiry_no
2194 ,x_oss_person_id => old_stark_rec.oss_person_id
2195 ,x_application_source => old_stark_rec.application_source
2196 ,x_name_change_date => old_stark_rec.name_change_date
2197 ,x_student_support => old_stark_rec.student_support
2198 ,x_address_area => old_stark_rec.address_area
2199 ,x_application_date => new_ivstark_rec.applicationdate
2200 ,x_application_sent_date => new_ivstark_rec.sentdate
2201 ,x_application_sent_run => new_ivstark_rec.runsent
2202 ,x_lea_code => NULL -- obsoleted by UCAS
2203 ,x_fee_payer_code => new_ivstark_rec.feepayer
2204 ,x_fee_text => new_ivstark_rec.feetext
2205 ,x_domicile_apr => new_ivstark_rec.apr
2206 ,x_code_changed_date => new_ivstark_rec.codedchangedate
2207 ,x_school => new_ivstark_rec.school
2208 ,x_withdrawn => new_ivstark_rec.withdrawn
2209 ,x_withdrawn_date => new_ivstark_rec.withdrawndate
2210 ,x_rel_to_clear_reason => old_stark_rec.rel_to_clear_reason
2211 ,x_route_b => NVL(new_ivstark_rec.routeb, old_stark_rec.route_b)
2212 ,x_exam_change_date => new_ivstark_rec.examchangedate
2213 ,x_a_levels => NULL -- obsoleted by UCAS
2214 ,x_as_levels => NULL -- obsoleted by UCAS
2215 ,x_highers => NULL -- obsoleted by UCAS
2216 ,x_csys => NULL -- obsoleted by UCAS
2217 ,x_winter => new_ivstark_rec.winter
2218 ,x_previous => new_ivstark_rec.previousa
2219 ,x_gnvq => NULL -- obsoleted by UCAS
2220 ,x_btec => new_ivstark_rec.btec
2221 ,x_ilc => new_ivstark_rec.ilc
2222 ,x_ailc => new_ivstark_rec.aice
2223 ,x_ib => new_ivstark_rec.ib
2224 ,x_manual => new_ivstark_rec.manual
2225 ,x_reg_num => new_ivstark_rec.regno
2226 ,x_oeq => new_ivstark_rec.oeq
2227 ,x_eas => new_ivstark_rec.eas
2228 ,x_roa => new_ivstark_rec.roa
2229 ,x_status => new_ivstark_rec.status
2230 ,x_firm_now => new_ivstark_rec.firmnow
2231 ,x_firm_reply => new_ivstark_rec.firmreply
2232 ,x_insurance_reply => new_ivstark_rec.insurancereply
2233 ,x_conf_hist_firm_reply => new_ivstark_rec.confhistfirmreply
2234 ,x_conf_hist_ins_reply => new_ivstark_rec.confhistinsurancereply
2235 ,x_residential_category => new_ivstark_rec.rescat
2236 ,x_personal_statement => old_stark_rec.personal_statement
2237 ,x_match_prev => old_stark_rec.match_prev
2238 ,x_match_prev_date => old_stark_rec.match_prev_date
2239 ,x_match_winter => old_stark_rec.match_winter
2240 ,x_match_summer => old_stark_rec.match_summer
2241 ,x_gnvq_date => old_stark_rec.gnvq_date
2242 ,x_ib_date => old_stark_rec.ib_date
2243 ,x_ilc_date => old_stark_rec.ilc_date
2244 ,x_ailc_date => old_stark_rec.ailc_date
2245 ,x_gcseqa_date => old_stark_rec.gcseqa_date
2246 ,x_uk_entry_date => new_ivstark_rec.ukentrydate
2247 ,x_prev_surname => old_stark_rec.prev_surname
2248 ,x_criminal_convictions => new_ivstark_rec.criminalconv
2249 ,x_sent_to_hesa => 'N'
2250 ,x_sent_to_oss => 'N'
2251 ,x_batch_identifier => old_stark_rec.batch_identifier
2252 ,x_mode => 'R'
2253 ,x_GCE => new_ivstark_rec.GCE
2254 ,x_VCE => new_ivstark_rec.VCE
2255 ,x_SQA => new_ivstark_rec.SQA
2256 ,x_PREVIOUSAS => new_ivstark_rec.previousas
2257 ,x_KEYSKILLS => new_ivstark_rec.keyskills
2258 ,x_VOCATIONAL => new_ivstark_rec.vocational
2259 ,x_SCN => new_ivstark_rec.SCN
2260 ,x_PrevOEQ => new_ivstark_rec.PrevOEQ
2261 ,x_choices_transparent_ind => new_ivstark_rec.choicesalltransparent
2262 ,x_extra_status => new_ivstark_rec.extrastatus
2263 ,x_extra_passport_no => new_ivstark_rec.extrapassportno
2264 ,x_request_app_dets_ind => old_stark_rec.request_app_dets_ind
2265 ,x_request_copy_app_frm_ind => old_stark_rec.request_copy_app_frm_ind
2266 ,x_cef_no => old_stark_rec.cef_no
2267 ,x_system_code => l_system_code -- update the system code - Bug#3838781
2268 ,x_gcse_eng => old_stark_rec.gcse_eng
2269 ,x_gcse_math => old_stark_rec.gcse_math
2270 ,x_degree_subject => old_stark_rec.degree_subject
2271 ,x_degree_status => old_stark_rec.degree_status
2272 ,x_degree_class => old_stark_rec.degree_class
2273 ,x_gcse_sci => old_stark_rec.gcse_sci
2274 ,x_welshspeaker => new_ivstark_rec.welshspeaker
2275 ,x_ni_number => new_ivstark_rec.ninumber
2276 ,x_earliest_start => new_ivstark_rec.earlieststart
2277 ,x_near_inst => new_ivstark_rec.nearinst
2278 ,x_pref_reg => new_ivstark_rec.prefreg
2279 ,x_qual_eng => new_ivstark_rec.qualeng
2280 ,x_qual_math => new_ivstark_rec.qualmath
2281 ,x_qual_sci => new_ivstark_rec.qualsci
2282 ,x_main_qual => new_ivstark_rec.mainqual
2283 ,x_qual_5 => new_ivstark_rec.qual5
2284 ,x_future_serv => old_stark_rec.future_serv
2285 ,x_future_set => old_stark_rec.future_set
2286 ,x_present_serv => old_stark_rec.present_serv
2287 ,x_present_set => old_stark_rec.present_set
2288 ,x_curr_employment => old_stark_rec.curr_employment
2289 ,x_edu_qualification => old_stark_rec.edu_qualification
2290 ,x_ad_batch_id => old_stark_rec.ad_batch_id
2291 ,x_ad_interface_id => old_stark_rec.ad_interface_id
2292 ,x_nationality => new_ivstark_rec.nationality
2293 ,x_dual_nationality => new_ivstark_rec.dualnationality
2294 ,x_special_needs => new_ivstark_rec.specialneeds
2295 ,x_country_birth => new_ivstark_rec.countrybirth
2296 );
2297
2298
2299 -- IF Domicile is updated above, then the sent_to_hesa flag has to be set to 'N'
2300 -- in the App Stats table so that the export HESA data to OSS process picks up
2301 -- the Applicant data. Only the flag is updated if at all the AppNo rec exists.
2302 IF new_ivstark_rec.apr <> old_stark_rec.domicile_apr THEN
2303
2304 FOR Cur_app_stats_rec IN Cur_app_stats (new_ivstark_rec.appno)
2305 LOOP
2306 igs_uc_app_stats_pkg.update_row(
2307 x_rowid => Cur_app_stats_rec.rowid
2308 ,x_app_stat_id => Cur_app_stats_rec.app_stat_id
2309 ,x_app_id => Cur_app_stats_rec.app_id
2310 ,x_app_no => Cur_app_stats_rec.app_no
2311 ,x_starh_ethnic => Cur_app_stats_rec.starh_ethnic
2312 ,x_starh_social_class => Cur_app_stats_rec.starh_social_class
2313 ,x_starh_pocc_edu_chg_dt => Cur_app_stats_rec.starh_pocc_edu_chg_dt
2314 ,x_starh_pocc => Cur_app_stats_rec.starh_pocc
2315 ,x_starh_pocc_text => Cur_app_stats_rec.starh_pocc_text
2316 ,x_starh_last_edu_inst => Cur_app_stats_rec.starh_last_edu_inst
2317 ,x_starh_edu_leave_date => Cur_app_stats_rec.starh_edu_leave_date
2318 ,x_starh_lea => Cur_app_stats_rec.starh_lea
2319 ,x_starx_ethnic => Cur_app_stats_rec.starx_ethnic
2320 ,x_starx_pocc_edu_chg => Cur_app_stats_rec.starx_pocc_edu_chg
2321 ,x_starx_pocc => Cur_app_stats_rec.starx_pocc
2322 ,x_starx_pocc_text => Cur_app_stats_rec.starx_pocc_text
2323 ,x_sent_to_hesa => 'N' -- set the flag to 'N' for this update.
2324 ,x_mode => 'R'
2325 ,x_starh_socio_economic => Cur_app_stats_rec.starh_socio_economic
2326 ,x_starx_socio_economic => Cur_app_stats_rec.starx_socio_economic
2327 ,x_starx_occ_background => Cur_app_stats_rec.starx_occ_background
2328 ,x_ivstarh_dependants => Cur_app_stats_rec.ivstarh_dependants
2329 ,x_ivstarh_married => Cur_app_stats_rec.ivstarh_married
2330 ,x_ivstarx_religion => Cur_app_stats_rec.ivstarx_religion
2331 ,x_ivstarx_dependants => Cur_app_stats_rec.ivstarx_dependants
2332 ,x_ivstarx_married => Cur_app_stats_rec.ivstarx_married
2333 );
2334 END LOOP;
2335 END IF;
2336
2337 EXCEPTION
2338 WHEN OTHERS THEN
2339 g_error_code := '9998';
2340 fnd_file.put_line(fnd_file.log, SQLERRM);
2341 END;
2342
2343 -- jchakrab added for Bug 5481963 - 06-Sep-2006
2344 IF new_ivstark_rec.withdrawn = 'C' OR new_ivstark_rec.withdrawn = 'W' THEN
2345
2346 BEGIN
2347 -- Get all the choice records for this applicant in the configured cycle
2348 -- for current institution
2349 FOR cur_uc_app_choices_rec IN cur_uc_app_choices(new_ivstark_rec.appno, g_config_cycle, g_crnt_institute)
2350 LOOP
2351 -- If withdrawn is C or (withdrawn is W and current choice is UF, then update the current choice
2352 -- set decision = W, reply = null, and reset the export_to_oss_status to NEW
2353 IF new_ivstark_rec.withdrawn = 'C' OR
2354 (new_ivstark_rec.withdrawn = 'W' AND
2355 cur_uc_app_choices_rec.decision = 'U' AND
2356 cur_uc_app_choices_rec.reply = 'F') THEN
2357
2358 igs_uc_app_choices_pkg.update_row(
2359 x_rowid => cur_uc_app_choices_rec.rowid
2360 ,x_app_choice_id => cur_uc_app_choices_rec.app_choice_id
2361 ,x_app_id => cur_uc_app_choices_rec.app_id
2362 ,x_app_no => cur_uc_app_choices_rec.app_no
2363 ,x_choice_no => cur_uc_app_choices_rec.choice_no
2364 ,x_last_change => cur_uc_app_choices_rec.last_change
2365 ,x_institute_code => cur_uc_app_choices_rec.institute_code
2366 ,x_ucas_program_code => cur_uc_app_choices_rec.ucas_program_code
2367 ,x_oss_program_code => cur_uc_app_choices_rec.oss_program_code
2368 ,x_oss_program_version => cur_uc_app_choices_rec.oss_program_version
2369 ,x_oss_attendance_type => cur_uc_app_choices_rec.oss_attendance_type
2370 ,x_oss_attendance_mode => cur_uc_app_choices_rec.oss_attendance_mode
2371 ,x_campus => cur_uc_app_choices_rec.campus
2372 ,x_oss_location => cur_uc_app_choices_rec.oss_location
2373 ,x_faculty => cur_uc_app_choices_rec.faculty
2374 ,x_entry_year => cur_uc_app_choices_rec.entry_year
2375 ,x_entry_month => cur_uc_app_choices_rec.entry_month
2376 ,x_point_of_entry => cur_uc_app_choices_rec.point_of_entry
2377 ,x_home => cur_uc_app_choices_rec.home
2378 ,x_deferred => cur_uc_app_choices_rec.deferred
2379 ,x_route_b_pref_round => cur_uc_app_choices_rec.route_b_pref_round
2380 ,x_route_b_actual_round => cur_uc_app_choices_rec.route_b_actual_round
2381 ,x_condition_category => cur_uc_app_choices_rec.condition_category
2382 ,x_condition_code => cur_uc_app_choices_rec.condition_code
2383 ,x_decision => 'W'
2384 ,x_decision_date => cur_uc_app_choices_rec.decision_date
2385 ,x_decision_number => cur_uc_app_choices_rec.decision_number
2386 ,x_reply => NULL
2387 ,x_summary_of_cond => cur_uc_app_choices_rec.summary_of_cond
2388 ,x_choice_cancelled => cur_uc_app_choices_rec.choice_cancelled
2389 ,x_action => cur_uc_app_choices_rec.action
2390 ,x_substitution => cur_uc_app_choices_rec.substitution
2391 ,x_date_substituted => cur_uc_app_choices_rec.date_substituted
2392 ,x_prev_institution => cur_uc_app_choices_rec.prev_institution
2393 ,x_prev_course => cur_uc_app_choices_rec.prev_course
2394 ,x_prev_campus => cur_uc_app_choices_rec.prev_campus
2395 ,x_ucas_amendment => cur_uc_app_choices_rec.ucas_amendment
2396 ,x_withdrawal_reason => cur_uc_app_choices_rec.withdrawal_reason
2397 ,x_offer_course => cur_uc_app_choices_rec.offer_course
2398 ,x_offer_campus => cur_uc_app_choices_rec.offer_campus
2399 ,x_offer_crse_length => cur_uc_app_choices_rec.offer_crse_length
2400 ,x_offer_entry_month => cur_uc_app_choices_rec.offer_entry_month
2401 ,x_offer_entry_year => cur_uc_app_choices_rec.offer_entry_year
2402 ,x_offer_entry_point => cur_uc_app_choices_rec.offer_entry_point
2403 ,x_offer_text => cur_uc_app_choices_rec.offer_text
2404 ,x_mode => 'R'
2405 ,x_export_to_oss_status => 'NEW'
2406 ,x_error_code => NULL
2407 ,x_request_id => cur_uc_app_choices_rec.request_id
2408 ,x_batch_id => cur_uc_app_choices_rec.batch_id
2409 ,x_extra_round_nbr => cur_uc_app_choices_rec.extra_round_nbr
2410 ,x_system_code => cur_uc_app_choices_rec.system_code
2411 ,x_part_time => cur_uc_app_choices_rec.part_time
2412 ,x_interview => cur_uc_app_choices_rec.interview
2413 ,x_late_application => cur_uc_app_choices_rec.late_application
2414 ,x_modular => cur_uc_app_choices_rec.modular
2415 ,x_residential => cur_uc_app_choices_rec.residential
2416 ,x_ucas_cycle => cur_uc_app_choices_rec.ucas_cycle
2417 );
2418
2419 END IF;
2420
2421 END LOOP;
2422 EXCEPTION
2423 WHEN OTHERS THEN
2424 g_error_code := '9998';
2425 fnd_file.put_line(fnd_file.log, SQLERRM);
2426 END;
2427
2428 END IF; -- end-if for new_ivstark_rec.withdrawn = C or W
2429
2430
2431 END IF; -- insert / update
2432
2433 END IF;
2434
2435
2436 EXCEPTION
2437 WHEN OTHERS THEN
2438 -- catch any unhandled/unexpected errors while processing a record.
2439 -- This would enable processing to continue with subsequent records.
2440 g_error_code := '1055';
2441 fnd_file.put_line(fnd_file.log, SQLERRM);
2442
2443 -- Close any Open cursors
2444 IF validate_refcodes_cur%ISOPEN THEN
2445 CLOSE validate_refcodes_cur;
2446 END IF;
2447
2448 IF validate_school_cur%ISOPEN THEN
2449 CLOSE validate_school_cur;
2450 END IF;
2451
2452 IF validate_ref_apr_cur%ISOPEN THEN
2453 CLOSE validate_ref_apr_cur;
2454 END IF;
2455
2456 IF old_stark_cur%ISOPEN THEN
2457 CLOSE old_stark_cur;
2458 END IF;
2459
2460 END;
2461
2462 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
2463 -- while processing the record.
2464 IF g_error_code IS NOT NULL THEN
2465 UPDATE igs_uc_istark_ints
2466 SET error_code = g_error_code
2467 WHERE rowid = new_ivstark_rec.rowid;
2468
2469 -- log error message/meaning.
2470 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
2471
2472 -- update error count
2473 g_error_rec_cnt := g_error_rec_cnt + 1;
2474
2475 ELSE
2476 UPDATE igs_uc_istark_ints
2477 SET record_status = 'D',
2478 error_code = NULL
2479 WHERE rowid = new_ivstark_rec.rowid;
2480
2481 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
2482 END IF;
2483
2484 END LOOP;
2485
2486 COMMIT;
2487 -- log processing complete for this view
2488 igs_uc_proc_ucas_data.log_proc_complete('IVSTARK', g_success_rec_cnt, g_error_rec_cnt);
2489
2490 EXCEPTION
2491 WHEN OTHERS THEN
2492 ROLLBACK;
2493 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
2494 fnd_message.set_token('VIEW', 'IVSTARK'||' - '||SQLERRM);
2495 fnd_file.put_line(fnd_file.log, fnd_message.get);
2496 END process_ivstark;
2497
2498
2499
2500 PROCEDURE process_ivstarc IS
2501 /******************************************************************
2502 Created By : rgangara
2503 Date Created By : 12-JUNE-2003
2504 Purpose : For processing IVSTARC - Applicant Choices info. details from UCAS.
2505 Known limitations,enhancements,remarks:
2506 Change History
2507 Who When What
2508 arvsrini 05-MAR-04 Added code to check before inserting records to IGS_UC_APP_CHOICES whether there exists record with
2509 same institution code and system code but having choice number as 99.If there exists no records, then insert is performed
2510 If it exists, the record is updated using choice number as IGS_UC_ISTARC_INTS.CHOICENO. Also if there exists records
2511 in IGS_UC_TRANSACTIONS with choice_no = 99 then those records are also updated. Bug#3239860
2512 jchakrab 23-AUG-04 Modified for Bug# 3837871 - Update system_code of existing app_choice records in
2513 IGS_UC_APP_CHOICES with current cycle's system_code in IGS_UC_APLICANTS
2514 jbaber 15-Sep-05 Entryyear defaults if NULL for all systems
2515 anwest 29-May-06 Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2516 ******************************************************************/
2517
2518 CURSOR new_ivstarc_cur IS
2519 SELECT ivstk.rowid,
2520 ivstk.*
2521 FROM igs_uc_istarc_ints ivstk
2522 WHERE record_status = 'N';
2523
2524
2525 CURSOR old_starc_cur(p_appno igs_uc_app_choices.app_no%TYPE,
2526 p_choiceno igs_uc_app_choices.choice_no%TYPE,
2527 p_cycle igs_uc_app_choices.ucas_cycle%TYPE) IS
2528 SELECT appl.rowid,
2529 appl.*
2530 FROM igs_uc_app_choices appl
2531 WHERE appl.app_no = p_appno
2532 AND appl.choice_no = p_choiceno
2533 AND appl.ucas_cycle = p_cycle;
2534
2535 -- get the system and app_id to be populated into App Choices
2536 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
2537 SELECT app_id,
2538 system_code
2539 FROM igs_uc_applicants
2540 WHERE app_no = p_appno;
2541
2542
2543 -- validate institution value
2544 CURSOR validate_Institution (p_inst igs_uc_com_inst.inst%TYPE) IS
2545 SELECT 'X'
2546 FROM igs_uc_com_inst
2547 WHERE inst = p_inst;
2548
2549 -- get entry year from UCAS Control.
2550 CURSOR get_control_entry_year (p_system igs_uc_applicants.system_code%TYPE, p_cycle igs_uc_istarc_ints.ucas_cycle%TYPE) IS
2551 SELECT entry_year
2552 FROM igs_uc_ucas_control
2553 WHERE system_code = p_system
2554 AND ucas_cycle = p_cycle;
2555
2556 -- Cursor to get the OSS Program details for the UCAS course from Course details table.
2557 CURSOR get_oss_prog_cur (p_course igs_uc_crse_dets.ucas_program_code%TYPE,
2558 p_campus igs_uc_crse_dets.ucas_campus%TYPE,
2559 p_inst igs_uc_crse_dets.institute%TYPE,
2560 p_system igs_uc_crse_dets.system_code%TYPE) IS
2561 SELECT oss_program_code,
2562 oss_program_version,
2563 oss_location,
2564 oss_attendance_mode,
2565 oss_attendance_type
2566 FROM igs_uc_crse_dets
2567 WHERE System_Code = p_system
2568 AND ucas_program_code = p_course
2569 AND ucas_campus = p_campus
2570 AND Institute = p_inst;
2571
2572
2573
2574
2575 CURSOR curr_inst_cur(p_sys_code igs_uc_defaults.system_code%type) IS
2576 SELECT current_inst_code
2577 FROM igs_uc_defaults
2578 WHERE system_code = p_sys_code;
2579
2580 -- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2581 CURSOR uc_transaction_9_cur(p_app_no igs_uc_transactions.app_no%TYPE) IS
2582 SELECT trans.rowid,
2583 trans.*
2584 FROM igs_uc_transactions trans
2585 WHERE trans.app_no = p_app_no
2586 AND trans.choice_no = 9;
2587
2588
2589 oss_prog_rec get_oss_prog_cur%ROWTYPE; -- Holds OSS Program details for the UCAS Course.
2590 old_starc_rec old_starc_cur%ROWTYPE ; -- Holds the existing values for this incoming record.
2591 get_appl_dets_rec get_appl_dets%ROWTYPE; -- Holds the Application details from UC_Applicants
2592 curr_inst_rec curr_inst_cur%ROWTYPE;
2593 old_starc_9_rec old_starc_cur%ROWTYPE;-- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2594
2595 l_entry_year igs_uc_ucas_control.entry_year%TYPE;
2596 l_deferred igs_uc_app_choices.deferred%TYPE;
2597 l_entrymonth igs_uc_app_choices.entry_month%TYPE;
2598 l_app_choice_id igs_uc_app_choices.app_choice_id%TYPE; -- Place holder for App CHoice ID - Seq gen value.
2599 l_valid VARCHAR2(1); -- for holding fetch from cursors for rec exists check.
2600
2601 BEGIN
2602
2603 -- initialize variables
2604 g_success_rec_cnt := 0;
2605 g_error_rec_cnt := 0;
2606 g_error_code := NULL;
2607
2608 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
2609 fnd_message.set_token('VIEW', 'IVSTARC ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
2610 fnd_file.put_line(fnd_file.log, fnd_message.get);
2611
2612 -- Get all the reocords from interface table with status = 'N'
2613 FOR new_ivstarc_rec IN new_ivstarc_cur
2614 LOOP
2615
2616 BEGIN
2617 -- initialize record level variables.
2618 g_error_code := NULL;
2619 old_starc_rec := NULL;
2620 get_appl_dets_rec := NULL;
2621 l_valid := NULL;
2622 oss_prog_rec := NULL;
2623 l_entry_year := NULL ;
2624 l_app_choice_id := NULL;
2625 curr_inst_rec := NULL;
2626 old_starc_9_rec := NULL;
2627
2628 -- log Application Choice processing message.
2629 fnd_message.set_name('IGS','IGS_UC_APPNO_CHOICE_PROC');
2630 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarc_rec.appno));
2631 fnd_message.set_token('CHOICE',TO_CHAR(new_ivstarc_rec.choiceno));
2632 fnd_file.put_line(fnd_file.log, fnd_message.get);
2633
2634
2635 -- no mandatory field validations as this is an update
2636 IF new_ivstarc_rec.appno IS NULL OR new_ivstarc_rec.choiceno IS NULL OR
2637 new_ivstarc_rec.ucas_cycle IS NULL OR new_ivstarc_rec.inst IS NULL OR
2638 new_ivstarc_rec.Course IS NULL OR new_ivstarc_rec.campus IS NULL OR
2639 new_ivstarc_rec.lastchange IS NULL THEN
2640
2641 g_error_code := '1037';
2642 END IF;
2643
2644 -- AppNo validation
2645 IF g_error_code IS NULL THEN
2646
2647 -- validate Applicant record details in UCAS Applicants table.
2648 -- This is because record gets inserted into igs_uc_app_choices as part of
2649 -- IVSTARN processing and hence at this stage the record must exist.
2650 validate_applicant (new_ivstarc_rec.appno, g_error_code);
2651 END IF;
2652
2653
2654 ----------------------------
2655 -- INSTITUTION validation
2656 ----------------------------
2657 IF g_error_code IS NULL THEN
2658
2659 -- validate specialneeds
2660 OPEN validate_Institution (new_ivstarc_rec.inst);
2661 FETCH validate_Institution INTO l_valid;
2662
2663 IF validate_Institution%NOTFOUND THEN
2664 g_error_code := '1018';
2665 END IF;
2666
2667 CLOSE validate_Institution;
2668 END IF;
2669 --- end of Institution validation
2670
2671
2672
2673
2674 ----------------------------
2675 -- MAIN PROCESSING Begins
2676 ----------------------------
2677 IF g_error_code IS NULL THEN
2678 ------------------------------------------------
2679 -- Get the System Code and Application ID for the Application
2680 ------------------------------------------------
2681 -- get the App ID and System code for this Application.
2682 OPEN get_appl_dets(new_ivstarc_rec.appno);
2683 FETCH get_appl_dets INTO get_appl_dets_rec;
2684 CLOSE get_appl_dets;
2685
2686
2687 ------------------------------------------------
2688 -- Point of Entry Derivation/defaulting
2689 ------------------------------------------------
2690 -- Derive Point of Entry. - validate that only Number values are passed to igs_uc_app_choices.point_of_entry field.
2691 -- For any other values the entry point should be defaulted to 1.
2692 IF (ASCII(new_ivstarc_rec.entrypoint) >= 48 AND ASCII(new_ivstarc_rec.entrypoint) <= 57) OR new_ivstarc_rec.entrypoint IS NULL THEN
2693 new_ivstarc_rec.entrypoint := TO_NUMBER(new_ivstarc_rec.entrypoint); --
2694 ELSE
2695 new_ivstarc_rec.entrypoint := 1; -- default value.
2696 END IF;
2697
2698 ------------------------------------------------
2699 -- Deferred value derivation/defaulting
2700 ------------------------------------------------
2701 -- get entry year from ucas control table.
2702 OPEN get_control_entry_year(get_appl_dets_rec.system_code, new_ivstarc_rec.ucas_cycle);
2703 FETCH get_control_entry_year INTO l_entry_year ;
2704 CLOSE get_control_entry_year;
2705
2706 -- DEFERRED value derivation
2707 -- If ivstarc.entry_year > igs_uc_ucas_control.entry_year then deferred='Y' else 'N'.
2708 IF new_ivstarc_rec.entryyear > l_entry_year THEN
2709 l_deferred := 'Y' ;
2710 ELSE
2711 l_deferred := 'N' ;
2712 END IF ;
2713
2714 ------------------------------------------------
2715 -- Entry Year derivation/defaulting.
2716 ------------------------------------------------
2717 --If entry year is NULL provide the default value for this field
2718 IF new_ivstarc_rec.entryyear IS NOT NULL THEN
2719 l_entry_year := new_ivstarc_rec.entryyear;
2720 END IF ;
2721
2722
2723 ------------------------------------------------
2724 -- Entry Month derivation/defaulting
2725 ------------------------------------------------
2726 IF new_ivstarc_rec.entrymonth IS NOT NULL THEN
2727
2728 -- Incoming record has Entry Month value then this has to be populated.
2729 l_entrymonth := new_ivstarc_rec.entrymonth ;
2730
2731 ELSE -- default this value as per the system to which the Application belongs.
2732 IF get_appl_dets_rec.system_code = 'S' THEN
2733 -- for SWAS, the default is 9
2734 l_entrymonth := 9;
2735 ELSE
2736 -- for all other systems, the default is 0
2737 l_entrymonth := 0;
2738 END IF ;
2739
2740 END IF ;
2741
2742
2743 ------------------------------------------------
2744 -- Decision Date value derivation/defaulting
2745 ------------------------------------------------
2746 IF new_ivstarc_rec.decision IS NULL THEN
2747 -- no decision therefore decision date has to be NULL.
2748 new_ivstarc_rec.decisiondate := NULL;
2749 ELSE
2750 new_ivstarc_rec.decisiondate := NVL(new_ivstarc_rec.decisiondate,TRUNC(SYSDATE));
2751 END IF;
2752
2753
2754 -- Check wether the Application record already exists.
2755 -- If exists , update the records otherwise insert a new record.
2756 OPEN old_starc_cur(new_ivstarc_rec.appno, new_ivstarc_rec.choiceno, new_ivstarc_rec.ucas_cycle);
2757 FETCH old_starc_cur INTO old_starc_rec;
2758 CLOSE old_starc_cur;
2759
2760 IF old_starc_rec.rowid IS NULL THEN
2761
2762 ------------------------------------------------
2763 -- get OSS Program details
2764 ------------------------------------------------
2765 OPEN get_oss_prog_cur (new_ivstarc_rec.course, new_ivstarc_rec.campus,
2766 new_ivstarc_rec.inst, get_appl_dets_rec.system_code);
2767 FETCH get_oss_prog_cur INTO oss_prog_rec;
2768
2769 IF new_ivstarc_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
2770 g_error_code := '1045'; -- UCAS Course not found
2771 END IF;
2772 CLOSE get_oss_prog_cur;
2773
2774 -- Added code to check before inserting records to IGS_UC_APP_CHOICES whether there exists record with
2775 -- same institution code and system code but having choice number as 99.If there exists no records, then insert is performed. arvsrini bug# 3239860
2776
2777 OPEN curr_inst_cur(get_appl_dets_rec.system_code);
2778 FETCH curr_inst_cur INTO curr_inst_rec;
2779 CLOSE curr_inst_cur;
2780
2781
2782 IF curr_inst_rec.current_inst_code = new_ivstarc_rec.inst THEN -- checking of system code (G or S)not required as choice no 99
2783 -- can exist only for GTTR and SWAS systems
2784 -- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2785 OPEN old_starc_cur(new_ivstarc_rec.appno, 9, new_ivstarc_rec.ucas_cycle);
2786 FETCH old_starc_cur INTO old_starc_9_rec;
2787 CLOSE old_starc_cur;
2788
2789
2790 END IF;
2791
2792
2793 IF old_starc_9_rec.rowid IS NULL THEN -- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2794
2795
2796 IF g_error_code IS NULL THEN
2797
2798 BEGIN
2799
2800 -- call the TBH to Insert new record
2801 igs_uc_app_choices_pkg.insert_row -- IGSXI02B.pls
2802 (
2803 x_rowid => old_starc_rec.rowid
2804 ,x_app_choice_id => l_app_choice_id
2805 ,x_app_id => get_appl_dets_rec.app_id
2806 ,x_app_no => new_ivstarc_rec.appno
2807 ,x_choice_no => new_ivstarc_rec.choiceno
2808 ,x_last_change => new_ivstarc_rec.lastchange
2809 ,x_institute_code => new_ivstarc_rec.inst
2810 ,x_ucas_program_code => new_ivstarc_rec.course
2811 ,x_oss_program_code => oss_prog_rec.oss_program_code
2812 ,x_oss_program_version => oss_prog_rec.oss_program_version
2813 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
2814 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
2815 ,x_campus => new_ivstarc_rec.campus
2816 ,x_oss_location => oss_prog_rec.oss_location
2817 ,x_faculty => new_ivstarc_rec.faculty
2818 ,x_entry_year => l_entry_year
2819 ,x_entry_month => l_entrymonth
2820 ,x_point_of_entry => new_ivstarc_rec.entrypoint
2821 ,x_home => NVL(new_ivstarc_rec.home,'N')
2822 ,x_deferred => l_deferred
2823 ,x_route_b_pref_round => new_ivstarc_rec.routebpref
2824 ,x_route_b_actual_round => new_ivstarc_rec.routebround
2825 ,x_condition_category => NULL
2826 ,x_condition_code => NULL
2827 ,x_decision => new_ivstarc_rec.decision
2828 ,x_decision_date => new_ivstarc_rec.decisiondate
2829 ,x_decision_number => new_ivstarc_rec.decisionnumber
2830 ,x_reply => new_ivstarc_rec.reply
2831 ,x_summary_of_cond => new_ivstarc_rec.summaryconditions
2832 ,x_choice_cancelled => new_ivstarc_rec.choicecancelled
2833 ,x_action => new_ivstarc_rec.action
2834 ,x_substitution => new_ivstarc_rec.substitution
2835 ,x_date_substituted => new_ivstarc_rec.datesubstituted
2836 ,x_prev_institution => new_ivstarc_rec.previousinst
2837 ,x_prev_course => new_ivstarc_rec.previouscourse
2838 ,x_prev_campus => new_ivstarc_rec.previouscampus
2839 ,x_ucas_amendment => new_ivstarc_rec.ucasamendment
2840 ,x_withdrawal_reason => NULL
2841 ,x_offer_course => NULL
2842 ,x_offer_campus => NULL
2843 ,x_offer_crse_length => NULL
2844 ,x_offer_entry_month => NULL
2845 ,x_offer_entry_year => NULL
2846 ,x_offer_entry_point => NULL
2847 ,x_offer_text => NULL
2848 ,x_mode => 'R'
2849 ,x_export_to_oss_status => 'NEW'
2850 ,x_error_code => NULL
2851 ,x_request_id => NULL
2852 ,x_batch_id => NULL
2853 ,x_extra_round_nbr => new_ivstarc_rec.extraround
2854 ,x_system_code => get_appl_dets_rec.system_code
2855 ,x_part_time => NULL
2856 ,x_interview => NULL
2857 ,x_late_application => NULL
2858 ,x_modular => NULL
2859 ,x_residential => new_ivstarc_rec.residential
2860 ,x_ucas_cycle => new_ivstarc_rec.ucas_cycle
2861 );
2862
2863 EXCEPTION
2864 WHEN OTHERS THEN
2865
2866 g_error_code := '9999';
2867 fnd_file.put_line(fnd_file.log, SQLERRM);
2868 END;
2869
2870 END IF; --error code
2871
2872 ELSE
2873
2874 /* Updating the 9 choice record */
2875
2876 -- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2877 IF new_ivstarc_rec.choiceno = 5 OR new_ivstarc_rec.choiceno = 7 THEN
2878
2879
2880 -- For an Application Choice if the UCAS Course details are modified at UCAS end,
2881 -- then the OSS program details for such an application needs to be derived again
2882 -- based on the new/updated UCAS Course. Otherwise, if the UCAS Course details
2883 -- remain the same, then the existing OSS Program details for this record are retained.
2884
2885
2886 -- Checking whether the UCAS Program details have been modified at UCAS End.
2887 IF new_ivstarc_rec.course <> old_starc_9_rec.ucas_program_code OR
2888 new_ivstarc_rec.campus <> old_starc_9_rec.campus OR
2889 new_ivstarc_rec.inst <> old_starc_9_rec.institute_code THEN
2890
2891 -- Deriving the OSS Program details for the new/updated UCAS Course.
2892 OPEN get_oss_prog_cur (new_ivstarc_rec.course, new_ivstarc_rec.campus,
2893 new_ivstarc_rec.inst, old_starc_9_rec.system_code);
2894 FETCH get_oss_prog_cur INTO oss_prog_rec;
2895
2896 IF new_ivstarc_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
2897 g_error_code := '1045'; -- UCAS Course not found
2898
2899 END IF;
2900 CLOSE get_oss_prog_cur;
2901
2902 ELSE
2903 -- i.e. If UCAS Course details have not changed.
2904 -- Retain the existing OSS Program details for this record in App Choices table.
2905
2906 -- copying existing values for the record to the program record variable.
2907 oss_prog_rec.oss_program_code := old_starc_9_rec.oss_program_code ;
2908 oss_prog_rec.oss_program_version := old_starc_9_rec.oss_program_version ;
2909 oss_prog_rec.oss_attendance_type := old_starc_9_rec.oss_attendance_type ;
2910 oss_prog_rec.oss_attendance_mode := old_starc_9_rec.oss_attendance_mode ;
2911 oss_prog_rec.oss_location := old_starc_9_rec.oss_location ;
2912
2913 END IF;
2914
2915 --the record is to be updated using choice number as IGS_UC_ISTARC_INTS.CHOICENO. Also if there exists records
2916 --in IGS_UC_TRANSACTIONS with choice_no = 99 then those records are also updated. Bug#3239860
2917
2918
2919 BEGIN
2920
2921 -- 29-MAY-2006 anwest Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
2922 FOR uc_transaction_rec IN uc_transaction_9_cur(new_ivstarc_rec.appno)
2923 LOOP
2924 igs_uc_transactions_pkg.update_row
2925 (
2926 x_rowid => uc_transaction_rec.rowid,
2927 x_uc_tran_id => uc_transaction_rec.uc_tran_id,
2928 x_transaction_id => uc_transaction_rec.transaction_id,
2929 x_datetimestamp => uc_transaction_rec.datetimestamp,
2930 x_updater => uc_transaction_rec.updater,
2931 x_error_code => uc_transaction_rec.error_code,
2932 x_transaction_type => uc_transaction_rec.transaction_type,
2933 x_app_no => uc_transaction_rec.app_no,
2934 x_choice_no => new_ivstarc_rec.choiceno,
2935 x_decision => uc_transaction_rec.decision,
2936 x_program_code => uc_transaction_rec.program_code,
2937 x_campus => uc_transaction_rec.campus,
2938 x_entry_month => uc_transaction_rec.entry_month,
2939 x_entry_year => uc_transaction_rec.entry_year,
2940 x_entry_point => uc_transaction_rec.entry_point,
2941 x_soc => uc_transaction_rec.soc,
2942 x_comments_in_offer => uc_transaction_rec.comments_in_offer,
2943 x_return1 => uc_transaction_rec.return1,
2944 x_return2 => uc_transaction_rec.return2,
2945 x_hold_flag => uc_transaction_rec.hold_flag,
2946 x_sent_to_ucas => uc_transaction_rec.sent_to_ucas,
2947 x_test_cond_cat => uc_transaction_rec.test_cond_cat,
2948 x_test_cond_name => uc_transaction_rec.test_cond_name,
2949 x_mode => 'R',
2950 x_inst_reference => uc_transaction_rec.inst_reference,
2951 x_auto_generated_flag => uc_transaction_rec.auto_generated_flag,
2952 x_system_code => uc_transaction_rec.system_code,
2953 x_ucas_cycle => uc_transaction_rec.ucas_cycle,
2954 x_modular => uc_transaction_rec.modular,
2955 x_part_time => uc_transaction_rec.part_time
2956
2957 );
2958
2959 END LOOP;
2960
2961 EXCEPTION
2962 WHEN OTHERS THEN
2963 g_error_code := '9998';
2964 fnd_file.put_line(fnd_file.log, SQLERRM);
2965 END;
2966
2967
2968 -- calling the update tbh
2969
2970 IF g_error_code IS NULL THEN
2971
2972 BEGIN
2973 -- call the TBH to update the record
2974 igs_uc_app_choices_pkg.update_row -- IGSXI02B.pls
2975 (
2976 x_rowid => old_starc_9_rec.rowid
2977 ,x_app_choice_id => old_starc_9_rec.app_choice_id
2978 ,x_app_id => old_starc_9_rec.app_id
2979 ,x_app_no => old_starc_9_rec.app_no
2980 ,x_choice_no => new_ivstarc_rec.choiceno
2981 ,x_last_change => new_ivstarc_rec.lastchange
2982 ,x_institute_code => new_ivstarc_rec.inst
2983 ,x_ucas_program_code => new_ivstarc_rec.course
2984 ,x_oss_program_code => oss_prog_rec.oss_program_code
2985 ,x_oss_program_version => oss_prog_rec.oss_program_version
2986 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
2987 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
2988 ,x_campus => new_ivstarc_rec.campus
2989 ,x_oss_location => oss_prog_rec.oss_location
2990 ,x_faculty => new_ivstarc_rec.faculty
2991 ,x_entry_year => l_entry_year
2992 ,x_entry_month => l_entrymonth
2993 ,x_point_of_entry => new_ivstarc_rec.entrypoint
2994 ,x_home => NVL(new_ivstarc_rec.home,'N')
2995 ,x_deferred => l_deferred
2996 ,x_route_b_pref_round => new_ivstarc_rec.routebpref
2997 ,x_route_b_actual_round => new_ivstarc_rec.routebround
2998 ,x_condition_category => old_starc_9_rec.condition_category
2999 ,x_condition_code => old_starc_9_rec.condition_code
3000 ,x_decision => new_ivstarc_rec.decision
3001 ,x_decision_date => new_ivstarc_rec.decisiondate
3002 ,x_decision_number => new_ivstarc_rec.decisionnumber
3003 ,x_reply => new_ivstarc_rec.reply
3004 ,x_summary_of_cond => new_ivstarc_rec.summaryconditions
3005 ,x_choice_cancelled => new_ivstarc_rec.choicecancelled
3006 ,x_action => new_ivstarc_rec.action
3007 ,x_substitution => new_ivstarc_rec.substitution
3008 ,x_date_substituted => new_ivstarc_rec.datesubstituted
3009 ,x_prev_institution => new_ivstarc_rec.previousinst
3010 ,x_prev_course => new_ivstarc_rec.previouscourse
3011 ,x_prev_campus => new_ivstarc_rec.previouscampus
3012 ,x_ucas_amendment => new_ivstarc_rec.ucasamendment
3013 ,x_withdrawal_reason => old_starc_9_rec.withdrawal_reason
3014 ,x_offer_course => old_starc_9_rec.offer_course
3015 ,x_offer_campus => old_starc_9_rec.offer_campus
3016 ,x_offer_crse_length => old_starc_9_rec.offer_crse_length
3017 ,x_offer_entry_month => old_starc_9_rec.offer_entry_month
3018 ,x_offer_entry_year => old_starc_9_rec.offer_entry_year
3019 ,x_offer_entry_point => old_starc_9_rec.offer_entry_point
3020 ,x_offer_text => old_starc_9_rec.offer_text
3021 ,x_mode => 'R'
3022 ,x_export_to_oss_status => 'NEW'
3023 ,x_error_code => NULL
3024 ,x_request_id => NULL
3025 ,x_batch_id => NULL
3026 ,x_extra_round_nbr => new_ivstarc_rec.extraround
3027 ,x_system_code => get_appl_dets_rec.system_code -- update with current system_code in igs_uc_applicants -Bug#3838781
3028 ,x_part_time => old_starc_9_rec.part_time
3029 ,x_interview => old_starc_9_rec.interview
3030 ,x_late_application => old_starc_9_rec.late_application
3031 ,x_modular => old_starc_9_rec.modular
3032 ,x_residential => new_ivstarc_rec.residential
3033 ,x_ucas_cycle => new_ivstarc_rec.ucas_cycle
3034 );
3035
3036 EXCEPTION
3037 WHEN OTHERS THEN
3038 g_error_code := '9998';
3039 fnd_file.put_line(fnd_file.log, SQLERRM);
3040 END;
3041
3042 END IF; -- error code for Update row
3043
3044 END IF; -- 9 rowid
3045
3046 END IF; -- choiceno 5 or 7
3047
3048 ELSE --old_starc_rec.rowid IS NOT NULL
3049
3050
3051 /* Update the record */
3052
3053
3054 -- For an Application Choice if the UCAS Course details are modified at UCAS end,
3055 -- then the OSS program details for such an application needs to be derived again
3056 -- based on the new/updated UCAS Course. Otherwise, if the UCAS Course details
3057 -- remain the same, then the existing OSS Program details for this record are retained.
3058
3059
3060 -- Checking whether the UCAS Program details have been modified at UCAS End.
3061 IF new_ivstarc_rec.course <> old_starc_rec.ucas_program_code OR
3062 new_ivstarc_rec.campus <> old_starc_rec.campus OR
3063 new_ivstarc_rec.inst <> old_starc_rec.institute_code THEN
3064
3065 -- Deriving the OSS Program details for the new/updated UCAS Course.
3066 OPEN get_oss_prog_cur (new_ivstarc_rec.course, new_ivstarc_rec.campus,
3067 new_ivstarc_rec.inst, old_starc_rec.system_code);
3068 FETCH get_oss_prog_cur INTO oss_prog_rec;
3069
3070 IF new_ivstarc_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
3071 g_error_code := '1045'; -- UCAS Course not found
3072
3073 END IF;
3074 CLOSE get_oss_prog_cur;
3075
3076 ELSE
3077 -- i.e. If UCAS Course details have not changed.
3078 -- Retain the existing OSS Program details for this record in App Choices table.
3079
3080 -- copying existing values for the record to the program record variable.
3081 oss_prog_rec.oss_program_code := old_starc_rec.oss_program_code ;
3082 oss_prog_rec.oss_program_version := old_starc_rec.oss_program_version ;
3083 oss_prog_rec.oss_attendance_type := old_starc_rec.oss_attendance_type ;
3084 oss_prog_rec.oss_attendance_mode := old_starc_rec.oss_attendance_mode ;
3085 oss_prog_rec.oss_location := old_starc_rec.oss_location ;
3086
3087 END IF;
3088
3089
3090 IF g_error_code IS NULL THEN
3091
3092 BEGIN
3093 -- call the TBH to update the record
3094 igs_uc_app_choices_pkg.update_row -- IGSXI02B.pls
3095 (
3096 x_rowid => old_starc_rec.rowid
3097 ,x_app_choice_id => old_starc_rec.app_choice_id
3098 ,x_app_id => old_starc_rec.app_id
3099 ,x_app_no => old_starc_rec.app_no
3100 ,x_choice_no => old_starc_rec.choice_no
3101 ,x_last_change => new_ivstarc_rec.lastchange
3102 ,x_institute_code => new_ivstarc_rec.inst
3103 ,x_ucas_program_code => new_ivstarc_rec.course
3104 ,x_oss_program_code => oss_prog_rec.oss_program_code
3105 ,x_oss_program_version => oss_prog_rec.oss_program_version
3106 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
3107 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
3108 ,x_campus => new_ivstarc_rec.campus
3109 ,x_oss_location => oss_prog_rec.oss_location
3110 ,x_faculty => new_ivstarc_rec.faculty
3111 ,x_entry_year => l_entry_year
3112 ,x_entry_month => l_entrymonth
3113 ,x_point_of_entry => new_ivstarc_rec.entrypoint
3114 ,x_home => NVL(new_ivstarc_rec.home,'N')
3115 ,x_deferred => l_deferred
3116 ,x_route_b_pref_round => new_ivstarc_rec.routebpref
3117 ,x_route_b_actual_round => new_ivstarc_rec.routebround
3118 ,x_condition_category => old_starc_rec.condition_category
3119 ,x_condition_code => old_starc_rec.condition_code
3120 ,x_decision => new_ivstarc_rec.decision
3121 ,x_decision_date => new_ivstarc_rec.decisiondate
3122 ,x_decision_number => new_ivstarc_rec.decisionnumber
3123 ,x_reply => new_ivstarc_rec.reply
3124 ,x_summary_of_cond => new_ivstarc_rec.summaryconditions
3125 ,x_choice_cancelled => new_ivstarc_rec.choicecancelled
3126 ,x_action => new_ivstarc_rec.action
3127 ,x_substitution => new_ivstarc_rec.substitution
3128 ,x_date_substituted => new_ivstarc_rec.datesubstituted
3129 ,x_prev_institution => new_ivstarc_rec.previousinst
3130 ,x_prev_course => new_ivstarc_rec.previouscourse
3131 ,x_prev_campus => new_ivstarc_rec.previouscampus
3132 ,x_ucas_amendment => new_ivstarc_rec.ucasamendment
3133 ,x_withdrawal_reason => old_starc_rec.withdrawal_reason
3134 ,x_offer_course => old_starc_rec.offer_course
3135 ,x_offer_campus => old_starc_rec.offer_campus
3136 ,x_offer_crse_length => old_starc_rec.offer_crse_length
3137 ,x_offer_entry_month => old_starc_rec.offer_entry_month
3138 ,x_offer_entry_year => old_starc_rec.offer_entry_year
3139 ,x_offer_entry_point => old_starc_rec.offer_entry_point
3140 ,x_offer_text => old_starc_rec.offer_text
3141 ,x_mode => 'R'
3142 ,x_export_to_oss_status => 'NEW'
3143 ,x_error_code => NULL
3144 ,x_request_id => NULL
3145 ,x_batch_id => NULL
3146 ,x_extra_round_nbr => new_ivstarc_rec.extraround
3147 ,x_system_code => get_appl_dets_rec.system_code -- update with current system_code in igs_uc_applicants -Bug#3838781
3148 ,x_part_time => old_starc_rec.part_time
3149 ,x_interview => old_starc_rec.interview
3150 ,x_late_application => old_starc_rec.late_application
3151 ,x_modular => old_starc_rec.modular
3152 ,x_residential => new_ivstarc_rec.residential
3153 ,x_ucas_cycle => new_ivstarc_rec.ucas_cycle
3154 );
3155
3156 EXCEPTION
3157 WHEN OTHERS THEN
3158 g_error_code := '9998';
3159 fnd_file.put_line(fnd_file.log, SQLERRM);
3160 END;
3161
3162 END IF; -- error code for Update row
3163
3164 END IF; -- insert / update (starc rowid check)
3165
3166 END IF; -- main processing
3167
3168 EXCEPTION
3169 WHEN OTHERS THEN
3170 -- Close any Open cursors
3171 IF get_oss_prog_cur%ISOPEN THEN
3172 CLOSE get_oss_prog_cur;
3173 END IF;
3174
3175 IF old_starc_cur%ISOPEN THEN
3176 CLOSE old_starc_cur;
3177 END IF;
3178
3179 IF get_control_entry_year%ISOPEN THEN
3180 CLOSE get_control_entry_year;
3181 END IF;
3182
3183 IF get_appl_dets%ISOPEN THEN
3184 CLOSE get_appl_dets;
3185 END IF;
3186
3187 IF validate_Institution%ISOPEN THEN
3188 CLOSE validate_Institution;
3189 END IF;
3190
3191 -- catch any unhandled/unexpected errors while processing a record.
3192 -- This would enable processing to continue with subsequent records.
3193 g_error_code := '1055';
3194 fnd_file.put_line(fnd_file.log, SQLERRM);
3195
3196
3197
3198 END;
3199
3200 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
3201 -- while processing the record.
3202 IF g_error_code IS NOT NULL THEN
3203
3204 UPDATE igs_uc_istarc_ints
3205 SET error_code = g_error_code
3206 WHERE rowid = new_ivstarc_rec.rowid;
3207
3208 -- log error message/meaning.
3209 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
3210
3211 -- update error count
3212 g_error_rec_cnt := g_error_rec_cnt + 1;
3213
3214 ELSE
3215
3216 UPDATE igs_uc_istarc_ints
3217 SET record_status = 'D',
3218 error_code = NULL
3219 WHERE rowid = new_ivstarc_rec.rowid;
3220
3221 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
3222 END IF;
3223
3224 END LOOP;
3225
3226 COMMIT;
3227 -- log processing complete for this view
3228 igs_uc_proc_ucas_data.log_proc_complete('IVSTARC', g_success_rec_cnt, g_error_rec_cnt);
3229
3230 EXCEPTION
3231 WHEN OTHERS THEN
3232 ROLLBACK;
3233 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
3234 fnd_message.set_token('VIEW', 'IVSTARC'||' - '||SQLERRM);
3235 fnd_file.put_line(fnd_file.log, fnd_message.get);
3236 END process_ivstarc;
3237
3238
3239
3240 PROCEDURE process_ivstarg IS
3241 /******************************************************************
3242 Created By : rgangara
3243 Date Created By : 12-JUNE-2003
3244 Purpose : For processing IVSTARG (Applicant Choices for GTTR)
3245 info. details from UCAS.
3246 Known limitations,enhancements,remarks:
3247 Change History
3248 Who When What
3249 arvsrini 08-MAR-04 Added code to check before inserting records to IGS_UC_APP_CHOICES whether there exists record with
3250 same institution code and system code but having choice number as 99.If there exists no records, then insert is performed
3251 If it exists, the record is updated using choice number as IGS_UC_ISTARC_INTS.ROUNDNO. Also if there exists records
3252 in IGS_UC_TRANSACTIONS with choice_no = 99 then those records are also updated.Bug#3239860
3253 ******************************************************************/
3254
3255 CURSOR new_ivstarg_cur IS
3256 SELECT ivstk.rowid,
3257 ivstk.*
3258 FROM igs_uc_istarg_ints ivstk
3259 WHERE record_status = 'N';
3260
3261
3262 CURSOR old_starg_cur (p_appno igs_uc_app_choices.app_no%TYPE,
3263 p_choiceno igs_uc_app_choices.choice_no%TYPE,
3264 p_cycle igs_uc_app_choices.ucas_cycle%TYPE) IS
3265 SELECT appl.rowid,
3266 appl.*
3267 FROM igs_uc_app_choices appl
3268 WHERE appl.app_no = p_appno
3269 AND appl.choice_no = p_choiceno
3270 AND appl.ucas_cycle = p_cycle;
3271
3272 -- get the system and app_id to be populated into App Choices
3273 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
3274 SELECT ucap.rowid,
3275 ucap.*
3276 FROM igs_uc_applicants ucap
3277 WHERE app_no = p_appno;
3278
3279
3280 -- validate institution value
3281 CURSOR validate_Institution (p_inst igs_uc_com_inst.inst%TYPE) IS
3282 SELECT 'X'
3283 FROM igs_uc_com_inst
3284 WHERE inst = p_inst;
3285
3286 -- get entry year from UCAS Control.
3287 CURSOR get_control_entry_year (p_system igs_uc_applicants.system_code%TYPE, p_cycle igs_uc_istarg_ints.ucas_cycle%TYPE) IS
3288 SELECT entry_year
3289 FROM igs_uc_ucas_control
3290 WHERE system_code = p_system
3291 AND ucas_cycle = p_cycle;
3292
3293 -- Cursor to get the OSS Program details for the UCAS course from Course details table.
3294 CURSOR get_oss_prog_cur (p_course igs_uc_crse_dets.ucas_program_code%TYPE,
3295 p_campus igs_uc_crse_dets.ucas_campus%TYPE,
3296 p_inst igs_uc_crse_dets.institute%TYPE,
3297 p_system igs_uc_crse_dets.system_code%TYPE) IS
3298 SELECT oss_program_code,
3299 oss_program_version,
3300 oss_location,
3301 oss_attendance_mode,
3302 oss_attendance_type
3303 FROM igs_uc_crse_dets
3304 WHERE System_Code = p_system
3305 AND ucas_program_code = p_course
3306 AND ucas_campus = p_campus
3307 AND Institute = p_inst;
3308
3309 CURSOR curr_inst_cur(p_sys_code igs_uc_defaults.system_code%type) IS
3310 SELECT current_inst_code
3311 FROM igs_uc_defaults
3312 WHERE system_code = p_sys_code;
3313
3314 CURSOR uc_transaction_cur(p_app_no igs_uc_transactions.app_no%TYPE) IS
3315 SELECT trans.rowid,
3316 trans.*
3317 FROM igs_uc_transactions trans
3318 WHERE trans.app_no = p_app_no
3319 AND trans.choice_no = 99;
3320
3321
3322 oss_prog_rec get_oss_prog_cur%ROWTYPE; -- Holds OSS Program details for the UCAS Course.
3323 old_starg_rec old_starg_cur%ROWTYPE ; -- Holds the existing values for this incoming record.
3324 get_appl_dets_rec get_appl_dets%ROWTYPE; -- Holds the Application details from UC_Applicants
3325 curr_inst_rec curr_inst_cur%ROWTYPE;
3326 old_starg_99_rec old_starg_cur%ROWTYPE; -- arvsrini uccr008
3327
3328 l_entry_year igs_uc_ucas_control.entry_year%TYPE;
3329 l_deferred igs_uc_app_choices.deferred%TYPE;
3330 l_entrymonth igs_uc_app_choices.entry_month%TYPE;
3331 l_app_choice_id igs_uc_app_choices.app_choice_id%TYPE; -- Place holder for App CHoice ID - Seq gen value.
3332 l_valid VARCHAR2(1); -- for holding fetch from cursors for rec exists check.
3333
3334 BEGIN
3335
3336 -- initialize variables
3337 g_success_rec_cnt := 0;
3338 g_error_rec_cnt := 0;
3339 g_error_code := NULL;
3340
3341 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
3342 fnd_message.set_token('VIEW', 'IVSTARG ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
3343 fnd_file.put_line(fnd_file.log, fnd_message.get);
3344
3345 -- Get all the reocords from interface table with status = 'N'
3346 FOR new_ivstarg_rec IN new_ivstarg_cur
3347 LOOP
3348
3349 BEGIN
3350 -- initialize record level variables.
3351 g_error_code := NULL;
3352 old_starg_rec := NULL;
3353 oss_prog_rec := NULL;
3354 l_entry_year := NULL ;
3355 l_valid := NULL;
3356 get_appl_dets_rec := NULL;
3357 l_app_choice_id := NULL;
3358 curr_inst_rec := NULL;
3359 old_starg_99_rec := NULL;
3360
3361 -- Issue a savepoint
3362 SAVEPOINT process_ivstarg;
3363
3364 -- log Application Choice processing message.
3365 fnd_message.set_name('IGS','IGS_UC_APPNO_CHOICE_PROC');
3366 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarg_rec.appno));
3367 fnd_message.set_token('CHOICE',TO_CHAR(new_ivstarg_rec.roundno));
3368 fnd_file.put_line(fnd_file.log, fnd_message.get);
3369
3370
3371 -- no mandatory field validations as this is an update
3372 IF new_ivstarg_rec.appno IS NULL OR
3373 new_ivstarg_rec.roundno IS NULL OR
3374 new_ivstarg_rec.ucas_cycle IS NULL OR
3375 new_ivstarg_rec.inst IS NULL OR
3376 new_ivstarg_rec.Course IS NULL OR
3377 new_ivstarg_rec.campus IS NULL OR
3378 new_ivstarg_rec.lastchange IS NULL THEN
3379
3380 g_error_code := '1037';
3381 END IF;
3382
3383 -- AppNo validation
3384 IF g_error_code IS NULL THEN
3385
3386 -- validate Applicant record details in UCAS Applicants table.
3387 -- This is because record gets inserted into igs_uc_app_choices as part of
3388 -- IVSTARN processing and hence at this stage the record must exist.
3389 validate_applicant (new_ivstarg_rec.appno, g_error_code);
3390 END IF;
3391
3392
3393 ----------------------------
3394 -- INSTITUTION validation
3395 ----------------------------
3396 IF g_error_code IS NULL THEN
3397
3398 -- validate specialneeds
3399 OPEN validate_Institution (new_ivstarg_rec.inst);
3400 FETCH validate_Institution INTO l_valid;
3401
3402 IF validate_Institution%NOTFOUND THEN
3403 g_error_code := '1018';
3404 END IF;
3405
3406 CLOSE validate_Institution;
3407 END IF;
3408 --- end of Institution validation
3409
3410
3411
3412 ----------------------------
3413 -- MAIN PROCESSING Begins
3414 ----------------------------
3415 IF g_error_code IS NULL THEN
3416 ------------------------------------------------
3417 -- Get the System Code and Application ID for the Application
3418 ------------------------------------------------
3419 -- get the App ID and System code for this Application.
3420 -- record would always be found since the earlier check error code 1000 ensures this.
3421 OPEN get_appl_dets(new_ivstarg_rec.appno);
3422 FETCH get_appl_dets INTO get_appl_dets_rec;
3423 CLOSE get_appl_dets;
3424
3425
3426 -- update Applicants record for some fields
3427 -- (gcse_eng, gcse_match, degree_subject, degree_status, degree_class, gcse_csi).
3428 BEGIN
3429 -- call the TBH to update the record
3430 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
3431 (
3432 x_rowid => get_appl_dets_rec.rowid
3433 ,x_app_id => get_appl_dets_rec.app_id
3434 ,x_app_no => get_appl_dets_rec.app_no
3435 ,x_check_digit => get_appl_dets_rec.check_digit
3436 ,x_personal_id => get_appl_dets_rec.personal_id
3437 ,x_enquiry_no => get_appl_dets_rec.enquiry_no
3438 ,x_oss_person_id => get_appl_dets_rec.oss_person_id
3439 ,x_application_source => get_appl_dets_rec.application_source
3440 ,x_name_change_date => get_appl_dets_rec.name_change_date
3441 ,x_student_support => get_appl_dets_rec.student_support
3442 ,x_address_area => get_appl_dets_rec.address_area
3443 ,x_application_date => get_appl_dets_rec.application_date
3444 ,x_application_sent_date => get_appl_dets_rec.application_sent_date
3445 ,x_application_sent_run => get_appl_dets_rec.application_sent_run
3446 ,x_lea_code => NULL -- obsoleted by UCAS
3447 ,x_fee_payer_code => get_appl_dets_rec.fee_payer_code
3448 ,x_fee_text => get_appl_dets_rec.fee_text
3449 ,x_domicile_apr => get_appl_dets_rec.domicile_apr
3450 ,x_code_changed_date => get_appl_dets_rec.code_changed_date
3451 ,x_school => get_appl_dets_rec.school
3452 ,x_withdrawn => get_appl_dets_rec.withdrawn
3453 ,x_withdrawn_date => get_appl_dets_rec.withdrawn_date
3454 ,x_rel_to_clear_reason => get_appl_dets_rec.rel_to_clear_reason
3455 ,x_route_b => get_appl_dets_rec.route_b
3456 ,x_exam_change_date => get_appl_dets_rec.exam_change_date
3457 ,x_a_levels => NULL -- obsoleted by UCAS
3458 ,x_as_levels => NULL -- obsoleted by UCAS
3459 ,x_highers => NULL -- obsoleted by UCAS
3460 ,x_csys => NULL -- obsoleted by UCAS
3461 ,x_winter => get_appl_dets_rec.winter
3462 ,x_previous => get_appl_dets_rec.previous
3463 ,x_gnvq => NULL -- obsoleted by UCAS
3464 ,x_btec => get_appl_dets_rec.btec
3465 ,x_ilc => get_appl_dets_rec.ilc
3466 ,x_ailc => get_appl_dets_rec.ailc
3467 ,x_ib => get_appl_dets_rec.ib
3468 ,x_manual => get_appl_dets_rec.manual
3469 ,x_reg_num => get_appl_dets_rec.reg_num
3470 ,x_oeq => get_appl_dets_rec.oeq
3471 ,x_eas => get_appl_dets_rec.eas
3472 ,x_roa => get_appl_dets_rec.roa
3473 ,x_status => get_appl_dets_rec.status
3474 ,x_firm_now => get_appl_dets_rec.firm_now
3475 ,x_firm_reply => get_appl_dets_rec.firm_reply
3476 ,x_insurance_reply => get_appl_dets_rec.insurance_reply
3477 ,x_conf_hist_firm_reply => get_appl_dets_rec.conf_hist_firm_reply
3478 ,x_conf_hist_ins_reply => get_appl_dets_rec.conf_hist_ins_reply
3479 ,x_residential_category => get_appl_dets_rec.residential_category
3480 ,x_personal_statement => get_appl_dets_rec.personal_statement
3481 ,x_match_prev => get_appl_dets_rec.match_prev
3482 ,x_match_prev_date => get_appl_dets_rec.match_prev_date
3483 ,x_match_winter => get_appl_dets_rec.match_winter
3484 ,x_match_summer => get_appl_dets_rec.match_summer
3485 ,x_gnvq_date => get_appl_dets_rec.gnvq_date
3486 ,x_ib_date => get_appl_dets_rec.ib_date
3487 ,x_ilc_date => get_appl_dets_rec.ilc_date
3488 ,x_ailc_date => get_appl_dets_rec.ailc_date
3489 ,x_gcseqa_date => get_appl_dets_rec.gcseqa_date
3490 ,x_uk_entry_date => get_appl_dets_rec.uk_entry_date
3491 ,x_prev_surname => get_appl_dets_rec.prev_surname
3492 ,x_criminal_convictions => get_appl_dets_rec.criminal_convictions
3493 ,x_sent_to_hesa => 'N'
3494 ,x_sent_to_oss => 'N'
3495 ,x_batch_identifier => get_appl_dets_rec.batch_identifier
3496 ,x_mode => 'R'
3497 ,x_GCE => get_appl_dets_rec.GCE
3498 ,x_VCE => get_appl_dets_rec.VCE
3499 ,x_SQA => get_appl_dets_rec.SQA
3500 ,x_PREVIOUSAS => get_appl_dets_rec.previousas
3501 ,x_KEYSKILLS => get_appl_dets_rec.keyskills
3502 ,x_VOCATIONAL => get_appl_dets_rec.vocational
3503 ,x_SCN => get_appl_dets_rec.SCN
3504 ,x_PrevOEQ => get_appl_dets_rec.PrevOEQ
3505 ,x_choices_transparent_ind => get_appl_dets_rec.choices_transparent_ind
3506 ,x_extra_status => get_appl_dets_rec.extra_status
3507 ,x_extra_passport_no => get_appl_dets_rec.extra_passport_no
3508 ,x_request_app_dets_ind => get_appl_dets_rec.request_app_dets_ind
3509 ,x_request_copy_app_frm_ind => get_appl_dets_rec.request_copy_app_frm_ind
3510 ,x_cef_no => get_appl_dets_rec.cef_no
3511 ,x_system_code => get_appl_dets_rec.system_code
3512 ,x_gcse_eng => new_ivstarg_rec.gcseeng
3513 ,x_gcse_math => new_ivstarg_rec.gcsemath
3514 ,x_degree_subject => new_ivstarg_rec.degreesubject
3515 ,x_degree_status => new_ivstarg_rec.degreestatus
3516 ,x_degree_class => new_ivstarg_rec.degreeclass
3517 ,x_gcse_sci => new_ivstarg_rec.gcsesci
3518 ,x_welshspeaker => get_appl_dets_rec.welshspeaker
3519 ,x_ni_number => get_appl_dets_rec.ni_number
3520 ,x_earliest_start => get_appl_dets_rec.earliest_start
3521 ,x_near_inst => get_appl_dets_rec.near_inst
3522 ,x_pref_reg => get_appl_dets_rec.pref_reg
3523 ,x_qual_eng => get_appl_dets_rec.qual_eng
3524 ,x_qual_math => get_appl_dets_rec.qual_math
3525 ,x_qual_sci => get_appl_dets_rec.qual_sci
3526 ,x_main_qual => get_appl_dets_rec.main_qual
3527 ,x_qual_5 => get_appl_dets_rec.qual_5
3528 ,x_future_serv => get_appl_dets_rec.future_serv
3529 ,x_future_set => get_appl_dets_rec.future_set
3530 ,x_present_serv => get_appl_dets_rec.present_serv
3531 ,x_present_set => get_appl_dets_rec.present_set
3532 ,x_curr_employment => get_appl_dets_rec.curr_employment
3533 ,x_edu_qualification => get_appl_dets_rec.edu_qualification
3534 ,x_ad_batch_id => get_appl_dets_rec.ad_batch_id
3535 ,x_ad_interface_id => get_appl_dets_rec.ad_interface_id
3536 ,x_nationality => get_appl_dets_rec.nationality
3537 ,x_dual_nationality => get_appl_dets_rec.dual_nationality
3538 ,x_special_needs => get_appl_dets_rec.special_needs
3539 ,x_country_birth => get_appl_dets_rec.country_birth
3540 );
3541
3542 EXCEPTION
3543 WHEN OTHERS THEN
3544 g_error_code := '9998';
3545 fnd_file.put_line(fnd_file.log, SQLERRM);
3546 END;
3547
3548 END IF; -- error code
3549
3550
3551 -- Application Choice processing
3552 IF g_error_code IS NULL THEN
3553 ------------------------------------------------
3554 -- Deferred value derivation/defaulting
3555 ------------------------------------------------
3556 -- get entry year from ucas control table.
3557 OPEN get_control_entry_year(get_appl_dets_rec.system_code, new_ivstarg_rec.ucas_cycle);
3558 FETCH get_control_entry_year INTO l_entry_year ;
3559 CLOSE get_control_entry_year;
3560
3561 -- DEFERRED value derivation
3562 -- If ivstarc.entry_year > igs_uc_ucas_control.entry_year then deferred='Y' else 'N'.
3563 IF new_ivstarg_rec.entryyear > l_entry_year THEN
3564 l_deferred := 'Y' ;
3565 ELSE
3566 l_deferred := 'N' ;
3567 END IF ;
3568
3569
3570 -- Check wether the Application record already exists.
3571 -- If exists , update the records otherwise insert a new record.
3572 OPEN old_starg_cur(new_ivstarg_rec.appno, new_ivstarg_rec.roundno, new_ivstarg_rec.ucas_cycle);
3573 FETCH old_starg_cur INTO old_starg_rec;
3574 CLOSE old_starg_cur;
3575
3576 IF old_starg_rec.rowid IS NULL THEN
3577
3578 ------------------------------------------------
3579 -- get OSS Program details
3580 ------------------------------------------------
3581 OPEN get_oss_prog_cur (new_ivstarg_rec.course, new_ivstarg_rec.campus,
3582 new_ivstarg_rec.inst, get_appl_dets_rec.system_code);
3583 FETCH get_oss_prog_cur INTO oss_prog_rec;
3584
3585 IF new_ivstarg_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
3586 g_error_code := '1045'; -- UCAS Course not found
3587
3588 END IF;
3589 CLOSE get_oss_prog_cur;
3590
3591
3592 --Added code to check before inserting records to IGS_UC_APP_CHOICES whether there exists record with
3593 --same institution code and system code but having choice number as 99.If there exists no records, then insert is performed
3594
3595 OPEN curr_inst_cur(get_appl_dets_rec.system_code);
3596 FETCH curr_inst_cur INTO curr_inst_rec;
3597 CLOSE curr_inst_cur;
3598
3599
3600 IF curr_inst_rec.current_inst_code = new_ivstarg_rec.inst THEN -- checking of system code (G or S)not required as choice no 99
3601 -- can exist only for GTTR and SWAS systems
3602 OPEN old_starg_cur(new_ivstarg_rec.appno, 99, new_ivstarg_rec.ucas_cycle);
3603 FETCH old_starg_cur INTO old_starg_99_rec;
3604 CLOSE old_starg_cur;
3605
3606 END IF;
3607
3608 IF old_starg_99_rec.rowid IS NULL THEN
3609
3610
3611 IF g_error_code IS NULL THEN
3612
3613 BEGIN
3614 -- call the TBH to Insert new record
3615 igs_uc_app_choices_pkg.insert_row -- IGSXI02B.pls
3616 (
3617 x_rowid => old_starg_rec.rowid
3618 ,x_app_choice_id => l_app_choice_id
3619 ,x_app_id => get_appl_dets_rec.app_id
3620 ,x_app_no => new_ivstarg_rec.appno
3621 ,x_choice_no => new_ivstarg_rec.roundno
3622 ,x_last_change => new_ivstarg_rec.lastchange
3623 ,x_institute_code => new_ivstarg_rec.inst
3624 ,x_ucas_program_code => new_ivstarg_rec.course
3625 ,x_oss_program_code => oss_prog_rec.oss_program_code
3626 ,x_oss_program_version => oss_prog_rec.oss_program_version
3627 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
3628 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
3629 ,x_campus => new_ivstarg_rec.campus
3630 ,x_oss_location => oss_prog_rec.oss_location
3631 ,x_faculty => NULL
3632 ,x_entry_year => new_ivstarg_rec.entryyear
3633 ,x_entry_month => NVL(new_ivstarg_rec.entrymonth,0)
3634 ,x_point_of_entry => NULL
3635 ,x_home => 'N'
3636 ,x_deferred => l_deferred
3637 ,x_route_b_pref_round => NULL
3638 ,x_route_b_actual_round => NULL
3639 ,x_condition_category => NULL
3640 ,x_condition_code => NULL
3641 ,x_decision => new_ivstarg_rec.decision
3642 ,x_decision_date => NULL
3643 ,x_decision_number => NULL
3644 ,x_reply => new_ivstarg_rec.reply
3645 ,x_summary_of_cond => NULL
3646 ,x_choice_cancelled => NULL
3647 ,x_action => new_ivstarg_rec.action
3648 ,x_substitution => NULL
3649 ,x_date_substituted => NULL
3650 ,x_prev_institution => NULL
3651 ,x_prev_course => NULL
3652 ,x_prev_campus => NULL
3653 ,x_ucas_amendment => NULL
3654 ,x_withdrawal_reason => NULL
3655 ,x_offer_course => NULL
3656 ,x_offer_campus => NULL
3657 ,x_offer_crse_length => NULL
3658 ,x_offer_entry_month => NULL
3659 ,x_offer_entry_year => NULL
3660 ,x_offer_entry_point => NULL
3661 ,x_offer_text => NULL
3662 ,x_mode => 'R'
3663 ,x_export_to_oss_status => 'NEW'
3664 ,x_error_code => NULL
3665 ,x_request_id => NULL
3666 ,x_batch_id => NULL
3667 ,x_extra_round_nbr => NULL
3668 ,x_system_code => get_appl_dets_rec.system_code
3669 ,x_part_time => new_ivstarg_rec.parttime
3670 ,x_interview => new_ivstarg_rec.interview
3671 ,x_late_application => new_ivstarg_rec.lateapplication
3672 ,x_modular => new_ivstarg_rec.modular
3673 ,x_residential => NULL
3674 ,x_ucas_cycle => new_ivstarg_rec.ucas_cycle
3675 );
3676
3677 EXCEPTION
3678 WHEN OTHERS THEN
3679
3680 g_error_code := '9999';
3681 fnd_file.put_line(fnd_file.log, SQLERRM);
3682 END;
3683
3684 END IF; -- error code
3685
3686 ELSE --if 99 rowid is not null
3687
3688 /* Update the record */
3689
3690 ------------------------------------------------
3691 -- For an Application Choice if the UCAS Course details are modified at UCAS end,
3692 -- then the OSS program details for such an application needs to be derived again
3693 -- based on the new/updated UCAS Course. Otherwise, if the UCAS Course details
3694 -- remain the same, then the existing OSS Program details for this record are retained.
3695 ------------------------------------------------
3696
3697 -- Checking whether the UCAS Program details have been modified at UCAS End.
3698 IF new_ivstarg_rec.course <> old_starg_99_rec.ucas_program_code OR
3699 new_ivstarg_rec.campus <> old_starg_99_rec.campus OR
3700 new_ivstarg_rec.inst <> old_starg_99_rec.institute_code THEN
3701
3702 -- Derive the OSS Program details for the new/updated UCAS Course.
3703 OPEN get_oss_prog_cur (new_ivstarg_rec.course, new_ivstarg_rec.campus,
3704 new_ivstarg_rec.inst, old_starg_99_rec.system_code);
3705 FETCH get_oss_prog_cur INTO oss_prog_rec;
3706
3707 IF new_ivstarg_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
3708 g_error_code := '1045'; -- UCAS Course not found
3709
3710 END IF;
3711 CLOSE get_oss_prog_cur;
3712
3713 ELSE
3714 -- i.e. If UCAS Course details have not changed.
3715 -- Retain the existing OSS Program details for this record in App Choices table.
3716
3717 -- copying existing values for the record to the program record variable.
3718 oss_prog_rec.oss_program_code := old_starg_99_rec.oss_program_code ;
3719 oss_prog_rec.oss_program_version := old_starg_99_rec.oss_program_version ;
3720 oss_prog_rec.oss_attendance_type := old_starg_99_rec.oss_attendance_type ;
3721 oss_prog_rec.oss_attendance_mode := old_starg_99_rec.oss_attendance_mode ;
3722 oss_prog_rec.oss_location := old_starg_99_rec.oss_location ;
3723
3724 END IF;
3725
3726
3727 --If it exists, the record is updated using choice number as IGS_UC_ISTARC_INTS.ROUNDNO. Also if there exists records
3728 --in IGS_UC_TRANSACTIONS with choice_no = 99 then those records are also updated.Bug#3239860
3729
3730
3731 BEGIN
3732
3733 FOR uc_transaction_rec IN uc_transaction_cur(new_ivstarg_rec.appno)
3734 LOOP
3735 igs_uc_transactions_pkg.update_row
3736 (
3737 x_rowid => uc_transaction_rec.rowid,
3738 x_uc_tran_id => uc_transaction_rec.uc_tran_id,
3739 x_transaction_id => uc_transaction_rec.transaction_id,
3740 x_datetimestamp => uc_transaction_rec.datetimestamp,
3741 x_updater => uc_transaction_rec.updater,
3742 x_error_code => uc_transaction_rec.error_code,
3743 x_transaction_type => uc_transaction_rec.transaction_type,
3744 x_app_no => uc_transaction_rec.app_no,
3745 x_choice_no => new_ivstarg_rec.roundno,
3746 x_decision => uc_transaction_rec.decision,
3747 x_program_code => uc_transaction_rec.program_code,
3748 x_campus => uc_transaction_rec.campus,
3749 x_entry_month => uc_transaction_rec.entry_month,
3750 x_entry_year => uc_transaction_rec.entry_year,
3751 x_entry_point => uc_transaction_rec.entry_point,
3752 x_soc => uc_transaction_rec.soc,
3753 x_comments_in_offer => uc_transaction_rec.comments_in_offer,
3754 x_return1 => uc_transaction_rec.return1,
3755 x_return2 => uc_transaction_rec.return2,
3756 x_hold_flag => uc_transaction_rec.hold_flag,
3757 x_sent_to_ucas => uc_transaction_rec.sent_to_ucas,
3758 x_test_cond_cat => uc_transaction_rec.test_cond_cat,
3759 x_test_cond_name => uc_transaction_rec.test_cond_name,
3760 x_mode => 'R',
3761 x_inst_reference => uc_transaction_rec.inst_reference,
3762 x_auto_generated_flag => uc_transaction_rec.auto_generated_flag,
3763 x_system_code => uc_transaction_rec.system_code,
3764 x_ucas_cycle => uc_transaction_rec.ucas_cycle,
3765 x_modular => uc_transaction_rec.modular,
3766 x_part_time => uc_transaction_rec.part_time
3767 );
3768
3769 END LOOP;
3770
3771
3772 EXCEPTION
3773 WHEN OTHERS THEN
3774 g_error_code := '9998';
3775 fnd_file.put_line(fnd_file.log, SQLERRM);
3776 END;
3777
3778
3779 IF g_error_code IS NULL THEN
3780
3781 BEGIN
3782 -- call the TBH to update the record
3783 igs_uc_app_choices_pkg.update_row -- IGSXI02B.pls
3784 (
3785 x_rowid => old_starg_99_rec.rowid
3786 ,x_app_choice_id => old_starg_99_rec.app_choice_id
3787 ,x_app_id => old_starg_99_rec.app_id
3788 ,x_app_no => old_starg_99_rec.app_no
3789 ,x_choice_no => new_ivstarg_rec.roundno
3790 ,x_last_change => new_ivstarg_rec.lastchange
3791 ,x_institute_code => new_ivstarg_rec.inst
3792 ,x_ucas_program_code => new_ivstarg_rec.course
3793 ,x_oss_program_code => oss_prog_rec.oss_program_code
3794 ,x_oss_program_version => oss_prog_rec.oss_program_version
3795 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
3796 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
3797 ,x_campus => new_ivstarg_rec.campus
3798 ,x_oss_location => oss_prog_rec.oss_location
3799 ,x_faculty => old_starg_99_rec.faculty
3800 ,x_entry_year => NVL(new_ivstarg_rec.entryyear,0)
3801 ,x_entry_month => NVL(new_ivstarg_rec.entrymonth,0)
3802 ,x_point_of_entry => old_starg_99_rec.point_of_entry
3803 ,x_home => old_starg_99_rec.home
3804 ,x_deferred => l_deferred
3805 ,x_route_b_pref_round => old_starg_99_rec.route_b_pref_round
3806 ,x_route_b_actual_round => old_starg_99_rec.route_b_actual_round
3807 ,x_condition_category => old_starg_99_rec.condition_category
3808 ,x_condition_code => old_starg_99_rec.condition_code
3809 ,x_decision => new_ivstarg_rec.decision
3810 ,x_decision_date => old_starg_99_rec.decision_date
3811 ,x_decision_number => old_starg_99_rec.decision_number
3812 ,x_reply => new_ivstarg_rec.reply
3813 ,x_summary_of_cond => old_starg_99_rec.summary_of_cond
3814 ,x_choice_cancelled => old_starg_99_rec.choice_cancelled
3815 ,x_action => new_ivstarg_rec.action
3816 ,x_substitution => old_starg_99_rec.substitution
3817 ,x_date_substituted => old_starg_99_rec.date_substituted
3818 ,x_prev_institution => old_starg_99_rec.prev_institution
3819 ,x_prev_course => old_starg_99_rec.prev_course
3820 ,x_prev_campus => old_starg_99_rec.prev_campus
3821 ,x_ucas_amendment => old_starg_99_rec.ucas_amendment
3822 ,x_withdrawal_reason => old_starg_99_rec.withdrawal_reason
3823 ,x_offer_course => old_starg_99_rec.offer_course
3824 ,x_offer_campus => old_starg_99_rec.offer_campus
3825 ,x_offer_crse_length => old_starg_99_rec.offer_crse_length
3826 ,x_offer_entry_month => old_starg_99_rec.offer_entry_month
3827 ,x_offer_entry_year => old_starg_99_rec.offer_entry_year
3828 ,x_offer_entry_point => old_starg_99_rec.offer_entry_point
3829 ,x_offer_text => old_starg_99_rec.offer_text
3830 ,x_mode => 'R'
3831 ,x_export_to_oss_status => 'NEW'
3832 ,x_error_code => NULL
3833 ,x_request_id => NULL
3834 ,x_batch_id => NULL
3835 ,x_extra_round_nbr => old_starg_99_rec.extra_round_nbr
3836 ,x_system_code => old_starg_99_rec.system_code
3837 ,x_part_time => new_ivstarg_rec.parttime
3838 ,x_interview => new_ivstarg_rec.interview
3839 ,x_late_application => new_ivstarg_rec.lateapplication
3840 ,x_modular => new_ivstarg_rec.modular
3841 ,x_residential => old_starg_99_rec.residential
3842 ,x_ucas_cycle => old_starg_99_rec.ucas_cycle
3843 );
3844
3845 EXCEPTION
3846 WHEN OTHERS THEN
3847 g_error_code := '9998';
3848 fnd_file.put_line(fnd_file.log, SQLERRM);
3849 END;
3850 END IF; -- error code
3851
3852
3853 END IF;-- old starg 99 row id check
3854
3855
3856 ELSE --if old_starg_rec.rowid IS NOT NULL
3857
3858 /* Update the record */
3859
3860 ------------------------------------------------
3861 -- For an Application Choice if the UCAS Course details are modified at UCAS end,
3862 -- then the OSS program details for such an application needs to be derived again
3863 -- based on the new/updated UCAS Course. Otherwise, if the UCAS Course details
3864 -- remain the same, then the existing OSS Program details for this record are retained.
3865 ------------------------------------------------
3866
3867 -- Checking whether the UCAS Program details have been modified at UCAS End.
3868 IF new_ivstarg_rec.course <> old_starg_rec.ucas_program_code OR
3869 new_ivstarg_rec.campus <> old_starg_rec.campus OR
3870 new_ivstarg_rec.inst <> old_starg_rec.institute_code THEN
3871
3872 -- Derive the OSS Program details for the new/updated UCAS Course.
3873 OPEN get_oss_prog_cur (new_ivstarg_rec.course, new_ivstarg_rec.campus,
3874 new_ivstarg_rec.inst, old_starg_rec.system_code);
3875 FETCH get_oss_prog_cur INTO oss_prog_rec;
3876
3877 IF new_ivstarg_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
3878 g_error_code := '1045'; -- UCAS Course not found
3879
3880 END IF;
3881 CLOSE get_oss_prog_cur;
3882
3883 ELSE
3884 -- i.e. If UCAS Course details have not changed.
3885 -- Retain the existing OSS Program details for this record in App Choices table.
3886
3887 -- copying existing values for the record to the program record variable.
3888 oss_prog_rec.oss_program_code := old_starg_rec.oss_program_code ;
3889 oss_prog_rec.oss_program_version := old_starg_rec.oss_program_version ;
3890 oss_prog_rec.oss_attendance_type := old_starg_rec.oss_attendance_type ;
3891 oss_prog_rec.oss_attendance_mode := old_starg_rec.oss_attendance_mode ;
3892 oss_prog_rec.oss_location := old_starg_rec.oss_location ;
3893
3894 END IF;
3895
3896
3897 IF g_error_code IS NULL THEN
3898
3899 BEGIN
3900 -- call the TBH to update the record
3901 igs_uc_app_choices_pkg.update_row -- IGSXI02B.pls
3902 (
3903 x_rowid => old_starg_rec.rowid
3904 ,x_app_choice_id => old_starg_rec.app_choice_id
3905 ,x_app_id => old_starg_rec.app_id
3906 ,x_app_no => old_starg_rec.app_no
3907 ,x_choice_no => old_starg_rec.choice_no
3908 ,x_last_change => new_ivstarg_rec.lastchange
3909 ,x_institute_code => new_ivstarg_rec.inst
3910 ,x_ucas_program_code => new_ivstarg_rec.course
3911 ,x_oss_program_code => oss_prog_rec.oss_program_code
3912 ,x_oss_program_version => oss_prog_rec.oss_program_version
3913 ,x_oss_attendance_type => oss_prog_rec.oss_attendance_type
3914 ,x_oss_attendance_mode => oss_prog_rec.oss_attendance_mode
3915 ,x_campus => new_ivstarg_rec.campus
3916 ,x_oss_location => oss_prog_rec.oss_location
3917 ,x_faculty => old_starg_rec.faculty
3918 ,x_entry_year => NVL(new_ivstarg_rec.entryyear,0)
3919 ,x_entry_month => NVL(new_ivstarg_rec.entrymonth,0)
3920 ,x_point_of_entry => old_starg_rec.point_of_entry
3921 ,x_home => old_starg_rec.home
3922 ,x_deferred => l_deferred
3923 ,x_route_b_pref_round => old_starg_rec.route_b_pref_round
3924 ,x_route_b_actual_round => old_starg_rec.route_b_actual_round
3925 ,x_condition_category => old_starg_rec.condition_category
3926 ,x_condition_code => old_starg_rec.condition_code
3927 ,x_decision => new_ivstarg_rec.decision
3928 ,x_decision_date => old_starg_rec.decision_date
3929 ,x_decision_number => old_starg_rec.decision_number
3930 ,x_reply => new_ivstarg_rec.reply
3931 ,x_summary_of_cond => old_starg_rec.summary_of_cond
3932 ,x_choice_cancelled => old_starg_rec.choice_cancelled
3933 ,x_action => new_ivstarg_rec.action
3934 ,x_substitution => old_starg_rec.substitution
3935 ,x_date_substituted => old_starg_rec.date_substituted
3936 ,x_prev_institution => old_starg_rec.prev_institution
3937 ,x_prev_course => old_starg_rec.prev_course
3938 ,x_prev_campus => old_starg_rec.prev_campus
3939 ,x_ucas_amendment => old_starg_rec.ucas_amendment
3940 ,x_withdrawal_reason => old_starg_rec.withdrawal_reason
3941 ,x_offer_course => old_starg_rec.offer_course
3942 ,x_offer_campus => old_starg_rec.offer_campus
3943 ,x_offer_crse_length => old_starg_rec.offer_crse_length
3944 ,x_offer_entry_month => old_starg_rec.offer_entry_month
3945 ,x_offer_entry_year => old_starg_rec.offer_entry_year
3946 ,x_offer_entry_point => old_starg_rec.offer_entry_point
3947 ,x_offer_text => old_starg_rec.offer_text
3948 ,x_mode => 'R'
3949 ,x_export_to_oss_status => 'NEW'
3950 ,x_error_code => NULL
3951 ,x_request_id => NULL
3952 ,x_batch_id => NULL
3953 ,x_extra_round_nbr => old_starg_rec.extra_round_nbr
3954 ,x_system_code => old_starg_rec.system_code
3955 ,x_part_time => new_ivstarg_rec.parttime
3956 ,x_interview => new_ivstarg_rec.interview
3957 ,x_late_application => new_ivstarg_rec.lateapplication
3958 ,x_modular => new_ivstarg_rec.modular
3959 ,x_residential => old_starg_rec.residential
3960 ,x_ucas_cycle => old_starg_rec.ucas_cycle
3961 );
3962
3963 EXCEPTION
3964 WHEN OTHERS THEN
3965 g_error_code := '9998';
3966 fnd_file.put_line(fnd_file.log, SQLERRM);
3967 END;
3968 END IF; -- error code
3969
3970 END IF; -- insert / update (starg rowid check)
3971
3972 END IF; -- main processing
3973
3974 EXCEPTION
3975 WHEN OTHERS THEN
3976 -- catch any unhandled/unexpected errors while processing a record.
3977 -- This would enable processing to continue with subsequent records.
3978 ROLLBACK TO process_ivstarg;
3979
3980 -- Close any Open cursors
3981 IF get_oss_prog_cur%ISOPEN THEN
3982 CLOSE get_oss_prog_cur;
3983 END IF;
3984
3985
3986 IF old_starg_cur%ISOPEN THEN
3987 CLOSE old_starg_cur;
3988 END IF;
3989
3990 IF get_control_entry_year%ISOPEN THEN
3991 CLOSE get_control_entry_year;
3992 END IF;
3993
3994 IF get_appl_dets%ISOPEN THEN
3995 CLOSE get_appl_dets;
3996 END IF;
3997
3998 IF validate_Institution%ISOPEN THEN
3999 CLOSE validate_Institution;
4000 END IF;
4001
4002 g_error_code := '1055';
4003 fnd_file.put_line(fnd_file.log, SQLERRM);
4004 END;
4005
4006 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
4007 -- while processing the record.
4008 IF g_error_code IS NOT NULL THEN
4009
4010 UPDATE igs_uc_istarg_ints
4011 SET error_code = g_error_code
4012 WHERE rowid = new_ivstarg_rec.rowid;
4013
4014 -- log error message/meaning.
4015 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
4016
4017 -- update error count
4018 g_error_rec_cnt := g_error_rec_cnt + 1;
4019
4020 ELSE
4021
4022 UPDATE igs_uc_istarg_ints
4023 SET record_status = 'D',
4024 error_code = NULL
4025 WHERE rowid = new_ivstarg_rec.rowid;
4026
4027 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
4028 END IF;
4029
4030 END LOOP;
4031
4032 COMMIT;
4033 -- log processing complete for this view
4034 igs_uc_proc_ucas_data.log_proc_complete('IVSTARG', g_success_rec_cnt, g_error_rec_cnt);
4035
4036 EXCEPTION
4037 WHEN OTHERS THEN
4038 ROLLBACK TO process_ivstarg;
4039 COMMIT;
4040 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
4041 fnd_message.set_token('VIEW', 'IVSTARG'||' - '||SQLERRM);
4042 fnd_file.put_line(fnd_file.log, fnd_message.get);
4043 END process_ivstarg;
4044
4045
4046
4047 PROCEDURE process_ivstart IS
4048 /******************************************************************
4049 Created By : rgangara
4050 Date Created By : 12-JUNE-2003
4051 Purpose : For processing IVSTART info. details from UCAS.
4052 Known limitations,enhancements,remarks:
4053 Change History
4054 Who When What
4055 ******************************************************************/
4056
4057 CURSOR new_ivstart_cur IS
4058 SELECT ivstt.rowid,
4059 ivstt.*
4060 FROM igs_uc_istart_ints ivstt
4061 WHERE record_status = 'N';
4062
4063
4064 CURSOR old_start_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
4065 SELECT ucap.rowid,
4066 ucap.*
4067 FROM igs_uc_applicants ucap
4068 WHERE ucap.app_no = p_appno;
4069
4070 old_start_rec old_start_cur%ROWTYPE;
4071
4072 BEGIN
4073
4074 -- initialize variables
4075 g_success_rec_cnt := 0;
4076 g_error_rec_cnt := 0;
4077 g_error_code := NULL;
4078
4079 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
4080 fnd_message.set_token('VIEW', 'IVSTART ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
4081 fnd_file.put_line(fnd_file.log, fnd_message.get);
4082
4083 -- Get all the reocords from interface table with status = 'N'
4084 FOR new_ivstart_rec IN new_ivstart_cur
4085 LOOP
4086 BEGIN
4087 -- initialize record level variables.
4088 g_error_code := NULL;
4089 old_start_rec := NULL;
4090
4091
4092 -- log Application processing message.
4093 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
4094 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstart_rec.appno));
4095 fnd_file.put_line(fnd_file.log, fnd_message.get);
4096
4097
4098 -- mandatory field validations
4099 IF new_ivstart_rec.appno IS NULL THEN
4100 g_error_code := '1037';
4101 END IF;
4102
4103
4104 ----------------------------
4105 -- AppNo validation
4106 ----------------------------
4107 IF g_error_code IS NULL THEN
4108 -- validate Applicant record details in UCAS Applicants table.
4109 -- This is because record gets inserted into igs_uc_app_choices as part of
4110 -- IVSTARN processing and hence at this stage the record must exist.
4111 validate_applicant (new_ivstart_rec.appno, g_error_code);
4112
4113 END IF;
4114
4115
4116 ----------------------------
4117 -- MAIN PROCESSING Begins
4118 ----------------------------
4119 IF g_error_code IS NULL THEN
4120
4121 -- Corresponding Application record would exist at this point
4122 -- otherwise the earlier validaton for error 1000 would have failed.
4123 OPEN old_start_cur(new_ivstart_rec.appno);
4124 FETCH old_start_cur INTO old_start_rec;
4125 CLOSE old_start_cur;
4126
4127
4128 BEGIN
4129 -- call the TBH to update the record
4130 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
4131 (
4132 x_rowid => old_start_rec.rowid
4133 ,x_app_id => old_start_rec.app_id
4134 ,x_app_no => old_start_rec.app_no
4135 ,x_check_digit => old_start_rec.check_digit
4136 ,x_personal_id => old_start_rec.personal_id
4137 ,x_enquiry_no => old_start_rec.enquiry_no
4138 ,x_oss_person_id => old_start_rec.oss_person_id
4139 ,x_application_source => old_start_rec.application_source
4140 ,x_name_change_date => old_start_rec.name_change_date
4141 ,x_student_support => old_start_rec.student_support
4142 ,x_address_area => old_start_rec.address_area
4143 ,x_application_date => old_start_rec.application_date
4144 ,x_application_sent_date => old_start_rec.application_sent_date
4145 ,x_application_sent_run => old_start_rec.application_sent_run
4146 ,x_lea_code => NULL -- obsoleted by UCAS
4147 ,x_fee_payer_code => old_start_rec.fee_payer_code
4148 ,x_fee_text => old_start_rec.fee_text
4149 ,x_domicile_apr => old_start_rec.domicile_apr
4150 ,x_code_changed_date => old_start_rec.code_changed_date
4151 ,x_school => old_start_rec.school
4152 ,x_withdrawn => old_start_rec.withdrawn
4153 ,x_withdrawn_date => old_start_rec.withdrawn_date
4154 ,x_rel_to_clear_reason => old_start_rec.rel_to_clear_reason
4155 ,x_route_b => old_start_rec.route_b
4156 ,x_exam_change_date => old_start_rec.exam_change_date
4157 ,x_a_levels => NULL -- obsoleted by UCAS
4158 ,x_as_levels => NULL -- obsoleted by UCAS
4159 ,x_highers => NULL -- obsoleted by UCAS
4160 ,x_csys => NULL -- obsoleted by UCAS
4161 ,x_winter => old_start_rec.winter
4162 ,x_previous => old_start_rec.previous
4163 ,x_gnvq => NULL -- obsoleted by UCAS
4164 ,x_btec => old_start_rec.btec
4165 ,x_ilc => old_start_rec.ilc
4166 ,x_ailc => old_start_rec.ailc
4167 ,x_ib => old_start_rec.ib
4168 ,x_manual => old_start_rec.manual
4169 ,x_reg_num => old_start_rec.reg_num
4170 ,x_oeq => old_start_rec.oeq
4171 ,x_eas => old_start_rec.eas
4172 ,x_roa => old_start_rec.roa
4173 ,x_status => old_start_rec.status
4174 ,x_firm_now => old_start_rec.firm_now
4175 ,x_firm_reply => old_start_rec.firm_reply
4176 ,x_insurance_reply => old_start_rec.insurance_reply
4177 ,x_conf_hist_firm_reply => old_start_rec.conf_hist_firm_reply
4178 ,x_conf_hist_ins_reply => old_start_rec.conf_hist_ins_reply
4179 ,x_residential_category => old_start_rec.residential_category
4180 ,x_personal_statement => old_start_rec.personal_statement
4181 ,x_match_prev => old_start_rec.match_prev
4182 ,x_match_prev_date => old_start_rec.match_prev_date
4183 ,x_match_winter => old_start_rec.match_winter
4184 ,x_match_summer => old_start_rec.match_summer
4185 ,x_gnvq_date => old_start_rec.gnvq_date
4186 ,x_ib_date => old_start_rec.ib_date
4187 ,x_ilc_date => old_start_rec.ilc_date
4188 ,x_ailc_date => old_start_rec.ailc_date
4189 ,x_gcseqa_date => old_start_rec.gcseqa_date
4190 ,x_uk_entry_date => old_start_rec.uk_entry_date
4191 ,x_prev_surname => old_start_rec.prev_surname
4192 ,x_criminal_convictions => old_start_rec.criminal_convictions
4193 ,x_sent_to_hesa => 'N'
4194 ,x_sent_to_oss => 'N'
4195 ,x_batch_identifier => old_start_rec.batch_identifier
4196 ,x_mode => 'R'
4197 ,x_gce => old_start_rec.gce
4198 ,x_vce => old_start_rec.vce
4199 ,x_sqa => old_start_rec.sqa
4200 ,x_previousas => old_start_rec.previousas
4201 ,x_keyskills => old_start_rec.keyskills
4202 ,x_vocational => old_start_rec.vocational
4203 ,x_scn => old_start_rec.scn
4204 ,x_PrevOEQ => old_start_rec.PrevOEQ
4205 ,x_choices_transparent_ind => old_start_rec.choices_transparent_ind
4206 ,x_extra_status => old_start_rec.extra_status
4207 ,x_extra_passport_no => old_start_rec.extra_passport_no
4208 ,x_request_app_dets_ind => old_start_rec.request_app_dets_ind
4209 ,x_request_copy_app_frm_ind => old_start_rec.request_copy_app_frm_ind
4210 ,x_cef_no => old_start_rec.cef_no
4211 ,x_system_code => old_start_rec.system_code
4212 ,x_gcse_eng => old_start_rec.gcse_eng
4213 ,x_gcse_math => old_start_rec.gcse_math
4214 ,x_degree_subject => old_start_rec.degree_subject
4215 ,x_degree_status => old_start_rec.degree_status
4216 ,x_degree_class => old_start_rec.degree_class
4217 ,x_gcse_sci => old_start_rec.gcse_sci
4218 ,x_welshspeaker => old_start_rec.welshspeaker
4219 ,x_ni_number => old_start_rec.ni_number
4220 ,x_earliest_start => old_start_rec.earliest_start
4221 ,x_near_inst => old_start_rec.near_inst
4222 ,x_pref_reg => old_start_rec.pref_reg
4223 ,x_qual_eng => old_start_rec.qual_eng
4224 ,x_qual_math => old_start_rec.qual_math
4225 ,x_qual_sci => old_start_rec.qual_sci
4226 ,x_main_qual => old_start_rec.main_qual
4227 ,x_qual_5 => old_start_rec.qual_5
4228 ,x_future_serv => new_ivstart_rec.futureserv
4229 ,x_future_set => new_ivstart_rec.futureset
4230 ,x_present_serv => new_ivstart_rec.presentserv
4231 ,x_present_set => new_ivstart_rec.presentset
4232 ,x_curr_employment => new_ivstart_rec.curremp
4233 ,x_edu_qualification => new_ivstart_rec.eduqual
4234 ,x_ad_batch_id => old_start_rec.ad_batch_id
4235 ,x_ad_interface_id => old_start_rec.ad_interface_id
4236 ,x_nationality => old_start_rec.nationality
4237 ,x_dual_nationality => old_start_rec.dual_nationality
4238 ,x_special_needs => old_start_rec.special_needs
4239 ,x_country_birth => old_start_rec.country_birth
4240 );
4241
4242 EXCEPTION
4243 WHEN OTHERS THEN
4244 g_error_code := '9998';
4245 fnd_file.put_line(fnd_file.log, SQLERRM);
4246 END;
4247
4248 END IF; -- main processing
4249
4250
4251 EXCEPTION
4252 WHEN OTHERS THEN
4253 -- catch any unhandled/unexpected errors while processing a record.
4254 -- This would enable processing to continue with subsequent records.
4255
4256 -- Close any Open cursors
4257 IF old_start_cur%ISOPEN THEN
4258 CLOSE old_start_cur;
4259 END IF;
4260
4261 g_error_code := '1055';
4262 fnd_file.put_line(fnd_file.log, SQLERRM);
4263 END;
4264
4265 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
4266 -- while processing the record.
4267 IF g_error_code IS NOT NULL THEN
4268
4269 UPDATE igs_uc_istart_ints
4270 SET error_code = g_error_code
4271 WHERE rowid = new_ivstart_rec.rowid;
4272
4273 -- log error message/meaning.
4274 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
4275
4276 -- update error count
4277 g_error_rec_cnt := g_error_rec_cnt + 1;
4278
4279 ELSE
4280
4281 UPDATE igs_uc_istart_ints
4282 SET record_status = 'D',
4283 error_code = NULL
4284 WHERE rowid = new_ivstart_rec.rowid;
4285
4286 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
4287 END IF;
4288
4289 END LOOP;
4290
4291 COMMIT;
4292 -- log processing complete for this view
4293 igs_uc_proc_ucas_data.log_proc_complete('IVSTART', g_success_rec_cnt, g_error_rec_cnt);
4294
4295 EXCEPTION
4296 WHEN OTHERS THEN
4297 ROLLBACK;
4298 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
4299 fnd_message.set_token('VIEW', 'IVSTART'||' - '||SQLERRM);
4300 fnd_file.put_line(fnd_file.log, fnd_message.get);
4301 END process_ivstart;
4302
4303
4304
4305 PROCEDURE process_ivqualification IS
4306 /******************************************************************
4307 Created By : rgangara
4308 Date Created By : 12-JUNE-2003
4309 Purpose : For processing IVQUALIFICATION i.e. Applicant
4310 qualification info. details from UCAS.
4311 Known limitations,enhancements,remarks:
4312 Change History
4313 Who When What
4314 ******************************************************************/
4315
4316 CURSOR new_ivqual_cur IS
4317 SELECT ivqual.rowid,
4318 ivqual.*
4319 FROM igs_uc_iqual_ints ivqual
4320 WHERE ivqual.record_status = 'N';
4321
4322
4323 CURSOR old_qual_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
4324 SELECT ucap.rowid,
4325 ucap.*
4326 FROM igs_uc_applicants ucap
4327 WHERE ucap.app_no = p_appno;
4328
4329 old_qual_rec old_qual_cur%ROWTYPE;
4330
4331 BEGIN
4332
4333 -- initialize variables
4334 g_success_rec_cnt := 0;
4335 g_error_rec_cnt := 0;
4336 g_error_code := NULL;
4337
4338 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
4339 fnd_message.set_token('VIEW', 'IVQUALIFICATION ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
4340 fnd_file.put_line(fnd_file.log, fnd_message.get);
4341
4342 -- Get all the reocords from interface table with status = 'N'
4343 FOR new_ivqual_rec IN new_ivqual_cur
4344 LOOP
4345 BEGIN
4346
4347 -- initialize record level variables.
4348 g_error_code := NULL;
4349 old_qual_rec := NULL;
4350
4351
4352 -- log Application processing message.
4353 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
4354 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivqual_rec.appno));
4355 fnd_file.put_line(fnd_file.log, fnd_message.get);
4356
4357
4358 -- mandatory field validations as this is an update
4359 IF new_ivqual_rec.appno IS NULL THEN
4360 g_error_code := '1037';
4361 END IF;
4362
4363 IF g_error_code IS NULL THEN
4364 ----------------------------
4365 -- AppNo validation
4366 ----------------------------
4367 -- validate Applicant record details in UCAS Applicants table.
4368 -- This is because record gets inserted into igs_uc_app_choices as part of
4369 -- IVSTARN processing and hence at this stage the record must exist.
4370 validate_applicant (new_ivqual_rec.appno, g_error_code);
4371 END IF;
4372
4373 ----------------------------
4374 -- MAIN PROCESSING Begins
4375 ----------------------------
4376 IF g_error_code IS NULL THEN
4377
4378 -- Corresponding Application record would exist at this point
4379 -- otherwise the earlier validaton for error 1000 would have failed.
4380 OPEN old_qual_cur(new_ivqual_rec.appno);
4381 FETCH old_qual_cur INTO old_qual_rec;
4382 CLOSE old_qual_cur;
4383
4384
4385 BEGIN
4386 -- call the TBH to update the record
4387 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
4388 (
4389 x_rowid => old_qual_rec.rowid
4390 ,x_app_id => old_qual_rec.app_id
4391 ,x_app_no => old_qual_rec.app_no
4392 ,x_check_digit => old_qual_rec.check_digit
4393 ,x_personal_id => old_qual_rec.personal_id
4394 ,x_enquiry_no => old_qual_rec.enquiry_no
4395 ,x_oss_person_id => old_qual_rec.oss_person_id
4396 ,x_application_source => old_qual_rec.application_source
4397 ,x_name_change_date => old_qual_rec.name_change_date
4398 ,x_student_support => old_qual_rec.student_support
4399 ,x_address_area => old_qual_rec.address_area
4400 ,x_application_date => old_qual_rec.application_date
4401 ,x_application_sent_date => old_qual_rec.application_sent_date
4402 ,x_application_sent_run => old_qual_rec.application_sent_run
4403 ,x_lea_code => NULL -- obsoleted by UCAS
4404 ,x_fee_payer_code => old_qual_rec.fee_payer_code
4405 ,x_fee_text => old_qual_rec.fee_text
4406 ,x_domicile_apr => old_qual_rec.domicile_apr
4407 ,x_code_changed_date => old_qual_rec.code_changed_date
4408 ,x_school => old_qual_rec.school
4409 ,x_withdrawn => old_qual_rec.withdrawn
4410 ,x_withdrawn_date => old_qual_rec.withdrawn_date
4411 ,x_rel_to_clear_reason => old_qual_rec.rel_to_clear_reason
4412 ,x_route_b => old_qual_rec.route_b
4413 ,x_exam_change_date => old_qual_rec.exam_change_date
4414 ,x_a_levels => NULL -- obsoleted by UCAS
4415 ,x_as_levels => NULL -- obsoleted by UCAS
4416 ,x_highers => NULL -- obsoleted by UCAS
4417 ,x_csys => NULL -- obsoleted by UCAS
4418 ,x_winter => old_qual_rec.winter
4419 ,x_previous => old_qual_rec.previous
4420 ,x_gnvq => NULL -- obsoleted by UCAS
4421 ,x_btec => old_qual_rec.btec
4422 ,x_ilc => old_qual_rec.ilc
4423 ,x_ailc => old_qual_rec.ailc
4424 ,x_ib => old_qual_rec.ib
4425 ,x_manual => old_qual_rec.manual
4426 ,x_reg_num => old_qual_rec.reg_num
4427 ,x_oeq => old_qual_rec.oeq
4428 ,x_eas => old_qual_rec.eas
4429 ,x_roa => old_qual_rec.roa
4430 ,x_status => old_qual_rec.status
4431 ,x_firm_now => old_qual_rec.firm_now
4432 ,x_firm_reply => old_qual_rec.firm_reply
4433 ,x_insurance_reply => old_qual_rec.insurance_reply
4434 ,x_conf_hist_firm_reply => old_qual_rec.conf_hist_firm_reply
4435 ,x_conf_hist_ins_reply => old_qual_rec.conf_hist_ins_reply
4436 ,x_residential_category => old_qual_rec.residential_category
4437 ,x_personal_statement => old_qual_rec.personal_statement
4438 ,x_match_prev => new_ivqual_rec.matchprevious
4439 ,x_match_prev_date => new_ivqual_rec.matchpreviousdate
4440 ,x_match_winter => new_ivqual_rec.matchwinter
4441 ,x_match_summer => new_ivqual_rec.matchsummer
4442 ,x_gnvq_date => new_ivqual_rec.gnvqdate
4443 ,x_ib_date => new_ivqual_rec.ibdate
4444 ,x_ilc_date => new_ivqual_rec.ilcdate
4445 ,x_ailc_date => new_ivqual_rec.aicedate
4446 ,x_gcseqa_date => new_ivqual_rec.gcesqadate
4447 ,x_uk_entry_date => old_qual_rec.uk_entry_date
4448 ,x_prev_surname => old_qual_rec.prev_surname
4449 ,x_criminal_convictions => old_qual_rec.criminal_convictions
4450 ,x_sent_to_hesa => 'N'
4451 ,x_sent_to_oss => 'N'
4452 ,x_batch_identifier => old_qual_rec.batch_identifier
4453 ,x_mode => 'R'
4454 ,x_gce => old_qual_rec.gce
4455 ,x_vce => old_qual_rec.vce
4456 ,x_sqa => old_qual_rec.sqa
4457 ,x_previousas => old_qual_rec.previousas
4458 ,x_keyskills => old_qual_rec.keyskills
4459 ,x_vocational => old_qual_rec.vocational
4460 ,x_scn => old_qual_rec.scn
4461 ,x_PrevOEQ => old_qual_rec.PrevOEQ
4462 ,x_choices_transparent_ind => old_qual_rec.choices_transparent_ind
4463 ,x_extra_status => old_qual_rec.extra_status
4464 ,x_extra_passport_no => old_qual_rec.extra_passport_no
4465 ,x_request_app_dets_ind => old_qual_rec.request_app_dets_ind
4466 ,x_request_copy_app_frm_ind => old_qual_rec.request_copy_app_frm_ind
4467 ,x_cef_no => old_qual_rec.cef_no
4468 ,x_system_code => old_qual_rec.system_code
4469 ,x_gcse_eng => old_qual_rec.gcse_eng
4470 ,x_gcse_math => old_qual_rec.gcse_math
4471 ,x_degree_subject => old_qual_rec.degree_subject
4472 ,x_degree_status => old_qual_rec.degree_status
4473 ,x_degree_class => old_qual_rec.degree_class
4474 ,x_gcse_sci => old_qual_rec.gcse_sci
4475 ,x_welshspeaker => old_qual_rec.welshspeaker
4476 ,x_ni_number => old_qual_rec.ni_number
4477 ,x_earliest_start => old_qual_rec.earliest_start
4478 ,x_near_inst => old_qual_rec.near_inst
4479 ,x_pref_reg => old_qual_rec.pref_reg
4480 ,x_qual_eng => old_qual_rec.qual_eng
4481 ,x_qual_math => old_qual_rec.qual_math
4482 ,x_qual_sci => old_qual_rec.qual_sci
4483 ,x_main_qual => old_qual_rec.main_qual
4484 ,x_qual_5 => old_qual_rec.qual_5
4485 ,x_future_serv => old_qual_rec.future_serv
4486 ,x_future_set => old_qual_rec.future_set
4487 ,x_present_serv => old_qual_rec.present_serv
4488 ,x_present_set => old_qual_rec.present_set
4489 ,x_curr_employment => old_qual_rec.curr_employment
4490 ,x_edu_qualification => old_qual_rec.edu_qualification
4491 ,x_ad_batch_id => old_qual_rec.ad_batch_id
4492 ,x_ad_interface_id => old_qual_rec.ad_interface_id
4493 ,x_nationality => old_qual_rec.nationality
4494 ,x_dual_nationality => old_qual_rec.dual_nationality
4495 ,x_special_needs => old_qual_rec.special_needs
4496 ,x_country_birth => old_qual_rec.country_birth
4497 );
4498
4499 EXCEPTION
4500 WHEN OTHERS THEN
4501 g_error_code := '9998';
4502 fnd_file.put_line(fnd_file.log, SQLERRM);
4503
4504 END;
4505
4506 END IF; -- main processing
4507
4508 EXCEPTION
4509 WHEN OTHERS THEN
4510 -- catch any unhandled/unexpected errors while processing a record.
4511 -- This would enable processing to continue with subsequent records.
4512
4513 -- Close any Open cursors
4514 IF old_qual_cur%ISOPEN THEN
4515 CLOSE old_qual_cur;
4516 END IF;
4517
4518 g_error_code := '1055';
4519 fnd_file.put_line(fnd_file.log, SQLERRM);
4520
4521 END;
4522
4523 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
4524 -- while processing the record.
4525 IF g_error_code IS NOT NULL THEN
4526
4527 UPDATE igs_uc_iqual_ints
4528 SET error_code = g_error_code
4529 WHERE rowid = new_ivqual_rec.rowid;
4530
4531 -- log error message/meaning.
4532 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
4533
4534 -- update error count
4535 g_error_rec_cnt := g_error_rec_cnt + 1;
4536
4537 ELSE
4538
4539 UPDATE igs_uc_iqual_ints
4540 SET record_status = 'D',
4541 error_code = NULL
4542 WHERE rowid = new_ivqual_rec.rowid;
4543
4544 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
4545 END IF;
4546
4547 END LOOP;
4548
4549 COMMIT;
4550 -- log processing complete for this view
4551 igs_uc_proc_ucas_data.log_proc_complete('IVQUALIFICATION', g_success_rec_cnt, g_error_rec_cnt);
4552
4553 EXCEPTION
4554 WHEN OTHERS THEN
4555 ROLLBACK;
4556 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
4557 fnd_message.set_token('VIEW', 'IVQUALIFICATION'||' - '||SQLERRM);
4558 fnd_file.put_line(fnd_file.log, fnd_message.get);
4559 END process_ivqualification;
4560
4561
4562
4563
4564 PROCEDURE process_ivstatement IS
4565 /******************************************************************
4566 Created By : rgangara
4567 Date Created By : 12-JUNE-2003
4568 Purpose : For processing IVSTATEMENT i.e. Applicant
4569 statement info. details from UCAS. This data
4570 has to be updated only when the existing
4571 personal statement is NULL.
4572 Known limitations,enhancements,remarks:
4573 Change History
4574 Who When What
4575 ******************************************************************/
4576
4577 CURSOR new_ivstmnt_cur IS
4578 SELECT ivstmt.rowid,
4579 ivstmt.*
4580 FROM igs_uc_istmnt_ints ivstmt
4581 WHERE ivstmt.record_status = 'N';
4582
4583
4584 CURSOR old_stmt_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
4585 SELECT ucap.rowid,
4586 ucap.*
4587 FROM igs_uc_applicants ucap
4588 WHERE ucap.app_no = p_appno;
4589
4590 old_stmt_rec old_stmt_cur%ROWTYPE;
4591
4592 BEGIN
4593
4594 -- initialize variables
4595 g_success_rec_cnt := 0;
4596 g_error_rec_cnt := 0;
4597 g_error_code := NULL;
4598
4599 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
4600 fnd_message.set_token('VIEW', 'IVSTATEMENT ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
4601 fnd_file.put_line(fnd_file.log, fnd_message.get);
4602
4603 -- Get all the reocords from interface table with status = 'N'
4604 FOR new_ivstmt_rec IN new_ivstmnt_cur
4605 LOOP
4606
4607 BEGIN
4608
4609 -- initialize record level variables.
4610 g_error_code := NULL;
4611 old_stmt_rec := NULL;
4612
4613 -- log Application processing message.
4614 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
4615 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstmt_rec.appno));
4616 fnd_file.put_line(fnd_file.log, fnd_message.get);
4617
4618
4619 -- mandatory field validations as this is an update
4620 IF new_ivstmt_rec.appno IS NULL THEN
4621 g_error_code := '1037';
4622 END IF;
4623
4624
4625 IF g_error_code IS NULL THEN
4626 ----------------------------
4627 -- AppNo validation
4628 ----------------------------
4629 -- validate Applicant record details in UCAS Applicants table.
4630 -- This is because record gets inserted into igs_uc_app_choices as part of
4631 -- IVSTARN processing and hence at this stage the record must exist.
4632 validate_applicant (new_ivstmt_rec.appno, g_error_code);
4633
4634 END IF;
4635
4636
4637 ----------------------------
4638 -- MAIN PROCESSING Begins
4639 ----------------------------
4640 IF g_error_code IS NULL THEN
4641
4642 -- Corresponding Application record would exist at this point
4643 -- otherwise the earlier validaton for error 1000 would have failed.
4644 OPEN old_stmt_cur(new_ivstmt_rec.appno);
4645 FETCH old_stmt_cur INTO old_stmt_rec;
4646 CLOSE old_stmt_cur;
4647
4648 -------------------------------------------------------
4649 -- Check whether the existing personal statement is NULL
4650 -- Update the record only if the existing value is NULL
4651 -- else ignore the record and just update the status to 'D'.
4652 -------------------------------------------------------
4653
4654 IF old_stmt_rec.personal_statement IS NULL AND new_ivstmt_rec.statement IS NOT NULL THEN
4655
4656 -- update the statement as the existing value is null
4657 BEGIN
4658 igs_uc_applicants_pkg.update_row -- IGSXI01B.pls
4659 (
4660 x_rowid => old_stmt_rec.rowid
4661 ,x_app_id => old_stmt_rec.app_id
4662 ,x_app_no => old_stmt_rec.app_no
4663 ,x_check_digit => old_stmt_rec.check_digit
4664 ,x_personal_id => old_stmt_rec.personal_id
4665 ,x_enquiry_no => old_stmt_rec.enquiry_no
4666 ,x_oss_person_id => old_stmt_rec.oss_person_id
4667 ,x_application_source => old_stmt_rec.application_source
4668 ,x_name_change_date => old_stmt_rec.name_change_date
4669 ,x_student_support => old_stmt_rec.student_support
4670 ,x_address_area => old_stmt_rec.address_area
4671 ,x_application_date => old_stmt_rec.application_date
4672 ,x_application_sent_date => old_stmt_rec.application_sent_date
4673 ,x_application_sent_run => old_stmt_rec.application_sent_run
4674 ,x_lea_code => NULL -- obsoleted by UCAS
4675 ,x_fee_payer_code => old_stmt_rec.fee_payer_code
4676 ,x_fee_text => old_stmt_rec.fee_text
4677 ,x_domicile_apr => old_stmt_rec.domicile_apr
4678 ,x_code_changed_date => old_stmt_rec.code_changed_date
4679 ,x_school => old_stmt_rec.school
4680 ,x_withdrawn => old_stmt_rec.withdrawn
4681 ,x_withdrawn_date => old_stmt_rec.withdrawn_date
4682 ,x_rel_to_clear_reason => old_stmt_rec.rel_to_clear_reason
4683 ,x_route_b => old_stmt_rec.route_b
4684 ,x_exam_change_date => old_stmt_rec.exam_change_date
4685 ,x_a_levels => NULL -- obsoleted by UCAS
4686 ,x_as_levels => NULL -- obsoleted by UCAS
4687 ,x_highers => NULL -- obsoleted by UCAS
4688 ,x_csys => NULL -- obsoleted by UCAS
4689 ,x_winter => old_stmt_rec.winter
4690 ,x_previous => old_stmt_rec.previous
4691 ,x_gnvq => NULL -- obsoleted by UCAS
4692 ,x_btec => old_stmt_rec.btec
4693 ,x_ilc => old_stmt_rec.ilc
4694 ,x_ailc => old_stmt_rec.ailc
4695 ,x_ib => old_stmt_rec.ib
4696 ,x_manual => old_stmt_rec.manual
4697 ,x_reg_num => old_stmt_rec.reg_num
4698 ,x_oeq => old_stmt_rec.oeq
4699 ,x_eas => old_stmt_rec.eas
4700 ,x_roa => old_stmt_rec.roa
4701 ,x_status => old_stmt_rec.status
4702 ,x_firm_now => old_stmt_rec.firm_now
4703 ,x_firm_reply => old_stmt_rec.firm_reply
4704 ,x_insurance_reply => old_stmt_rec.insurance_reply
4705 ,x_conf_hist_firm_reply => old_stmt_rec.conf_hist_firm_reply
4706 ,x_conf_hist_ins_reply => old_stmt_rec.conf_hist_ins_reply
4707 ,x_residential_category => old_stmt_rec.residential_category
4708 ,x_personal_statement => new_ivstmt_rec.statement
4709 ,x_match_prev => old_stmt_rec.match_prev
4710 ,x_match_prev_date => old_stmt_rec.match_prev_date
4711 ,x_match_winter => old_stmt_rec.match_winter
4712 ,x_match_summer => old_stmt_rec.match_summer
4713 ,x_gnvq_date => old_stmt_rec.gnvq_date
4714 ,x_ib_date => old_stmt_rec.ib_date
4715 ,x_ilc_date => old_stmt_rec.ilc_date
4716 ,x_ailc_date => old_stmt_rec.ailc_date
4717 ,x_gcseqa_date => old_stmt_rec.gcseqa_date
4718 ,x_uk_entry_date => old_stmt_rec.uk_entry_date
4719 ,x_prev_surname => old_stmt_rec.prev_surname
4720 ,x_criminal_convictions => old_stmt_rec.criminal_convictions
4721 ,x_sent_to_hesa => old_stmt_rec.sent_to_hesa
4722 ,x_sent_to_oss => old_stmt_rec.sent_to_oss
4723 ,x_batch_identifier => old_stmt_rec.batch_identifier
4724 ,x_mode => 'R'
4725 ,x_gce => old_stmt_rec.gce
4726 ,x_vce => old_stmt_rec.vce
4727 ,x_sqa => old_stmt_rec.sqa
4728 ,x_previousas => old_stmt_rec.previousas
4729 ,x_keyskills => old_stmt_rec.keyskills
4730 ,x_vocational => old_stmt_rec.vocational
4731 ,x_scn => old_stmt_rec.scn
4732 ,x_PrevOEQ => old_stmt_rec.PrevOEQ
4733 ,x_choices_transparent_ind => old_stmt_rec.choices_transparent_ind
4734 ,x_extra_status => old_stmt_rec.extra_status
4735 ,x_extra_passport_no => old_stmt_rec.extra_passport_no
4736 ,x_request_app_dets_ind => old_stmt_rec.request_app_dets_ind
4737 ,x_request_copy_app_frm_ind => old_stmt_rec.request_copy_app_frm_ind
4738 ,x_cef_no => old_stmt_rec.cef_no
4739 ,x_system_code => old_stmt_rec.system_code
4740 ,x_gcse_eng => old_stmt_rec.gcse_eng
4741 ,x_gcse_math => old_stmt_rec.gcse_math
4742 ,x_degree_subject => old_stmt_rec.degree_subject
4743 ,x_degree_status => old_stmt_rec.degree_status
4744 ,x_degree_class => old_stmt_rec.degree_class
4745 ,x_gcse_sci => old_stmt_rec.gcse_sci
4746 ,x_welshspeaker => old_stmt_rec.welshspeaker
4747 ,x_ni_number => old_stmt_rec.ni_number
4748 ,x_earliest_start => old_stmt_rec.earliest_start
4749 ,x_near_inst => old_stmt_rec.near_inst
4750 ,x_pref_reg => old_stmt_rec.pref_reg
4751 ,x_qual_eng => old_stmt_rec.qual_eng
4752 ,x_qual_math => old_stmt_rec.qual_math
4753 ,x_qual_sci => old_stmt_rec.qual_sci
4754 ,x_main_qual => old_stmt_rec.main_qual
4755 ,x_qual_5 => old_stmt_rec.qual_5
4756 ,x_future_serv => old_stmt_rec.future_serv
4757 ,x_future_set => old_stmt_rec.future_set
4758 ,x_present_serv => old_stmt_rec.present_serv
4759 ,x_present_set => old_stmt_rec.present_set
4760 ,x_curr_employment => old_stmt_rec.curr_employment
4761 ,x_edu_qualification => old_stmt_rec.edu_qualification
4762 ,x_ad_batch_id => old_stmt_rec.ad_batch_id
4763 ,x_ad_interface_id => old_stmt_rec.ad_interface_id
4764 ,x_nationality => old_stmt_rec.nationality
4765 ,x_dual_nationality => old_stmt_rec.dual_nationality
4766 ,x_special_needs => old_stmt_rec.special_needs
4767 ,x_country_birth => old_stmt_rec.country_birth
4768 );
4769
4770 EXCEPTION
4771 WHEN OTHERS THEN
4772 g_error_code := '9998';
4773 fnd_file.put_line(fnd_file.log, SQLERRM);
4774 END;
4775
4776 END IF; -- only update and no insert.
4777
4778 END IF; -- main processing
4779
4780 EXCEPTION
4781 WHEN OTHERS THEN
4782 -- catch any unhandled/unexpected errors while processing a record.
4783 -- This would enable processing to continue with subsequent records.
4784
4785 -- Close any Open cursors
4786 IF old_stmt_cur%ISOPEN THEN
4787 CLOSE old_stmt_cur;
4788 END IF;
4789
4790 g_error_code := '1055';
4791 fnd_file.put_line(fnd_file.log, SQLERRM);
4792 END;
4793
4794 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
4795 -- while processing the record.
4796 IF g_error_code IS NOT NULL THEN
4797
4798 UPDATE igs_uc_istmnt_ints
4799 SET error_code = g_error_code
4800 WHERE rowid = new_ivstmt_rec.rowid;
4801
4802 -- log error message/meaning.
4803 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
4804
4805 -- update error count
4806 g_error_rec_cnt := g_error_rec_cnt + 1;
4807
4808 ELSE
4809
4810 UPDATE igs_uc_istmnt_ints
4811 SET record_status = 'D',
4812 error_code = NULL
4813 WHERE rowid = new_ivstmt_rec.rowid;
4814
4815 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
4816 END IF;
4817
4818 END LOOP;
4819
4820 COMMIT;
4821 -- log processing complete for this view
4822 igs_uc_proc_ucas_data.log_proc_complete('IVSTATEMENT', g_success_rec_cnt, g_error_rec_cnt);
4823
4824 EXCEPTION
4825 WHEN OTHERS THEN
4826 ROLLBACK;
4827 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
4828 fnd_message.set_token('VIEW', 'IVSTATEMENT'||' - '||SQLERRM);
4829 fnd_file.put_line(fnd_file.log, fnd_message.get);
4830 END process_ivstatement;
4831
4832
4833
4834
4835 PROCEDURE process_ivoffer IS
4836 /******************************************************************
4837 Created By : rgangara
4838 Date Created By : 12-JUNE-2003
4839 Purpose : For processing ivoffer info. details from UCAS.
4840 Known limitations,enhancements,remarks:
4841 Change History
4842 Who When What
4843 ******************************************************************/
4844
4845 CURSOR new_ivoffer_cur IS
4846 SELECT ivoff.rowid,
4847 ivoff.*
4848 FROM igs_uc_ioffer_ints ivoff
4849 WHERE record_status = 'N';
4850
4851
4852 CURSOR old_offer_cur (p_appno igs_uc_app_choices.app_no%TYPE,
4853 p_choiceno igs_uc_app_choices.choice_no%TYPE,
4854 p_cycle igs_uc_app_choices.ucas_cycle%TYPE) IS
4855 SELECT appl.rowid,
4856 appl.*
4857 FROM igs_uc_app_choices appl
4858 WHERE appl.app_no = p_appno
4859 AND appl.choice_no = p_choiceno
4860 AND appl.ucas_cycle = p_cycle;
4861
4862 old_offer_rec old_offer_cur%ROWTYPE ; -- Holds the existing values for this incoming record.
4863 l_app_choice_id igs_uc_app_choices.app_choice_id%TYPE; -- Place holder for App CHoice ID - Seq gen value.
4864
4865 BEGIN
4866
4867 -- initialize variables
4868 g_success_rec_cnt := 0;
4869 g_error_rec_cnt := 0;
4870 g_error_code := NULL;
4871
4872 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
4873 fnd_message.set_token('VIEW', 'IVOFFER ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
4874 fnd_file.put_line(fnd_file.log, fnd_message.get);
4875
4876 -- Get all the reocords from interface table with status = 'N'
4877 FOR new_ivoffer_rec IN new_ivoffer_cur
4878 LOOP
4879
4880 BEGIN
4881 -- initialize record level variables.
4882 g_error_code := NULL;
4883 old_offer_rec := NULL;
4884 l_app_choice_id := NULL;
4885
4886 -- log Application Choice processing message.
4887 fnd_message.set_name('IGS','IGS_UC_APPNO_CHOICE_PROC');
4888 fnd_message.set_token('APPNO', TO_CHAR(new_ivoffer_rec.appno));
4889 fnd_message.set_token('CHOICE',TO_CHAR(new_ivoffer_rec.choiceno));
4890 fnd_file.put_line(fnd_file.log, fnd_message.get);
4891
4892
4893 -- no mandatory field validations as this is an update
4894 IF new_ivoffer_rec.appno IS NULL OR new_ivoffer_rec.choiceno IS NULL OR
4895 new_ivoffer_rec.ucas_cycle IS NULL THEN
4896
4897 g_error_code := '1037';
4898 END IF;
4899
4900
4901 -- AppNo validation
4902 IF g_error_code IS NULL THEN
4903
4904 -- validate Applicant record details in UCAS Applicants table.
4905 -- This is because record gets inserted into igs_uc_app_choices as part of
4906 -- IVSTARN processing and hence at this stage the record must exist.
4907 validate_applicant (new_ivoffer_rec.appno, g_error_code);
4908 END IF;
4909
4910
4911
4912 ----------------------------
4913 -- MAIN PROCESSING Begins
4914 ----------------------------
4915 IF g_error_code IS NULL THEN
4916
4917 -- Check wether corresponding record already exists.
4918 -- If exists , update the records otherwise insert a new record.
4919 OPEN old_offer_cur(new_ivoffer_rec.appno, new_ivoffer_rec.choiceno, new_ivoffer_rec.ucas_cycle);
4920 FETCH old_offer_cur INTO old_offer_rec;
4921 CLOSE old_offer_cur;
4922
4923 IF old_offer_rec.rowid IS NULL THEN
4924 g_error_code := '1046';
4925
4926 ELSE /* Update the record */
4927
4928 BEGIN
4929 -- call the TBH to update the record
4930 igs_uc_app_choices_pkg.update_row -- IGSXI02B.pls
4931 (
4932 x_rowid => old_offer_rec.rowid
4933 ,x_app_choice_id => old_offer_rec.app_choice_id
4934 ,x_app_id => old_offer_rec.app_id
4935 ,x_app_no => old_offer_rec.app_no
4936 ,x_choice_no => old_offer_rec.choice_no
4937 ,x_last_change => old_offer_rec.last_change
4938 ,x_institute_code => old_offer_rec.institute_code
4939 ,x_ucas_program_code => old_offer_rec.ucas_program_code
4940 ,x_oss_program_code => old_offer_rec.oss_program_code
4941 ,x_oss_program_version => old_offer_rec.oss_program_version
4942 ,x_oss_attendance_type => old_offer_rec.oss_attendance_type
4943 ,x_oss_attendance_mode => old_offer_rec.oss_attendance_mode
4944 ,x_campus => old_offer_rec.campus
4945 ,x_oss_location => old_offer_rec.oss_location
4946 ,x_faculty => old_offer_rec.faculty
4947 ,x_entry_year => old_offer_rec.entry_year
4948 ,x_entry_month => old_offer_rec.entry_month
4949 ,x_point_of_entry => old_offer_rec.point_of_entry
4950 ,x_home => old_offer_rec.home
4951 ,x_deferred => old_offer_rec.deferred
4952 ,x_route_b_pref_round => old_offer_rec.route_b_pref_round
4953 ,x_route_b_actual_round => old_offer_rec.route_b_actual_round
4954 ,x_condition_category => old_offer_rec.condition_category
4955 ,x_condition_code => old_offer_rec.condition_code
4956 ,x_decision => old_offer_rec.decision
4957 ,x_decision_date => old_offer_rec.decision_date
4958 ,x_decision_number => old_offer_rec.decision_number
4959 ,x_reply => old_offer_rec.reply
4960 ,x_summary_of_cond => old_offer_rec.summary_of_cond
4961 ,x_choice_cancelled => old_offer_rec.choice_cancelled
4962 ,x_action => old_offer_rec.action
4963 ,x_substitution => old_offer_rec.substitution
4964 ,x_date_substituted => old_offer_rec.date_substituted
4965 ,x_prev_institution => old_offer_rec.prev_institution
4966 ,x_prev_course => old_offer_rec.prev_course
4967 ,x_prev_campus => old_offer_rec.prev_campus
4968 ,x_ucas_amendment => old_offer_rec.ucas_amendment
4969 ,x_withdrawal_reason => old_offer_rec.withdrawal_reason
4970 ,x_offer_course => new_ivoffer_rec.offercourse
4971 ,x_offer_campus => new_ivoffer_rec.offercampus
4972 ,x_offer_crse_length => new_ivoffer_rec.offercourselength
4973 ,x_offer_entry_month => new_ivoffer_rec. offerentrymonth
4974 ,x_offer_entry_year => new_ivoffer_rec.offerentryyear
4975 ,x_offer_entry_point => new_ivoffer_rec.offerentrypoint
4976 ,x_offer_text => new_ivoffer_rec.offertext
4977 ,x_mode => 'R'
4978 ,x_export_to_oss_status => old_offer_rec.export_to_oss_status
4979 ,x_error_code => old_offer_rec.error_code
4980 ,x_request_id => old_offer_rec.request_id
4981 ,x_batch_id => old_offer_rec.batch_id
4982 ,x_extra_round_nbr => old_offer_rec.extra_round_nbr
4983 ,x_system_code => old_offer_rec.system_code
4984 ,x_part_time => old_offer_rec.part_time
4985 ,x_interview => old_offer_rec.interview
4986 ,x_late_application => old_offer_rec.late_application
4987 ,x_modular => old_offer_rec.modular
4988 ,x_residential => old_offer_rec.residential
4989 ,x_ucas_cycle => old_offer_rec.ucas_cycle
4990 );
4991
4992 EXCEPTION
4993 WHEN OTHERS THEN
4994 g_error_code := '9998';
4995 fnd_file.put_line(fnd_file.log, SQLERRM);
4996
4997 END;
4998
4999 END IF; -- insert / update
5000
5001 END IF; -- main processing
5002
5003
5004 EXCEPTION
5005 WHEN OTHERS THEN
5006 -- catch any unhandled/unexpected errors while processing a record.
5007 -- This would enable processing to continue with subsequent records.
5008
5009 -- Close any Open cursors
5010 IF old_offer_cur%ISOPEN THEN
5011 CLOSE old_offer_cur;
5012 END IF;
5013
5014 g_error_code := '1055';
5015 fnd_file.put_line(fnd_file.log, SQLERRM);
5016 END;
5017
5018 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
5019 -- while processing the record.
5020 IF g_error_code IS NOT NULL THEN
5021
5022 UPDATE igs_uc_ioffer_ints
5023 SET error_code = g_error_code
5024 WHERE rowid = new_ivoffer_rec.rowid;
5025
5026 -- log error message/meaning.
5027 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
5028
5029 -- update error count
5030 g_error_rec_cnt := g_error_rec_cnt + 1;
5031
5032 ELSE
5033
5034 UPDATE igs_uc_ioffer_ints
5035 SET record_status = 'D',
5036 error_code = NULL
5037 WHERE rowid = new_ivoffer_rec.rowid;
5038
5039 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
5040 END IF;
5041
5042 END LOOP;
5043
5044 COMMIT;
5045 -- log processing complete for this view
5046 igs_uc_proc_ucas_data.log_proc_complete('IVOFFER', g_success_rec_cnt, g_error_rec_cnt);
5047
5048 EXCEPTION
5049 WHEN OTHERS THEN
5050 ROLLBACK;
5051 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
5052 fnd_message.set_token('VIEW', 'IVOFFER'||' - '||SQLERRM);
5053 fnd_file.put_line(fnd_file.log, fnd_message.get);
5054 END process_ivoffer;
5055
5056
5057
5058 PROCEDURE process_ivstarx IS
5059 /******************************************************************
5060 Created By : rgangara
5061 Date Created By : 12-JUNE-2003
5062 Purpose : For processing ivstarx i.e. Applicant
5063 other details from UCAS.
5064 Known limitations,enhancements,remarks:
5065 Change History
5066 Who When What
5067 jbaber 17-Oct-05 Modified social class validation to use
5068 cvRefSocialClass as cvRefPre200POOC has been obsoleted
5069 ******************************************************************/
5070
5071 CURSOR new_ivstarx_cur IS
5072 SELECT ivstx.rowid,
5073 ivstx.*
5074 FROM igs_uc_istarx_ints ivstx
5075 WHERE ivstx.record_status = 'N';
5076
5077 -- check for corresponding record in main table.
5078 CURSOR old_starx_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
5079 SELECT uast.rowid,
5080 uast.*
5081 FROM igs_uc_app_stats uast
5082 WHERE uast.app_no = p_appno;
5083
5084 -- validate ethnic value
5085 CURSOR validate_ethnic (p_ethnic igs_uc_istarx_ints.ethnic%TYPE) IS
5086 SELECT 'X'
5087 FROM igs_uc_ref_codes
5088 WHERE code_type = 'ET'
5089 and code = p_ethnic;
5090
5091 -- validate Socialclass value
5092 CURSOR validate_socialclass (p_socialclass igs_uc_istarx_ints.socialclass%TYPE) IS
5093 SELECT 'X'
5094 FROM igs_uc_ref_codes
5095 WHERE code_type = 'PC'
5096 AND code = p_socialclass;
5097
5098 -- get the system and app_id to be populated into App Choices
5099 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
5100 SELECT app_id,
5101 system_code
5102 FROM igs_uc_applicants
5103 WHERE app_no = p_appno;
5104
5105 appl_det_rec get_appl_dets%ROWTYPE;
5106 old_starx_rec old_starx_cur%ROWTYPE;
5107 l_valid VARCHAR2(1);
5108
5109 BEGIN
5110
5111 -- initialize variables
5112 g_success_rec_cnt := 0;
5113 g_error_rec_cnt := 0;
5114 g_error_code := NULL;
5115
5116 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
5117 fnd_message.set_token('VIEW', 'IVSTARX ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
5118 fnd_file.put_line(fnd_file.log, fnd_message.get);
5119
5120 -- Get all the reocords from interface table with status = 'N'
5121 FOR new_ivstarx_rec IN new_ivstarx_cur
5122 LOOP
5123
5124 BEGIN
5125 -- initialize record level variables.
5126 g_error_code := NULL;
5127 old_starx_rec := NULL;
5128 l_valid := NULL;
5129
5130 -- log record processing info.
5131 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
5132 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstarx_rec.appno));
5133 fnd_file.put_line(fnd_file.log, fnd_message.get);
5134
5135
5136 -- no mandatory field validations as this is an update
5137 IF new_ivstarx_rec.appno IS NULL THEN
5138 g_error_code := '1037';
5139 END IF;
5140
5141
5142 ---------------------------------------
5143 -- validate ETHNIC value from UCAS
5144 ---------------------------------------
5145 IF g_error_code IS NULL THEN
5146
5147 l_valid := NULL;
5148 IF new_ivstarx_rec.ethnic IS NOT NULL THEN
5149
5150 OPEN validate_ethnic (new_ivstarx_rec.ethnic);
5151 FETCH validate_ethnic INTO l_valid;
5152 CLOSE validate_ethnic;
5153
5154 IF l_valid IS NULL THEN
5155 g_error_code := '1019';
5156 END IF;
5157
5158 END IF;
5159 END IF;
5160
5161
5162 ---------------------------------------
5163 -- validate SOCIALCLASS value from UCAS
5164 ---------------------------------------
5165 IF g_error_code IS NULL THEN
5166 l_valid := NULL; -- initialize again because it is being re-used.
5167
5168 IF new_ivstarx_rec.socialclass IS NOT NULL THEN
5169
5170 OPEN validate_socialclass (new_ivstarx_rec.socialclass);
5171 FETCH validate_socialclass INTO l_valid;
5172 CLOSE validate_socialclass;
5173
5174 IF l_valid IS NULL THEN
5175 g_error_code := '1020';
5176 END IF;
5177
5178 END IF;
5179 END IF;
5180
5181
5182 IF g_error_code IS NULL THEN
5183 ----------------------------
5184 -- AppNo validation
5185 ----------------------------
5186 -- validate Applicant record details in UCAS Applicants table.
5187 -- This is because record gets inserted into igs_uc_app_choices as part of
5188 -- IVSTARN processing and hence at this stage the record must exist.
5189 validate_applicant (new_ivstarx_rec.appno, g_error_code);
5190
5191 END IF;
5192
5193
5194
5195 ----------------------------
5196 -- MAIN PROCESSING Begins
5197 ----------------------------
5198 IF g_error_code IS NULL THEN
5199
5200 -- Check whether corresponding Application record already exists.
5201 -- If exists then update else insert.
5202 OPEN old_starx_cur(new_ivstarx_rec.appno);
5203 FETCH old_starx_cur INTO old_starx_rec;
5204 CLOSE old_starx_cur;
5205
5206 IF old_starx_rec.rowid IS NULL THEN -- i.e. new record.
5207
5208
5209 -- get application details - App ID which is needed while inserting a record.
5210 -- Record would always be found otherwise the above validation - Error 1000 would have failed.
5211 appl_det_rec := NULL; -- initialize
5212 OPEN get_appl_dets(new_ivstarx_rec.appno);
5213 FETCH get_appl_dets INTO appl_det_rec;
5214 CLOSE get_appl_dets;
5215
5216
5217 BEGIN
5218
5219 -- call the TBH to update the record
5220 igs_uc_app_stats_pkg.insert_row -- IGSXI07B.pls
5221 (
5222 x_rowid => old_starx_rec.rowid -- would be NULL since no existing rec found
5223 ,x_app_stat_id => old_starx_rec.app_stat_id -- since this will be NULL since no existing rec found.
5224 ,x_app_id => appl_det_rec.app_id
5225 ,x_app_no => new_ivstarx_rec.appno
5226 ,x_starh_ethnic => NULL
5227 ,x_starh_social_class => NULL
5228 ,x_starh_pocc_edu_chg_dt => NULL
5229 ,x_starh_pocc => NULL
5230 ,x_starh_pocc_text => NULL
5231 ,x_starh_last_edu_inst => NULL
5232 ,x_starh_edu_leave_date => NULL
5233 ,x_starh_lea => NULL
5234 ,x_starx_ethnic => new_ivstarx_rec.ethnic
5235 ,x_starx_pocc_edu_chg => new_ivstarx_rec.pocceduchangedate
5236 ,x_starx_pocc => new_ivstarx_rec.pocc
5237 ,x_starx_pocc_text => new_ivstarx_rec.pocctext
5238 ,x_sent_to_hesa => 'N'
5239 ,x_starx_socio_economic => new_ivstarx_rec.socioeconomic
5240 ,x_starx_occ_background => new_ivstarx_rec.occbackground
5241 ,x_starh_socio_economic => NULL
5242 ,x_mode => 'R'
5243 ,x_ivstarh_dependants => NULL
5244 ,x_ivstarh_married => NULL
5245 ,x_ivstarx_religion => new_ivstarx_rec.religion
5246 ,x_ivstarx_married => new_ivstarx_rec.married
5247 ,x_ivstarx_dependants => new_ivstarx_rec.dependants
5248 );
5249
5250 EXCEPTION
5251 WHEN OTHERS THEN
5252 g_error_code := '9999';
5253 fnd_file.put_line(fnd_file.log, SQLERRM);
5254 END;
5255
5256
5257 ELSE -- update
5258
5259 BEGIN
5260 -- call the TBH to update the record
5261 igs_uc_app_stats_pkg.update_row -- IGSXI07B.pls
5262 (
5263 x_rowid => old_starx_rec.rowid
5264 ,x_app_stat_id => old_starx_rec.app_stat_id
5265 ,x_app_id => old_starx_rec.app_id
5266 ,x_app_no => old_starx_rec.app_no
5267 ,x_starh_ethnic => old_starx_rec.starh_ethnic
5268 ,x_starh_social_class => old_starx_rec.starh_social_class
5269 ,x_starh_pocc_edu_chg_dt => old_starx_rec.starh_pocc_edu_chg_dt
5270 ,x_starh_pocc => old_starx_rec.starh_pocc
5271 ,x_starh_pocc_text => old_starx_rec.starh_pocc_text
5272 ,x_starh_last_edu_inst => old_starx_rec.starh_last_edu_inst
5273 ,x_starh_edu_leave_date => old_starx_rec.starh_edu_leave_date
5274 ,x_starh_lea => old_starx_rec.starh_lea
5275 ,x_starx_ethnic => new_ivstarx_rec.ethnic
5276 ,x_starx_pocc_edu_chg => new_ivstarx_rec.pocceduchangedate
5277 ,x_starx_pocc => new_ivstarx_rec.pocc
5278 ,x_starx_pocc_text => new_ivstarx_rec.pocctext
5279 ,x_sent_to_hesa => 'N'
5280 ,x_starx_socio_economic => new_ivstarx_rec.socioeconomic
5281 ,x_starx_occ_background => new_ivstarx_rec.occbackground
5282 ,x_starh_socio_economic => NULL
5283 ,x_mode => 'R'
5284 ,x_ivstarh_dependants => old_starx_rec.ivstarh_dependants
5285 ,x_ivstarh_married => old_starx_rec.ivstarh_married
5286 ,x_ivstarx_religion => new_ivstarx_rec.religion
5287 ,x_ivstarx_married => new_ivstarx_rec.married
5288 ,x_ivstarx_dependants => new_ivstarx_rec.dependants
5289 );
5290
5291 EXCEPTION
5292 WHEN OTHERS THEN
5293 g_error_code := '9998';
5294 fnd_file.put_line(fnd_file.log, SQLERRM);
5295 END;
5296
5297 END IF; -- insert / update
5298
5299 END IF; -- main processing
5300
5301 EXCEPTION
5302 WHEN OTHERS THEN
5303 -- catch any unhandled/unexpected errors while processing a record.
5304 -- This would enable processing to continue with subsequent records.
5305
5306 -- Close any Open cursors
5307 IF old_starx_cur%ISOPEN THEN
5308 CLOSE old_starx_cur;
5309 END IF;
5310
5311 IF validate_ethnic%ISOPEN THEN
5312 CLOSE validate_ethnic;
5313 END IF;
5314
5315 IF validate_socialclass%ISOPEN THEN
5316 CLOSE validate_socialclass;
5317 END IF;
5318
5319 IF get_appl_dets%ISOPEN THEN
5320 CLOSE get_appl_dets;
5321 END IF;
5322
5323 g_error_code := '1055';
5324 fnd_file.put_line(fnd_file.log, SQLERRM);
5325 END;
5326
5327 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
5328 -- while processing the record.
5329 IF g_error_code IS NOT NULL THEN
5330
5331 UPDATE igs_uc_istarx_ints
5332 SET error_code = g_error_code
5333 WHERE rowid = new_ivstarx_rec.rowid;
5334
5335 -- log error message/meaning.
5336 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
5337
5338 -- update error count
5339 g_error_rec_cnt := g_error_rec_cnt + 1;
5340
5341 ELSE
5342
5343 UPDATE igs_uc_istarx_ints
5344 SET record_status = 'D',
5345 error_code = NULL
5346 WHERE rowid = new_ivstarx_rec.rowid;
5347
5348 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
5349 END IF;
5350
5351 END LOOP;
5352
5353 COMMIT;
5354 -- log processing complete for this view
5355 igs_uc_proc_ucas_data.log_proc_complete('IVSTARX', g_success_rec_cnt, g_error_rec_cnt);
5356
5357 EXCEPTION
5358 WHEN OTHERS THEN
5359 ROLLBACK;
5360 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
5361 fnd_message.set_token('VIEW', 'IVSTARX'||' - '||SQLERRM);
5362 fnd_file.put_line(fnd_file.log, fnd_message.get);
5363 END process_ivstarx;
5364
5365
5366
5367 PROCEDURE process_ivstarh IS
5368 /******************************************************************
5369 Created By : rgangara
5370 Date Created By : 12-JUNE-2003
5371 Purpose : For processing ivstarh i.e. Applicant
5372 HESA details from UCAS.
5373 Known limitations,enhancements,remarks:
5374 Change History
5375 Who When What
5376 jbaber 17-Oct-05 Modified social class validation to use
5377 cvRefSocialClass as cvRefPre200POOC has been obsoleted
5378 ******************************************************************/
5379
5380 CURSOR new_ivstarh_cur IS
5381 SELECT ivsth.rowid,
5382 ivsth.*
5383 FROM igs_uc_istarh_ints ivsth
5384 WHERE ivsth.record_status = 'N';
5385
5386 -- check for corresponding record in main table.
5387 CURSOR old_starh_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
5388 SELECT uast.rowid,
5389 uast.*
5390 FROM igs_uc_app_stats uast
5391 WHERE uast.app_no = p_appno;
5392
5393 -- validate ethnic value
5394 CURSOR validate_ethnic (p_ethnic igs_uc_istarh_ints.ethnic%TYPE) IS
5395 SELECT 'X'
5396 FROM igs_uc_ref_codes
5397 WHERE code_type = 'ET'
5398 and code = p_ethnic;
5399
5400 -- validate Socialclass value
5401 CURSOR validate_socialclass (p_socialclass igs_uc_istarh_ints.socialclass%TYPE) IS
5402 SELECT 'X'
5403 FROM igs_uc_ref_codes
5404 WHERE code_type = 'PC'
5405 AND code = p_socialclass;
5406
5407 -- get the system and app_id to be populated into App Choices
5408 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
5409 SELECT app_id,
5410 system_code
5411 FROM igs_uc_applicants
5412 WHERE app_no = p_appno;
5413
5414 appl_det_rec get_appl_dets%ROWTYPE;
5415 old_starh_rec old_starh_cur%ROWTYPE;
5416 l_valid VARCHAR2(1);
5417 l_socialeconomic igs_uc_app_stats.starh_socio_economic%TYPE;
5418
5419
5420 BEGIN
5421
5422 -- initialize variables
5423 g_success_rec_cnt := 0;
5424 g_error_rec_cnt := 0;
5425 g_error_code := NULL;
5426
5427 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
5428 fnd_message.set_token('VIEW', 'IVSTARH ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
5429 fnd_file.put_line(fnd_file.log, fnd_message.get);
5430
5431 -- Get all the reocords from interface table with status = 'N'
5432 FOR new_ivstarh_rec IN new_ivstarh_cur
5433 LOOP
5434
5435 BEGIN
5436 -- initialize record level variables.
5437 g_error_code := NULL;
5438 old_starh_rec := NULL;
5439 l_valid := NULL;
5440
5441 -- log record processing info.
5442 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
5443 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstarh_rec.appno));
5444 fnd_file.put_line(fnd_file.log, fnd_message.get);
5445
5446
5447 -- no mandatory field validations as this is an update
5448 IF new_ivstarh_rec.appno IS NULL THEN
5449 g_error_code := '1037';
5450 END IF;
5451
5452
5453 ---------------------------------------
5454 -- validate ETHNIC value from UCAS
5455 ---------------------------------------
5456 IF g_error_code IS NULL THEN
5457 IF new_ivstarh_rec.ethnic IS NOT NULL THEN
5458 OPEN validate_ethnic (new_ivstarh_rec.ethnic);
5459 FETCH validate_ethnic INTO l_valid;
5460 CLOSE validate_ethnic;
5461
5462 IF l_valid IS NULL THEN
5463 g_error_code := '1019';
5464 END IF;
5465
5466 END IF;
5467 END IF;
5468
5469
5470 ---------------------------------------
5471 -- validate SOCIALCLASS value from UCAS
5472 ---------------------------------------
5473 IF g_error_code IS NULL THEN
5474 l_valid := NULL; -- initialize again because it is being re-used.
5475 IF new_ivstarh_rec.socialclass IS NOT NULL THEN
5476 OPEN validate_socialclass (new_ivstarh_rec.socialclass);
5477 FETCH validate_socialclass INTO l_valid;
5478 CLOSE validate_socialclass;
5479
5480 IF l_valid IS NULL THEN
5481 g_error_code := '1020';
5482 END IF;
5483
5484 END IF;
5485 END IF;
5486
5487
5488 IF g_error_code IS NULL THEN
5489 ----------------------------
5490 -- AppNo validation
5491 ----------------------------
5492 -- validate Applicant record details in UCAS Applicants table.
5493 -- This is because record gets inserted into igs_uc_app_choices as part of
5494 -- IVSTARN processing and hence at this stage the record must exist.
5495 validate_applicant (new_ivstarh_rec.appno, g_error_code);
5496
5497 END IF;
5498
5499
5500 -- Value coming from UCAS (also in INT table, the field is VARCHAR2. However, this field in main
5501 -- table is of NUMBER datatype. Hence validating that the incoming value is a Number and then populate.
5502 l_socialeconomic := NULL;
5503 IF (ASCII(new_ivstarh_rec.socialeconomic) >= 48 AND ASCII(new_ivstarh_rec.socialeconomic) <= 57) THEN
5504 l_socialeconomic := TO_NUMBER(new_ivstarh_rec.socialeconomic);
5505 END IF;
5506
5507
5508 ----------------------------
5509 -- MAIN PROCESSING Begins
5510 ----------------------------
5511 IF g_error_code IS NULL THEN
5512
5513 -- Check whether corresponding Application record already exists.
5514 -- If exists then update else insert.
5515 OPEN old_starh_cur(new_ivstarh_rec.appno);
5516 FETCH old_starh_cur INTO old_starh_rec;
5517 CLOSE old_starh_cur;
5518
5519 IF old_starh_rec.rowid IS NULL THEN -- i.e. new record.
5520
5521
5522 -- get application details - App ID which is needed while inserting a record.
5523 -- Record would always be found otherwise the above validation - Error 1000 would have failed.
5524 appl_det_rec := NULL; -- initialize
5525 OPEN get_appl_dets(new_ivstarh_rec.appno);
5526 FETCH get_appl_dets INTO appl_det_rec;
5527 CLOSE get_appl_dets;
5528
5529
5530 BEGIN
5531
5532 -- call the TBH to update the record
5533 igs_uc_app_stats_pkg.insert_row -- IGSXI07B.pls
5534 (
5535 x_rowid => old_starh_rec.rowid
5536 ,x_app_stat_id => old_starh_rec.app_stat_id -- can be used as this value will be NULL during insert as no rec exists.
5537 ,x_app_id => appl_det_rec.app_id
5538 ,x_app_no => new_ivstarh_rec.appno
5539 ,x_starh_ethnic => new_ivstarh_rec.ethnic
5540 ,x_starh_social_class => new_ivstarh_rec.socialclass
5541 ,x_starh_pocc_edu_chg_dt => new_ivstarh_rec.pocceduchangedate
5542 ,x_starh_pocc => new_ivstarh_rec.pocc
5543 ,x_starh_pocc_text => new_ivstarh_rec.pocctext
5544 ,x_starh_last_edu_inst => new_ivstarh_rec.lasteducation
5545 ,x_starh_edu_leave_date => new_ivstarh_rec.educationleavedate
5546 ,x_starh_lea => new_ivstarh_rec.lea
5547 ,x_starx_ethnic => NULL
5548 ,x_starx_pocc_edu_chg => NULL
5549 ,x_starx_pocc => NULL
5550 ,x_starx_pocc_text => NULL
5551 ,x_sent_to_hesa => 'N'
5552 ,x_starx_socio_economic => NULL
5553 ,x_starx_occ_background => NULL
5554 ,x_starh_socio_economic => l_socialeconomic
5555 ,x_mode => 'R'
5556 ,x_ivstarh_dependants => new_ivstarh_rec.dependants
5557 ,x_ivstarh_married => new_ivstarh_rec.married
5558 ,x_ivstarx_religion => NULL
5559 ,x_ivstarx_married => NULL
5560 ,x_ivstarx_dependants => NULL
5561 );
5562
5563 EXCEPTION
5564 WHEN OTHERS THEN
5565 g_error_code := '9999';
5566 fnd_file.put_line(fnd_file.log, SQLERRM);
5567 END;
5568
5569
5570 ELSE -- update
5571
5572 BEGIN
5573 -- call the TBH to update the record
5574 igs_uc_app_stats_pkg.update_row -- IGSXI07B.pls
5575 (
5576 x_rowid => old_starh_rec.rowid
5577 ,x_app_stat_id => old_starh_rec.app_stat_id
5578 ,x_app_id => old_starh_rec.app_id
5579 ,x_app_no => old_starh_rec.app_no
5580 ,x_starh_ethnic => new_ivstarh_rec.ethnic
5581 ,x_starh_social_class => new_ivstarh_rec.socialclass
5582 ,x_starh_pocc_edu_chg_dt => new_ivstarh_rec.pocceduchangedate
5583 ,x_starh_pocc => new_ivstarh_rec.pocc
5584 ,x_starh_pocc_text => new_ivstarh_rec.pocctext
5585 ,x_starh_last_edu_inst => new_ivstarh_rec.lasteducation
5586 ,x_starh_edu_leave_date => new_ivstarh_rec.educationleavedate
5587 ,x_starh_lea => new_ivstarh_rec.lea
5588 ,x_starx_ethnic => old_starh_rec.starx_ethnic
5589 ,x_starx_pocc_edu_chg => old_starh_rec.starx_pocc_edu_chg
5590 ,x_starx_pocc => old_starh_rec.starx_pocc
5591 ,x_starx_pocc_text => old_starh_rec.starx_pocc_text
5592 ,x_sent_to_hesa => 'N'
5593 ,x_starx_socio_economic => old_starh_rec.starx_socio_economic
5594 ,x_starx_occ_background => old_starh_rec.starx_occ_background
5595 ,x_starh_socio_economic => l_socialeconomic
5596 ,x_mode => 'R'
5597 ,x_ivstarh_dependants => new_ivstarh_rec.dependants
5598 ,x_ivstarh_married => new_ivstarh_rec.married
5599 ,x_ivstarx_religion => old_starh_rec.ivstarx_religion
5600 ,x_ivstarx_married => old_starh_rec.ivstarx_married
5601 ,x_ivstarx_dependants => old_starh_rec.ivstarx_dependants
5602 );
5603
5604 EXCEPTION
5605 WHEN OTHERS THEN
5606 g_error_code := '9998';
5607 fnd_file.put_line(fnd_file.log, SQLERRM);
5608 END;
5609
5610 END IF; -- insert / update
5611
5612 END IF; -- main processing
5613
5614 EXCEPTION
5615 WHEN OTHERS THEN
5616 -- catch any unhandled/unexpected errors while processing a record.
5617 -- This would enable processing to continue with subsequent records.
5618
5619 -- Close any Open cursors
5620 IF old_starh_cur%ISOPEN THEN
5621 CLOSE old_starh_cur;
5622 END IF;
5623
5624 IF validate_ethnic%ISOPEN THEN
5625 CLOSE validate_ethnic;
5626 END IF;
5627
5628 IF validate_socialclass%ISOPEN THEN
5629 CLOSE validate_socialclass;
5630 END IF;
5631
5632 IF get_appl_dets%ISOPEN THEN
5633 CLOSE get_appl_dets;
5634 END IF;
5635
5636 g_error_code := '1055';
5637 fnd_file.put_line(fnd_file.log, SQLERRM);
5638 END;
5639
5640 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
5641 -- while processing the record.
5642 IF g_error_code IS NOT NULL THEN
5643
5644 UPDATE igs_uc_istarh_ints
5645 SET error_code = g_error_code
5646 WHERE rowid = new_ivstarh_rec.rowid;
5647
5648 -- log error message/meaning.
5649 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
5650
5651 -- update error count
5652 g_error_rec_cnt := g_error_rec_cnt + 1;
5653
5654 ELSE
5655
5656 UPDATE igs_uc_istarh_ints
5657 SET record_status = 'D',
5658 error_code = NULL
5659 WHERE rowid = new_ivstarh_rec.rowid;
5660
5661 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
5662 END IF;
5663
5664 END LOOP;
5665
5666 COMMIT;
5667 -- log processing complete for this view
5668 igs_uc_proc_ucas_data.log_proc_complete('IVSTARH', g_success_rec_cnt, g_error_rec_cnt);
5669
5670 EXCEPTION
5671 WHEN OTHERS THEN
5672 ROLLBACK;
5673 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
5674 fnd_message.set_token('VIEW', 'IVSTARH'||' - '||SQLERRM);
5675 fnd_file.put_line(fnd_file.log, fnd_message.get);
5676 END process_ivstarh;
5677
5678
5679
5680
5681 PROCEDURE process_ivstarz1 IS
5682 /******************************************************************
5683 Created By : rgangara
5684 Date Created By : 12-JUNE-2003
5685 Purpose : For processing ivstarz1 i.e. Applicant
5686 Clearing info. details from UCAS.
5687 Known limitations,enhancements,remarks:
5688 Change History
5689 Who When What
5690 arvsrini 04-MAR-04 Added code to use IGS_UC_ISTARZ1_INTS record to update Choice Number 9 record in IGS_UC_APP_CHOICES when the
5691 IGS_UC_ISTARZ1_INTS.INST = Current Institution Code defined in UCAS Setup.
5692 modified wrt UCCR008 build. Bug#3239860
5693 anwest 29-MAY-06 Bug #5190520 UCTD320 - UCAS 2006 CLEARING ISSUES
5694 anwest 02-AUG-06 Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5695
5696 ******************************************************************/
5697
5698 CURSOR new_ivstarz1_cur IS
5699 SELECT ivstz1.rowid,
5700 ivstz1.*
5701 FROM igs_uc_istarz1_ints ivstz1
5702 WHERE ivstz1.record_status = 'N';
5703
5704 -- check for corresponding record in main table.
5705 CURSOR old_starz1_cur(p_appno igs_uc_app_clearing.app_no%TYPE) IS
5706 SELECT uacl.rowid,
5707 uacl.*
5708 FROM igs_uc_app_clearing uacl
5709 WHERE uacl.app_no = p_appno;
5710
5711 -- validate Institution value
5712 CURSOR validate_inst (p_inst igs_uc_app_clearing.institution%TYPE) IS
5713 SELECT ucas, gttr, nmas, swas
5714 FROM igs_uc_com_inst
5715 WHERE inst = p_inst;
5716
5717 -- validate Course value
5718 CURSOR validate_Course (p_course igs_uc_istarz1_ints.course%TYPE,
5719 p_campus igs_uc_istarz1_ints.campus%TYPE,
5720 p_inst igs_uc_istarz1_ints.inst%TYPE,
5721 p_system igs_uc_crse_dets.system_code%TYPE) IS
5722 SELECT 'X'
5723 FROM igs_uc_crse_dets
5724 WHERE ucas_program_code = p_course
5725 AND institute = p_inst
5726 AND ucas_campus = p_campus
5727 AND system_code = p_system;
5728
5729
5730 -- get the system and app_id to be populated into App Choices
5731 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
5732 SELECT app_id,
5733 system_code
5734 FROM igs_uc_applicants
5735 WHERE app_no = p_appno;
5736
5737
5738
5739 CURSOR curr_inst_cur(p_sys_code igs_uc_defaults.system_code%type) IS
5740 SELECT current_inst_code
5741 FROM igs_uc_defaults
5742 WHERE system_code = p_sys_code;
5743
5744 -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5745 CURSOR uc_app_choices_cur(p_appno igs_uc_app_choices.app_no%TYPE) IS
5746 SELECT uacc.rowid,
5747 uacc.*
5748 FROM igs_uc_app_choices uacc
5749 WHERE uacc.app_no = p_appno
5750 AND uacc.choice_no = 9;
5751
5752
5753 -- Cursor to get the OSS Program details for the UCAS course from Course details table.
5754 CURSOR get_oss_prog_cur (p_course igs_uc_crse_dets.ucas_program_code%TYPE,
5755 p_campus igs_uc_crse_dets.ucas_campus%TYPE,
5756 p_inst igs_uc_crse_dets.institute%TYPE,
5757 p_system igs_uc_crse_dets.system_code%TYPE) IS
5758 SELECT oss_program_code,
5759 oss_program_version,
5760 oss_location,
5761 oss_attendance_mode,
5762 oss_attendance_type
5763 FROM igs_uc_crse_dets
5764 WHERE System_Code = p_system
5765 AND ucas_program_code = p_course
5766 AND ucas_campus = p_campus
5767 AND Institute = p_inst;
5768
5769
5770
5771
5772 validate_inst_rec validate_inst%ROWTYPE;
5773 appl_det_rec get_appl_dets%ROWTYPE;
5774 old_starz1_rec old_starz1_cur%ROWTYPE;
5775 l_valid VARCHAR2(1);
5776
5777 uc_app_choices_rec uc_app_choices_cur%ROWTYPE; --arvsrini UCCR008
5778 oss_prog_rec get_oss_prog_cur%ROWTYPE; -- Holds OSS Program details for the UCAS Course.
5779 curr_inst_rec curr_inst_cur%ROWTYPE;
5780
5781 l_oss_program_code igs_uc_app_choices.oss_program_code%TYPE;
5782 l_oss_program_version igs_uc_app_choices.oss_program_version%TYPE;
5783 l_oss_attendance_type igs_uc_app_choices.oss_attendance_type%TYPE;
5784 l_oss_attendance_mode igs_uc_app_choices.oss_attendance_mode%TYPE;
5785 l_oss_location igs_uc_app_choices.oss_location%TYPE;
5786 l_decision igs_uc_app_choices.decision%TYPE;
5787 l_reply igs_uc_app_choices.reply%TYPE;
5788
5789 -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5790 l_campus_clr igs_uc_app_clearing.campus%TYPE;
5791 l_campus_chc igs_uc_app_choices.campus%TYPE;
5792
5793
5794
5795 BEGIN
5796
5797 -- initialize variables
5798 g_success_rec_cnt := 0;
5799 g_error_rec_cnt := 0;
5800 g_error_code := NULL;
5801
5802 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
5803 fnd_message.set_token('VIEW', 'IVSTARZ1 ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
5804 fnd_file.put_line(fnd_file.log, fnd_message.get);
5805
5806 -- Get all the reocords from interface table with status = 'N'
5807 FOR new_ivstarz1_rec IN new_ivstarz1_cur
5808 LOOP
5809
5810 BEGIN
5811 -- initialize record level variables.
5812 g_error_code := NULL;
5813 old_starz1_rec := NULL;
5814 l_valid := NULL;
5815 oss_prog_rec := NULL; -- added wrt UCCR008 arvsrini
5816 uc_app_choices_rec :=NULL; -- added wrt UCCR008 arvsrini
5817 curr_inst_rec := NULL; -- added wrt UCCR008 arvsrini
5818
5819 -- log record processing info.
5820 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
5821 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstarz1_rec.appno));
5822 fnd_file.put_line(fnd_file.log, fnd_message.get);
5823
5824
5825 -- mandatory field validations
5826 IF new_ivstarz1_rec.appno IS NULL THEN
5827 g_error_code := '1037';
5828 END IF;
5829
5830
5831 IF g_error_code IS NULL THEN
5832 ----------------------------
5833 -- AppNo validation
5834 ----------------------------
5835 -- validate Applicant record details in UCAS Applicants table.
5836 -- This is because record gets inserted into igs_uc_app_choices as part of
5837 -- IVSTARN processing and hence at this stage the record must exist.
5838 validate_applicant (new_ivstarz1_rec.appno, g_error_code);
5839
5840 END IF;
5841
5842 IF g_error_code IS NULL THEN
5843
5844 -- get application details - App ID which is needed while inserting a record.
5845 -- Record would always be found otherwise the above validation - Error 1000 would have failed.
5846 appl_det_rec := NULL; -- initialize
5847 OPEN get_appl_dets(new_ivstarz1_rec.appno);
5848 FETCH get_appl_dets INTO appl_det_rec;
5849 CLOSE get_appl_dets;
5850
5851 END IF;
5852
5853
5854 ---------------------------------------
5855 -- validate INSTITUTION value from UCAS
5856 ---------------------------------------
5857 validate_inst_rec := NULL; -- initialize
5858 IF g_error_code IS NULL THEN
5859
5860 IF new_ivstarz1_rec.inst IS NOT NULL THEN
5861 OPEN validate_inst (new_ivstarz1_rec.inst);
5862 FETCH validate_inst INTO validate_inst_rec;
5863
5864 IF validate_inst%NOTFOUND THEN
5865 g_error_code := '1018';
5866 CLOSE validate_inst;
5867
5868 ELSE
5869 CLOSE validate_inst;
5870
5871 -- System specific validation to check that the Institution value is valid for the system.
5872 -- based on the system to which the Application belongs, check that the appropriate
5873 -- flag is checked.
5874 IF appl_det_rec.system_code = 'U' THEN -- FTUG/UCAS
5875 -- check for UCAS
5876 IF validate_inst_rec.ucas <> 'Y' THEN
5877 g_error_code := '1018';
5878 End IF;
5879
5880 ELSIF appl_det_rec.system_code = 'N' THEN -- for NMAS
5881 -- check for NMAS
5882 IF validate_inst_rec.nmas <> 'Y' THEN
5883 g_error_code := '1018';
5884 End IF;
5885
5886 ELSIF appl_det_rec.system_code = 'G' THEN -- for GTTR
5887 -- check for GTTR
5888 IF validate_inst_rec.gttr <> 'Y' THEN
5889 g_error_code := '1018';
5890 End IF;
5891
5892 ELSIF appl_det_rec.system_code = 'S' THEN -- for SWAS
5893 -- check for SWAS
5894 IF validate_inst_rec.swas <> 'Y' THEN
5895 g_error_code := '1018';
5896 End IF;
5897 END IF;
5898
5899 END IF; -- Institution record found.
5900
5901 END IF;
5902 END IF;
5903
5904
5905 ---------------------------------------
5906 -- validate COURSE details from UCAS
5907 ---------------------------------------
5908 IF g_error_code IS NULL THEN
5909 l_valid := NULL; -- initialize
5910 -- validate only if the course related fields are not null from ucas.
5911 IF new_ivstarz1_rec.course IS NULL AND
5912 new_ivstarz1_rec.inst IS NULL THEN
5913
5914 NULL;
5915 ELSE
5916 OPEN validate_course (new_ivstarz1_rec.course, new_ivstarz1_rec.campus, new_ivstarz1_rec.inst, appl_det_rec.system_code);
5917 FETCH validate_course INTO l_valid;
5918 CLOSE validate_course;
5919
5920 IF new_ivstarz1_rec.inst = g_crnt_institute AND l_valid IS NULL THEN
5921 g_error_code := '1045';
5922 END IF;
5923 END IF;
5924 END IF;
5925
5926
5927 ----------------------------
5928 -- MAIN PROCESSING Begins
5929 ----------------------------
5930 IF g_error_code IS NULL THEN
5931
5932 -- Check whether corresponding Application record already exists.
5933 -- If exists then update else insert.
5934 OPEN old_starz1_cur(new_ivstarz1_rec.appno);
5935 FETCH old_starz1_cur INTO old_starz1_rec;
5936 CLOSE old_starz1_cur;
5937
5938 -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5939 IF new_ivstarz1_rec.course IS NULL THEN
5940 l_campus_clr := NULL;
5941 ELSE
5942 l_campus_clr := new_ivstarz1_rec.campus;
5943 END IF;
5944
5945 IF old_starz1_rec.rowid IS NULL THEN -- i.e. new record.
5946
5947 BEGIN
5948 -- call the TBH to update the record
5949 igs_uc_app_clearing_pkg.insert_row -- IGSXI04B.pls
5950 (
5951 x_rowid => old_starz1_rec.rowid -- it would be NULL since rec not found.
5952 ,x_clearing_app_id => old_starz1_rec.clearing_app_id -- since it would be NULL as rec not found
5953 ,x_app_id => appl_det_rec.app_id
5954 ,x_enquiry_no => NULL
5955 ,x_app_no => new_ivstarz1_rec.appno
5956 ,x_date_cef_sent => new_ivstarz1_rec.datecefsent
5957 ,x_cef_no => NVL(new_ivstarz1_rec.cefno ,999999)
5958 ,x_central_clearing => NVL(new_ivstarz1_rec.centralclearing ,'N')
5959 ,x_institution => new_ivstarz1_rec.inst
5960 ,x_course => new_ivstarz1_rec.course
5961 ,x_campus => l_campus_clr -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5962 ,x_entry_month => new_ivstarz1_rec.entrymonth
5963 ,x_entry_year => new_ivstarz1_rec.entryyear
5964 ,x_entry_point => new_ivstarz1_rec.entrypoint
5965 ,x_result => new_ivstarz1_rec.result
5966 ,x_cef_received => 'N'
5967 ,x_clearing_app_source => 'O'
5968 ,x_imported => 'Y'
5969 ,x_mode => 'R'
5970 );
5971
5972 EXCEPTION
5973 WHEN OTHERS THEN
5974 g_error_code := '9999';
5975 fnd_file.put_line(fnd_file.log, SQLERRM);
5976 END;
5977
5978
5979 ELSE -- update
5980
5981 BEGIN
5982 -- call the TBH to update the record
5983 igs_uc_app_clearing_pkg.update_row -- IGSXI04B.pls
5984 (
5985 x_rowid => old_starz1_rec.rowid
5986 ,x_clearing_app_id => old_starz1_rec.clearing_app_id
5987 ,x_app_id => old_starz1_rec.app_id
5988 ,x_enquiry_no => old_starz1_rec.enquiry_no
5989 ,x_app_no => old_starz1_rec.app_no
5990 ,x_date_cef_sent => new_ivstarz1_rec.datecefsent
5991 ,x_cef_no => NVL(new_ivstarz1_rec.cefno ,999999)
5992 ,x_central_clearing => NVL(new_ivstarz1_rec.centralclearing ,'N')
5993 ,x_institution => new_ivstarz1_rec.inst
5994 ,x_course => new_ivstarz1_rec.course
5995 ,x_campus => l_campus_clr -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
5996 ,x_entry_month => new_ivstarz1_rec.entrymonth
5997 ,x_entry_year => new_ivstarz1_rec.entryyear
5998 ,x_entry_point => new_ivstarz1_rec.entrypoint
5999 ,x_result => new_ivstarz1_rec.result
6000 ,x_cef_received => old_starz1_rec.cef_received
6001 ,x_clearing_app_source => old_starz1_rec.clearing_app_source
6002 ,x_imported => 'Y'
6003 ,x_mode => 'R'
6004 );
6005
6006
6007 EXCEPTION
6008 WHEN OTHERS THEN
6009 g_error_code := '9998';
6010 fnd_file.put_line(fnd_file.log, SQLERRM);
6011 END;
6012
6013 END IF; -- insert / update
6014
6015
6016 -- added following code to udpdate igs_uc_app_choices for records with choice no=9 w.r.t. build UCCR008 bug#3239860
6017
6018 OPEN curr_inst_cur(appl_det_rec.system_code);
6019 FETCH curr_inst_cur INTO curr_inst_rec;
6020 CLOSE curr_inst_cur;
6021
6022 -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
6023 IF curr_inst_rec.current_inst_code = new_ivstarz1_rec.inst THEN
6024
6025 OPEN uc_app_choices_cur(new_ivstarz1_rec.appno);
6026 FETCH uc_app_choices_cur INTO uc_app_choices_rec;
6027 CLOSE uc_app_choices_cur;
6028
6029 END IF;
6030
6031 IF g_error_code IS NULL THEN
6032
6033 IF uc_app_choices_rec.rowid IS NOT NULL THEN
6034
6035
6036
6037 IF new_ivstarz1_rec.course IS NULL THEN
6038 l_oss_program_code := uc_app_choices_rec.oss_program_code;
6039 l_oss_program_version := uc_app_choices_rec.oss_program_version;
6040 l_oss_attendance_type := uc_app_choices_rec.oss_attendance_type;
6041 l_oss_attendance_mode := uc_app_choices_rec.oss_attendance_mode;
6042 l_oss_location := uc_app_choices_rec.oss_location;
6043 ELSE
6044 -- Checking whether the UCAS Program details have been modified at UCAS End.
6045 IF new_ivstarz1_rec.course <> uc_app_choices_rec.ucas_program_code OR
6046 new_ivstarz1_rec.campus <> uc_app_choices_rec.campus OR
6047 new_ivstarz1_rec.inst <> uc_app_choices_rec.institute_code THEN
6048
6049 -- Derive the OSS Program details for the new/updated UCAS Course.
6050 OPEN get_oss_prog_cur (new_ivstarz1_rec.course, new_ivstarz1_rec.campus,
6051 new_ivstarz1_rec.inst, uc_app_choices_rec.system_code);
6052 FETCH get_oss_prog_cur INTO oss_prog_rec;
6053
6054 IF new_ivstarz1_rec.inst = g_crnt_institute AND get_oss_prog_cur%NOTFOUND THEN
6055 g_error_code := '1045'; -- UCAS Course not found
6056
6057 END IF;
6058 CLOSE get_oss_prog_cur;
6059
6060 ELSE
6061 -- i.e. If UCAS Course details have not changed.
6062 -- Retain the existing OSS Program details for this record in App Choices table.
6063
6064 -- copying existing values for the record to the program record variable.
6065 oss_prog_rec.oss_program_code := uc_app_choices_rec.oss_program_code ;
6066 oss_prog_rec.oss_program_version := uc_app_choices_rec.oss_program_version ;
6067 oss_prog_rec.oss_attendance_type := uc_app_choices_rec.oss_attendance_type ;
6068 oss_prog_rec.oss_attendance_mode := uc_app_choices_rec.oss_attendance_mode ;
6069 oss_prog_rec.oss_location := uc_app_choices_rec.oss_location ;
6070
6071 END IF;
6072 l_oss_program_code := oss_prog_rec.oss_program_code;
6073 l_oss_program_version := oss_prog_rec.oss_program_version;
6074 l_oss_attendance_type := oss_prog_rec.oss_attendance_type;
6075 l_oss_attendance_mode := oss_prog_rec.oss_attendance_mode;
6076 l_oss_location := oss_prog_rec.oss_location;
6077 END IF;
6078
6079 IF new_ivstarz1_rec.result IS NULL THEN
6080 l_decision := uc_app_choices_rec.decision;
6081 l_reply := uc_app_choices_rec.reply;
6082 ELSIF new_ivstarz1_rec.result = 'A' THEN
6083 l_decision := 'U';
6084 l_reply := 'F';
6085 END IF;
6086
6087
6088 IF g_error_code IS NULL THEN
6089
6090 -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
6091 IF new_ivstarz1_rec.course IS NULL THEN
6092 l_campus_chc := uc_app_choices_rec.campus;
6093 ELSE
6094 l_campus_chc := new_ivstarz1_rec.campus;
6095 END IF;
6096
6097 BEGIN
6098 -- call the TBH to update the record
6099 igs_uc_app_choices_pkg.update_row
6100 (
6101 x_rowid => uc_app_choices_rec.rowid,
6102 x_app_choice_id => uc_app_choices_rec.app_choice_id,
6103 x_app_id => uc_app_choices_rec.app_id,
6104 x_app_no => uc_app_choices_rec.app_no,
6105 x_choice_no => uc_app_choices_rec.choice_no,
6106 x_last_change => uc_app_choices_rec.last_change,
6107 x_institute_code => uc_app_choices_rec.institute_code,
6108 x_ucas_program_code => NVL(new_ivstarz1_rec.course, uc_app_choices_rec.ucas_program_code),
6109 x_oss_program_code => l_oss_program_code ,
6110 x_oss_program_version => l_oss_program_version,
6111 x_oss_attendance_type => l_oss_attendance_type,
6112 x_oss_attendance_mode => l_oss_attendance_mode,
6113 x_campus => l_campus_chc, -- 02-AUG-2006 anwest Bug #5440216 URGENT - UCAS CLEARING 2006 - PART 2 - CLEARING CHOICE NUMBER NULL
6114 x_oss_location => l_oss_location,
6115 x_faculty => NVL(new_ivstarz1_rec.faculty, uc_app_choices_rec.faculty),
6116 x_entry_year => NVL(new_ivstarz1_rec.entryyear, uc_app_choices_rec.entry_year),
6117 x_entry_month => NVL(new_ivstarz1_rec.entrymonth, uc_app_choices_rec.entry_month),
6118 x_point_of_entry => NVL(new_ivstarz1_rec.entrypoint, uc_app_choices_rec.point_of_entry),
6119 x_home => uc_app_choices_rec.home,
6120 x_deferred => uc_app_choices_rec.deferred,
6121 x_route_b_pref_round => uc_app_choices_rec.route_b_pref_round,
6122 x_route_b_actual_round => uc_app_choices_rec.route_b_actual_round,
6123 x_condition_category => uc_app_choices_rec.condition_category,
6124 x_condition_code => uc_app_choices_rec.condition_code,
6125 x_decision => l_decision,
6126 x_decision_date => NVL(uc_app_choices_rec.decision_date,SYSDATE),
6127 x_decision_number => uc_app_choices_rec.decision_number,
6128 x_reply => l_reply,
6129 x_summary_of_cond => uc_app_choices_rec.summary_of_cond,
6130 x_choice_cancelled => uc_app_choices_rec.choice_cancelled,
6131 x_action => uc_app_choices_rec.action,
6132 x_substitution => uc_app_choices_rec.substitution ,
6133 x_date_substituted => uc_app_choices_rec.date_substituted,
6134 x_prev_institution => uc_app_choices_rec.prev_institution,
6135 x_prev_course => uc_app_choices_rec.prev_course,
6136 x_prev_campus => uc_app_choices_rec.prev_campus,
6137 x_ucas_amendment => uc_app_choices_rec.ucas_amendment,
6138 x_withdrawal_reason => uc_app_choices_rec.withdrawal_reason,
6139 x_offer_course => uc_app_choices_rec.offer_course,
6140 x_offer_campus => uc_app_choices_rec.offer_campus,
6141 x_offer_crse_length => uc_app_choices_rec.offer_crse_length,
6142 x_offer_entry_month => uc_app_choices_rec.offer_entry_month,
6143 x_offer_entry_year => uc_app_choices_rec.offer_entry_year,
6144 x_offer_entry_point => uc_app_choices_rec.offer_entry_point,
6145 x_offer_text => uc_app_choices_rec.offer_text,
6146 x_mode => 'R',
6147 x_export_to_oss_status => 'NEW',
6148 x_error_code => NULL,
6149 x_request_id => uc_app_choices_rec.request_id,
6150 x_batch_id => uc_app_choices_rec.batch_id,
6151 x_extra_round_nbr => uc_app_choices_rec.extra_round_nbr,
6152 x_system_code => uc_app_choices_rec.system_code,
6153 x_part_time => uc_app_choices_rec.part_time,
6154 x_interview => uc_app_choices_rec.interview,
6155 x_late_application => uc_app_choices_rec.late_application,
6156 x_modular => uc_app_choices_rec.modular,
6157 x_residential => uc_app_choices_rec.residential,
6158 x_ucas_cycle => uc_app_choices_rec.ucas_cycle
6159
6160 );
6161
6162
6163
6164 EXCEPTION
6165 WHEN OTHERS THEN
6166 g_error_code := '9998';
6167 fnd_file.put_line(fnd_file.log, SQLERRM);
6168 END;
6169
6170 END IF; -- error code check
6171
6172 END IF;
6173 END IF;
6174
6175 END IF; -- main processing
6176
6177
6178
6179
6180 EXCEPTION
6181 WHEN OTHERS THEN
6182 -- catch any unhandled/unexpected errors while processing a record.
6183 -- This would enable processing to continue with subsequent records.
6184
6185 -- Close any Open cursors
6186 IF old_starz1_cur%ISOPEN THEN
6187 CLOSE old_starz1_cur;
6188 END IF;
6189
6190 IF validate_inst%ISOPEN THEN
6191 CLOSE validate_inst;
6192 END IF;
6193
6194 IF validate_Course%ISOPEN THEN
6195 CLOSE validate_Course;
6196 END IF;
6197
6198 IF get_appl_dets%ISOPEN THEN
6199 CLOSE get_appl_dets;
6200 END IF;
6201
6202 g_error_code := '1055';
6203 fnd_file.put_line(fnd_file.log, SQLERRM);
6204 END;
6205
6206 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
6207 -- while processing the record.
6208 IF g_error_code IS NOT NULL THEN
6209
6210 UPDATE igs_uc_istarz1_ints
6211 SET error_code = g_error_code
6212 WHERE rowid = new_ivstarz1_rec.rowid;
6213
6214 -- log error message/meaning.
6215 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
6216
6217 -- update error count
6218 g_error_rec_cnt := g_error_rec_cnt + 1;
6219
6220 ELSE
6221
6222 UPDATE igs_uc_istarz1_ints
6223 SET record_status = 'D',
6224 error_code = NULL
6225 WHERE rowid = new_ivstarz1_rec.rowid;
6226
6227 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
6228 END IF;
6229
6230 END LOOP;
6231
6232 COMMIT;
6233 -- log processing complete for this view
6234 igs_uc_proc_ucas_data.log_proc_complete('IVSTARZ1', g_success_rec_cnt, g_error_rec_cnt);
6235
6236 EXCEPTION
6237 WHEN OTHERS THEN
6238 ROLLBACK;
6239 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
6240 fnd_message.set_token('VIEW', 'IVSTARZ1'||' - '||SQLERRM);
6241 fnd_file.put_line(fnd_file.log, fnd_message.get);
6242 END process_ivstarz1;
6243
6244
6245
6246
6247
6248 PROCEDURE process_ivstarz2 IS
6249 /******************************************************************
6250 Created By : rgangara
6251 Date Created By : 12-JUNE-2003
6252 Purpose : For processing ivstarz2 i.e. Applicant
6253 Clearing Round info. details from UCAS.
6254 Known limitations,enhancements,remarks:
6255 Change History
6256 Who When What
6257 ******************************************************************/
6258
6259 CURSOR new_ivstarz2_cur IS
6260 SELECT ivstz2.rowid,
6261 ivstz2.*
6262 FROM igs_uc_istarz2_ints ivstz2
6263 WHERE ivstz2.record_status = 'N';
6264
6265 -- check for corresponding record in main table.
6266 CURSOR old_starz2_cur(p_appno igs_uc_app_clr_rnd.app_no%TYPE,
6267 p_course igs_uc_app_clr_rnd.ucas_program_code%TYPE,
6268 p_campus igs_uc_app_clr_rnd.ucas_campus%TYPE,
6269 p_inst igs_uc_app_clr_rnd.institution%TYPE,
6270 p_system igs_uc_app_clr_rnd.system_code%TYPE ) IS
6271 SELECT uaclr.rowid,
6272 uaclr.*
6273 FROM igs_uc_app_clr_rnd uaclr
6274 WHERE uaclr.app_no = p_appno
6275 AND uaclr.ucas_program_code = p_course
6276 AND uaclr.ucas_campus = p_campus
6277 AND uaclr.institution = p_inst
6278 AND uaclr.system_code = p_system;
6279
6280
6281
6282 -- get the system and app_id to be populated into App Choices
6283 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
6284 SELECT app_id,
6285 system_code
6286 FROM igs_uc_applicants
6287 WHERE app_no = p_appno;
6288
6289
6290
6291 -- check for corresponding Parent record in App Clearing table.
6292 CURSOR validate_clearing_cur(p_appno igs_uc_app_clearing.app_no%TYPE) IS
6293 SELECT clearing_app_id
6294 FROM igs_uc_app_clearing
6295 WHERE app_no = p_appno;
6296
6297
6298 -- validate Institution value
6299 CURSOR validate_inst (p_inst igs_uc_app_clearing.institution%TYPE) IS
6300 SELECT ucas, gttr, nmas, swas
6301 FROM igs_uc_com_inst
6302 WHERE inst = p_inst;
6303
6304
6305 -- validate Course value/get OSS Program details
6306 CURSOR validate_Course (p_course igs_uc_istarz2_ints.course%TYPE,
6307 p_campus igs_uc_istarz2_ints.campus%TYPE,
6308 p_inst igs_uc_istarz2_ints.inst%TYPE,
6309 p_system igs_uc_crse_dets.system_code%TYPE) IS
6310 SELECT oss_program_code,
6311 oss_program_version,
6312 oss_attendance_type,
6313 oss_attendance_mode,
6314 oss_location
6315 FROM igs_uc_crse_dets
6316 WHERE ucas_program_code = p_course
6317 AND institute = p_inst
6318 AND ucas_campus = p_campus
6319 AND system_code = p_system;
6320
6321
6322
6323 validate_Course_rec validate_course%ROWTYPE; -- Holding of OSS Course details for a UCAS Course
6324 validate_inst_rec validate_inst%ROWTYPE; -- Holding/validating of Institution details
6325 appl_det_rec get_appl_dets%ROWTYPE; -- Holding App ID and System Info. from UCAS Applicants.
6326 old_starz2_rec old_starz2_cur%ROWTYPE;
6327 l_valid VARCHAR2(1);
6328 l_clearing_id igs_uc_app_clearing.clearing_app_id%TYPE; -- for holding clearing ID needed while insert
6329
6330 l_oss_program igs_uc_app_clr_rnd.oss_program_code%TYPE ;
6331 l_oss_program_ver igs_uc_app_clr_rnd.oss_program_version%TYPE ;
6332 l_oss_attend_type igs_uc_app_clr_rnd.oss_attendance_type%TYPE ;
6333 l_oss_attend_mode igs_uc_app_clr_rnd.oss_attendance_mode%TYPE ;
6334 l_oss_location igs_uc_app_clr_rnd.oss_location%TYPE ;
6335
6336
6337 BEGIN
6338
6339 -- initialize variables
6340 g_success_rec_cnt := 0;
6341 g_error_rec_cnt := 0;
6342 g_error_code := NULL;
6343
6344 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
6345 fnd_message.set_token('VIEW', 'IVSTARZ2 ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
6346 fnd_file.put_line(fnd_file.log, fnd_message.get);
6347
6348 -- Get all the reocords from interface table with status = 'N'
6349 FOR new_ivstarz2_rec IN new_ivstarz2_cur
6350 LOOP
6351
6352 BEGIN
6353 -- initialize record level variables.
6354 g_error_code := NULL;
6355 old_starz2_rec := NULL;
6356 l_valid := NULL;
6357 validate_Course_rec := NULL;
6358 appl_det_rec := NULL;
6359 validate_inst_rec := NULL;
6360 l_clearing_id := NULL;
6361
6362 -- log record processing info.
6363 fnd_message.set_name('IGS','IGS_UC_APPNO_ROUND_PROC');
6364 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarz2_rec.appno));
6365 fnd_message.set_token('INST', new_ivstarz2_rec.inst);
6366 fnd_message.set_token('PROGRAM', new_ivstarz2_rec.course);
6367 fnd_message.set_token('CAMPUS', new_ivstarz2_rec.campus);
6368 fnd_file.put_line(fnd_file.log, fnd_message.get);
6369
6370
6371 -- no mandatory field validations as this is an update
6372 IF new_ivstarz2_rec.appno IS NULL OR
6373 new_ivstarz2_rec.course IS NULL OR
6374 new_ivstarz2_rec.campus IS NULL OR
6375 new_ivstarz2_rec.inst IS NULL THEN
6376
6377 g_error_code := '1037';
6378 END IF;
6379
6380
6381 ----------------------------
6382 -- AppNo validation
6383 ----------------------------
6384 IF g_error_code IS NULL THEN
6385 -- validate Applicant record details in UCAS Applicants table.
6386 -- This is because record gets inserted into igs_uc_app_choices as part of
6387 -- IVSTARN processing and hence at this stage the record must exist.
6388 validate_applicant (new_ivstarz2_rec.appno, g_error_code);
6389
6390 END IF;
6391
6392
6393 IF g_error_code IS NULL THEN
6394 -- get application details - App ID which is needed while inserting a record.
6395 -- Record would always be found otherwise the above validation - Error 1000 would have failed.
6396 OPEN get_appl_dets(new_ivstarz2_rec.appno);
6397 FETCH get_appl_dets INTO appl_det_rec;
6398 CLOSE get_appl_dets;
6399 END IF;
6400
6401
6402 ---------------------------------------
6403 -- validate INSTITUTION value from UCAS
6404 ---------------------------------------
6405
6406 IF g_error_code IS NULL THEN
6407 IF new_ivstarz2_rec.inst IS NOT NULL THEN
6408 OPEN validate_inst (new_ivstarz2_rec.inst);
6409 FETCH validate_inst INTO validate_inst_rec;
6410
6411 IF validate_inst%NOTFOUND THEN
6412 g_error_code := '1018';
6413 CLOSE validate_inst;
6414
6415 ELSE
6416 CLOSE validate_inst;
6417
6418 -- System specific validation to check that the Institution value is valid for the system.
6419 -- based on the system to which the Application belongs, check that the appropriate
6420 -- flag is checked.
6421 IF appl_det_rec.system_code = 'U' THEN -- FTUG/UCAS
6422 -- check for UCAS
6423 IF validate_inst_rec.ucas <> 'Y' THEN
6424 g_error_code := '1018';
6425 End IF;
6426
6427 ELSIF appl_det_rec.system_code = 'N' THEN -- for NMAS
6428 -- check for NMAS
6429 IF validate_inst_rec.nmas <> 'Y' THEN
6430 g_error_code := '1018';
6431 End IF;
6432
6433 ELSIF appl_det_rec.system_code = 'G' THEN -- for GTTR
6434 -- check for GTTR
6435 IF validate_inst_rec.gttr <> 'Y' THEN
6436 g_error_code := '1018';
6437 End IF;
6438
6439 ELSIF appl_det_rec.system_code = 'S' THEN -- for SWAS
6440 -- check for SWAS
6441 IF validate_inst_rec.swas <> 'Y' THEN
6442 g_error_code := '1018';
6443 End IF;
6444 END IF;
6445
6446 END IF; -- Institution record found.
6447
6448 END IF;
6449 END IF;
6450
6451
6452 ---------------------------------------
6453 -- validate COURSE details from UCAS
6454 ---------------------------------------
6455 IF g_error_code IS NULL THEN
6456 -- validate only if the course related fields are not null from ucas.
6457 IF new_ivstarz2_rec.course IS NOT NULL
6458 AND new_ivstarz2_rec.campus IS NOT NULL
6459 AND new_ivstarz2_rec.inst IS NOT NULL THEN
6460
6461 OPEN validate_course (new_ivstarz2_rec.course, new_ivstarz2_rec.campus, new_ivstarz2_rec.inst, appl_det_rec.system_code);
6462 FETCH validate_course INTO validate_Course_rec;
6463
6464 IF new_ivstarz2_rec.inst = g_crnt_institute AND validate_course%NOTFOUND THEN
6465 g_error_code := '1045';
6466 END IF;
6467 CLOSE validate_course;
6468
6469 ELSE
6470 g_error_code := '1045'; -- invalid course details - key Course related fields not having values.
6471 END IF;
6472 END IF;
6473
6474
6475 ---------------------------------------
6476 -- validate CLEARING details from UCAS / get clearing_id
6477 ---------------------------------------
6478
6479 IF g_error_code IS NULL THEN
6480 -- validate clearing rec exists
6481 OPEN validate_clearing_cur (new_ivstarz2_rec.appno);
6482 FETCH validate_clearing_cur INTO l_clearing_id;
6483
6484 IF validate_clearing_cur%NOTFOUND THEN
6485 g_error_code := '1047'; -- no clearing/parent rec exists.
6486 END IF;
6487 CLOSE validate_clearing_cur;
6488
6489 END IF;
6490
6491
6492
6493 ----------------------------
6494 -- MAIN PROCESSING Begins
6495 ----------------------------
6496 IF g_error_code IS NULL THEN
6497
6498 -- Check whether corresponding record already exists in main table.
6499 -- If exists then update else insert.
6500 OPEN old_starz2_cur(new_ivstarz2_rec.appno, new_ivstarz2_rec.course, new_ivstarz2_rec.campus, new_ivstarz2_rec.inst, appl_det_rec.system_code);
6501 FETCH old_starz2_cur INTO old_starz2_rec;
6502 CLOSE old_starz2_cur;
6503
6504
6505 IF old_starz2_rec.rowid IS NULL THEN -- i.e. new record.
6506
6507 BEGIN
6508 -- call the TBH to update the record
6509 igs_uc_app_clr_rnd_pkg.insert_row -- IGSXI05B.pls
6510 (
6511 x_rowid => old_starz2_rec.rowid
6512 ,x_app_clear_round_id => old_starz2_rec.app_clear_round_id -- since it would be NULL if no rec found.
6513 ,x_clearing_app_id => l_clearing_id
6514 ,x_app_no => new_ivstarz2_rec.appno
6515 ,x_enquiry_no => NULL
6516 ,x_round_no => NVL(new_ivstarz2_rec.roundno ,1)
6517 ,x_institution => new_ivstarz2_rec.inst
6518 ,x_ucas_program_code => new_ivstarz2_rec.course
6519 ,x_ucas_campus => new_ivstarz2_rec.campus
6520 ,x_oss_program_code => validate_Course_rec.oss_program_code
6521 ,x_oss_program_version => validate_Course_rec.oss_program_version
6522 ,x_oss_location => validate_Course_rec.oss_location
6523 ,x_faculty => new_ivstarz2_rec.faculty
6524 ,x_accommodation_reqd => 'N'
6525 ,x_round_type => new_ivstarz2_rec.roundtype
6526 ,x_result => new_ivstarz2_rec.result
6527 ,x_mode => 'R'
6528 ,x_oss_attendance_type => validate_Course_rec.oss_attendance_mode
6529 ,x_oss_attendance_mode => validate_Course_rec.oss_attendance_type
6530 ,x_system_code => appl_det_rec.system_code
6531 );
6532
6533 EXCEPTION
6534 WHEN OTHERS THEN
6535 g_error_code := '9999';
6536 fnd_file.put_line(fnd_file.log, SQLERRM);
6537 END;
6538
6539
6540 ELSE -- update
6541
6542 BEGIN
6543 -- call the TBH to update the record
6544 igs_uc_app_clr_rnd_pkg.update_row -- IGSXI05B.pls
6545 (
6546 x_rowid => old_starz2_rec.rowid
6547 ,x_app_clear_round_id => old_starz2_rec.app_clear_round_id
6548 ,x_clearing_app_id => old_starz2_rec.clearing_app_id
6549 ,x_app_no => old_starz2_rec.app_no
6550 ,x_enquiry_no => old_starz2_rec.enquiry_no
6551 ,x_round_no => old_starz2_rec.round_no
6552 ,x_institution => old_starz2_rec.institution
6553 ,x_ucas_program_code => old_starz2_rec.ucas_program_code
6554 ,x_ucas_campus => old_starz2_rec.ucas_campus
6555 ,x_oss_program_code => old_starz2_rec.oss_program_code
6556 ,x_oss_program_version => old_starz2_rec.oss_program_version
6557 ,x_oss_location => old_starz2_rec.oss_location
6558 ,x_faculty => new_ivstarz2_rec.faculty
6559 ,x_accommodation_reqd => old_starz2_rec.accommodation_reqd
6560 ,x_round_type => new_ivstarz2_rec.roundtype
6561 ,x_result => new_ivstarz2_rec.result
6562 ,x_mode => 'R'
6563 ,x_oss_attendance_type => old_starz2_rec.oss_attendance_type
6564 ,x_oss_attendance_mode => old_starz2_rec.oss_attendance_mode
6565 ,x_system_code => old_starz2_rec.system_code
6566 );
6567
6568
6569 EXCEPTION
6570 WHEN OTHERS THEN
6571 g_error_code := '9998';
6572 fnd_file.put_line(fnd_file.log, SQLERRM);
6573 END;
6574
6575 END IF; -- insert / update
6576
6577 END IF; -- main processing
6578
6579 EXCEPTION
6580 WHEN OTHERS THEN
6581 -- catch any unhandled/unexpected errors while processing a record.
6582 -- This would enable processing to continue with subsequent records.
6583
6584 -- Close any Open cursors
6585 IF old_starz2_cur%ISOPEN THEN
6586 CLOSE old_starz2_cur;
6587 END IF;
6588
6589 IF validate_clearing_cur%ISOPEN THEN
6590 CLOSE validate_clearing_cur;
6591 END IF;
6592
6593 IF validate_inst%ISOPEN THEN
6594 CLOSE validate_inst;
6595 END IF;
6596
6597 IF validate_Course%ISOPEN THEN
6598 CLOSE validate_Course;
6599 END IF;
6600
6601 g_error_code := '1055';
6602 fnd_file.put_line(fnd_file.log, SQLERRM);
6603 END;
6604
6605 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
6606 -- while processing the record.
6607 IF g_error_code IS NOT NULL THEN
6608
6609 UPDATE igs_uc_istarz2_ints
6610 SET error_code = g_error_code
6611 WHERE rowid = new_ivstarz2_rec.rowid;
6612
6613 -- log error message/meaning.
6614 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
6615
6616 -- update error count
6617 g_error_rec_cnt := g_error_rec_cnt + 1;
6618
6619 ELSE
6620
6621 UPDATE igs_uc_istarz2_ints
6622 SET record_status = 'D',
6623 error_code = NULL
6624 WHERE rowid = new_ivstarz2_rec.rowid;
6625
6626 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
6627 END IF;
6628
6629 END LOOP;
6630
6631 COMMIT;
6632 -- log processing complete for this view
6633 igs_uc_proc_ucas_data.log_proc_complete('IVSTARZ2', g_success_rec_cnt, g_error_rec_cnt);
6634
6635 EXCEPTION
6636 WHEN OTHERS THEN
6637 ROLLBACK;
6638 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
6639 fnd_message.set_token('VIEW', 'IVSTARZ2'||' - '||SQLERRM);
6640 fnd_file.put_line(fnd_file.log, fnd_message.get);
6641 END process_ivstarz2;
6642
6643
6644
6645
6646 PROCEDURE process_ivstarw IS
6647 /******************************************************************
6648 Created By : rgangara
6649 Date Created By : 12-JUNE-2003
6650 Purpose : For processing IVSTARW i.e. Wrong Applicant
6651 details from UCAS.
6652 Known limitations,enhancements,remarks:
6653 Change History
6654 Who When What
6655 rbezawad 14-Oct-03 Modified for ucfd209- Substitution Support build bug#2669228.
6656 jchakrab 11-Nov-2005 Modified for 4697447 - Re-instated applications should not be marked for expunge
6657 ******************************************************************/
6658
6659 CURSOR new_ivstarw_cur IS
6660 SELECT ivstz2.rowid,
6661 ivstz2.*
6662 FROM igs_uc_istarw_ints ivstz2
6663 WHERE ivstz2.record_status = 'N';
6664
6665 -- check for corresponding record in main table.
6666 CURSOR old_starw_cur(p_appno igs_uc_wrong_app.app_no%TYPE) IS
6667 SELECT uwap.rowid,
6668 uwap.*
6669 FROM igs_uc_wrong_app uwap
6670 WHERE uwap.app_no = p_appno;
6671
6672 old_starw_rec old_starw_cur%ROWTYPE;
6673
6674 CURSOR c_reinstate_meaning IS
6675 SELECT LKUP.MEANING
6676 FROM IGS_LOOKUP_VALUES LKUP
6677 WHERE LKUP.LOOKUP_TYPE = 'IGS_UC_APP_WITHDRAWN'
6678 AND LKUP.LOOKUP_CODE = 'R';
6679
6680 l_reinstate_meaning IGS_UC_WRONG_APP.REMARK%TYPE;
6681 l_expunge_flag IGS_UC_WRONG_APP.EXPUNGE%TYPE;
6682
6683 BEGIN
6684
6685 -- initialize variables
6686 g_success_rec_cnt := 0;
6687 g_error_rec_cnt := 0;
6688 g_error_code := NULL;
6689
6690 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
6691 fnd_message.set_token('VIEW', 'IVSTARW ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
6692 fnd_file.put_line(fnd_file.log, fnd_message.get);
6693
6694 --get the reinstate remark text from IGS_UC_APP_WITHDRAWN lookup
6695 OPEN c_reinstate_meaning;
6696 FETCH c_reinstate_meaning INTO l_reinstate_meaning;
6697 CLOSE c_reinstate_meaning;
6698
6699 -- Get all the reocords from interface table with status = 'N'
6700 FOR new_ivstarw_rec IN new_ivstarw_cur
6701 LOOP
6702
6703 BEGIN
6704 -- initialize record level variables.
6705 g_error_code := NULL;
6706 old_starw_rec := NULL;
6707
6708 -- log record processing info.
6709 fnd_message.set_name('IGS','IGS_UC_APPNO_PROC');
6710 fnd_message.set_token('APPL_NO', TO_CHAR(new_ivstarw_rec.appno));
6711 fnd_file.put_line(fnd_file.log, fnd_message.get);
6712
6713
6714 -- no mandatory field validations as this is an update
6715 IF new_ivstarw_rec.appno IS NULL THEN
6716 g_error_code := '1037';
6717 END IF;
6718
6719
6720 ----------------------------
6721 -- AppNo validation
6722 ----------------------------
6723 IF g_error_code IS NULL THEN
6724 -- validate Applicant record details in UCAS Applicants table.
6725 -- This is because record gets inserted into igs_uc_app_choices as part of
6726 -- IVSTARN processing and hence at this stage the record must exist.
6727 validate_applicant (new_ivstarw_rec.appno, g_error_code);
6728
6729 END IF;
6730
6731
6732 ----------------------------
6733 -- MAIN PROCESSING Begins
6734 ----------------------------
6735 IF g_error_code IS NULL THEN
6736
6737 -- Check whether corresponding record already exists in main table.
6738 -- If exists then update else insert.
6739 OPEN old_starw_cur(new_ivstarw_rec.appno);
6740 FETCH old_starw_cur INTO old_starw_rec;
6741 CLOSE old_starw_cur;
6742
6743 --prevent expunge when remark is reinstate
6744 IF UPPER(l_reinstate_meaning) = UPPER(RTRIM(new_ivstarw_rec.remark)) THEN
6745 l_expunge_flag := 'N';
6746 ELSE
6747 l_expunge_flag := 'Y';
6748 END IF;
6749
6750 IF old_starw_rec.rowid IS NULL THEN -- i.e. new record.
6751
6752 BEGIN
6753 -- call the TBH to update the record
6754 igs_uc_wrong_app_pkg.insert_row -- IGSXI34B.pls
6755 (
6756 x_rowid => old_starw_rec.rowid -- since it would be NULL if old rec not found
6757 ,x_wrong_app_id => old_starw_rec.wrong_app_id -- since it would be NULL if old rec not found
6758 ,x_app_no => new_ivstarw_rec.appno
6759 ,x_miscoded => NVL(new_ivstarw_rec.miscoded, 'N')
6760 ,x_cancelled => NVL(new_ivstarw_rec.cancelled, 'N')
6761 ,x_cancel_date => new_ivstarw_rec.canceldate
6762 ,x_remark => new_ivstarw_rec.remark
6763 ,x_expunge => l_expunge_flag
6764 ,x_batch_id => NULL
6765 ,x_expunged => 'N'
6766 ,x_mode => 'R'
6767 ,x_joint_admission_ind => NVL(new_ivstarw_rec.jointadmission, 'N')
6768 ,x_choice1_lost => NVL(new_ivstarw_rec.choice1lost, 'N')
6769 ,x_choice2_lost => NVL(new_ivstarw_rec.choice2lost, 'N')
6770 ,x_choice3_lost => NVL(new_ivstarw_rec.choice3lost, 'N')
6771 ,x_choice4_lost => NVL(new_ivstarw_rec.choice4lost, 'N')
6772 ,x_choice5_lost => NVL(new_ivstarw_rec.choice5lost, 'N')
6773 ,x_choice6_lost => NVL(new_ivstarw_rec.choice6lost, 'N')
6774 ,x_choice7_lost => NVL(new_ivstarw_rec.choice7lost, 'N')
6775 );
6776
6777 EXCEPTION
6778 WHEN OTHERS THEN
6779 g_error_code := '9999';
6780 fnd_file.put_line(fnd_file.log, SQLERRM);
6781 END;
6782
6783
6784 ELSE -- update
6785
6786 BEGIN
6787 -- call the TBH to update the record
6788 igs_uc_wrong_app_pkg.update_row -- IGSXI34B.pls
6789 (
6790 x_rowid => old_starw_rec.rowid
6791 ,x_wrong_app_id => old_starw_rec.wrong_app_id
6792 ,x_app_no => old_starw_rec.app_no
6793 ,x_miscoded => NVL(new_ivstarw_rec.miscoded, 'N')
6794 ,x_cancelled => NVL(new_ivstarw_rec.cancelled, 'N')
6795 ,x_cancel_date => new_ivstarw_rec.canceldate
6796 ,x_remark => new_ivstarw_rec.remark
6797 ,x_expunge => l_expunge_flag
6798 ,x_batch_id => old_starw_rec.batch_id
6799 ,x_expunged => 'N'
6800 ,x_mode => 'R'
6801 ,x_joint_admission_ind => NVL(new_ivstarw_rec.jointadmission, 'N')
6802 ,x_choice1_lost => NVL(new_ivstarw_rec.choice1lost, 'N')
6803 ,x_choice2_lost => NVL(new_ivstarw_rec.choice2lost, 'N')
6804 ,x_choice3_lost => NVL(new_ivstarw_rec.choice3lost, 'N')
6805 ,x_choice4_lost => NVL(new_ivstarw_rec.choice4lost, 'N')
6806 ,x_choice5_lost => NVL(new_ivstarw_rec.choice5lost, 'N')
6807 ,x_choice6_lost => NVL(new_ivstarw_rec.choice6lost, 'N')
6808 ,x_choice7_lost => NVL(new_ivstarw_rec.choice7lost, 'N')
6809 );
6810
6811
6812 EXCEPTION
6813 WHEN OTHERS THEN
6814 g_error_code := '9998';
6815 fnd_file.put_line(fnd_file.log, SQLERRM);
6816 END;
6817
6818 END IF; -- insert / update
6819
6820 END IF; -- main processing
6821
6822 EXCEPTION
6823 WHEN OTHERS THEN
6824 -- catch any unhandled/unexpected errors while processing a record.
6825 -- This would enable processing to continue with subsequent records.
6826
6827 -- Close any Open cursors
6828 IF old_starw_cur%ISOPEN THEN
6829 CLOSE old_starw_cur;
6830 END IF;
6831
6832 g_error_code := '1055';
6833 fnd_file.put_line(fnd_file.log, SQLERRM);
6834 END;
6835
6836 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
6837 -- while processing the record.
6838 IF g_error_code IS NOT NULL THEN
6839
6840 UPDATE igs_uc_istarw_ints
6841 SET error_code = g_error_code
6842 WHERE rowid = new_ivstarw_rec.rowid;
6843
6844 -- log error message/meaning.
6845 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
6846
6847 -- update error count
6848 g_error_rec_cnt := g_error_rec_cnt + 1;
6849
6850 ELSE
6851
6852 UPDATE igs_uc_istarw_ints
6853 SET record_status = 'D',
6854 error_code = NULL
6855 WHERE rowid = new_ivstarw_rec.rowid;
6856
6857 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
6858 END IF;
6859
6860 END LOOP;
6861
6862 COMMIT;
6863 -- log processing complete for this view
6864 igs_uc_proc_ucas_data.log_proc_complete('IVSTARW', g_success_rec_cnt, g_error_rec_cnt);
6865
6866 EXCEPTION
6867 WHEN OTHERS THEN
6868 ROLLBACK;
6869 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
6870 fnd_message.set_token('VIEW', 'IVSTARW'||' - '||SQLERRM);
6871 fnd_file.put_line(fnd_file.log, fnd_message.get);
6872 END process_ivstarw;
6873
6874
6875
6876
6877 PROCEDURE process_ivreference IS
6878 /******************************************************************
6879 Created By : rgangara
6880 Date Created By : 12-JUNE-2003
6881 Purpose : For processing IVREFERENCE details from UCAS.
6882 Known limitations,enhancements,remarks:
6883 Change History
6884 Who When What
6885 jbaber 12-Jul-05 Modified for UC315 - UCAS Support 2006
6886 to include column PREDICTED_GRADES
6887 ******************************************************************/
6888
6889 -- get the records from interface tables where status is NEW.
6890 CURSOR new_ivrefer_cur IS
6891 SELECT irefr.rowid,
6892 irefr.*
6893 FROM igs_uc_irefrnc_ints irefr
6894 WHERE irefr.record_status = 'N';
6895
6896 -- check for corresponding record in main table.
6897 CURSOR old_refer_cur(p_appno igs_uc_app_referees.app_no%TYPE,
6898 p_referee igs_uc_app_referees.referee_name%TYPE) IS
6899 SELECT uapref.rowid,
6900 uapref.*
6901 FROM igs_uc_app_referees uapref
6902 WHERE uapref.app_no = p_appno
6903 AND uapref.referee_name = p_referee;
6904
6905 old_refer_rec old_refer_cur%ROWTYPE;
6906
6907
6908 --- added for support CLOB insert/update
6909 CURSOR old_clob_cur(cp_rowid VARCHAR2) IS
6910 SELECT uapref.statement
6911 FROM igs_uc_app_referees uapref
6912 WHERE rowid = cp_rowid
6913 FOR UPDATE NOWAIT;
6914
6915 l_old_clob_data igs_uc_app_referees.statement%TYPE;
6916
6917 BEGIN
6918
6919 -- initialize variables
6920 g_success_rec_cnt := 0;
6921 g_error_rec_cnt := 0;
6922 g_error_code := NULL;
6923
6924 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
6925 fnd_message.set_token('VIEW', 'IVREFERENCE ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
6926 fnd_file.put_line(fnd_file.log, fnd_message.get);
6927
6928 -- Get all the reocords from interface table with status = 'N'
6929 FOR new_ireference_rec IN new_ivrefer_cur
6930 LOOP
6931
6932 BEGIN
6933 -- initialize record level variables.
6934 g_error_code := NULL;
6935 old_refer_rec := NULL;
6936
6937
6938 -- log record processing info.
6939 fnd_message.set_name('IGS','IGS_UC_APPNO_REFEREE_PROC');
6940 fnd_message.set_token('APPNO', TO_CHAR(new_ireference_rec.appno));
6941 fnd_message.set_token('REFEREE', new_ireference_rec.refereename);
6942 fnd_file.put_line(fnd_file.log, fnd_message.get);
6943
6944
6945 -- no mandatory field validations as this is an update
6946 IF new_ireference_rec.appno IS NULL THEN
6947 g_error_code := '1037';
6948 END IF;
6949
6950
6951 ----------------------------
6952 -- AppNo validation
6953 ----------------------------
6954 IF g_error_code IS NULL THEN
6955 -- validate Applicant record details in UCAS Applicants table.
6956 -- This is because record gets inserted into igs_uc_applicant as part of
6957 -- IVSTARN processing and hence at this stage the record must exist.
6958 validate_applicant (new_ireference_rec.appno, g_error_code);
6959
6960 END IF;
6961
6962
6963 ----------------------------
6964 -- MAIN PROCESSING Begins
6965 ----------------------------
6966 IF g_error_code IS NULL THEN
6967
6968 -- Check whether corresponding record already exists in main table.
6969 -- If exists then update else insert.
6970 OPEN old_refer_cur(new_ireference_rec.appno, new_ireference_rec.refereename);
6971 FETCH old_refer_cur INTO old_refer_rec;
6972 CLOSE old_refer_cur;
6973
6974
6975 IF old_refer_rec.rowid IS NULL THEN -- i.e. new record.
6976
6977 BEGIN
6978 -- call the TBH to update the record
6979 igs_uc_app_referees_pkg.insert_row -- IGSXI49B.pls
6980 (
6981 x_rowid => old_refer_rec.rowid
6982 ,x_app_no => new_ireference_rec.appno
6983 ,x_referee_name => new_ireference_rec.refereename
6984 ,x_referee_post => new_ireference_rec.refereepost
6985 ,x_estab_name => new_ireference_rec.estabname
6986 ,x_address1 => new_ireference_rec.address1
6987 ,x_address2 => new_ireference_rec.address2
6988 ,x_address3 => new_ireference_rec.address3
6989 ,x_address4 => new_ireference_rec.address4
6990 ,x_telephone => new_ireference_rec.telephone
6991 ,x_fax => new_ireference_rec.fax
6992 ,x_email => new_ireference_rec.email
6993 ,x_statement => EMPTY_CLOB()
6994 ,x_predicted_grades => new_ireference_rec.predictedgrades
6995 ,x_mode => 'R'
6996 );
6997
6998 OPEN old_clob_cur(old_refer_rec.rowid);
6999 FETCH old_clob_cur INTO l_old_clob_data;
7000
7001 -- open the CLOB and write the LONG data to it
7002 dbms_lob.open(l_old_clob_data, dbms_lob.lob_readwrite);
7003 dbms_lob.write(l_old_clob_data, LENGTH(new_ireference_rec.statement), 1, new_ireference_rec.statement);
7004 dbms_lob.close(l_old_clob_data);
7005 CLOSE old_clob_cur;
7006
7007 EXCEPTION
7008 WHEN OTHERS THEN
7009
7010 IF old_clob_cur%ISOPEN THEN
7011 CLOSE old_clob_cur;
7012 END IF;
7013
7014 g_error_code := '9999';
7015 fnd_file.put_line(fnd_file.log, SQLERRM);
7016 END;
7017
7018
7019 ELSE -- update
7020
7021 BEGIN
7022 -- call the TBH to update the record
7023 igs_uc_app_referees_pkg.update_row -- IGSXI49B.pls
7024 (
7025 x_rowid => old_refer_rec.rowid
7026 ,x_app_no => old_refer_rec.app_no
7027 ,x_referee_name => old_refer_rec.referee_name
7028 ,x_referee_post => new_ireference_rec.refereepost
7029 ,x_estab_name => new_ireference_rec.estabname
7030 ,x_address1 => new_ireference_rec.address1
7031 ,x_address2 => new_ireference_rec.address2
7032 ,x_address3 => new_ireference_rec.address3
7033 ,x_address4 => new_ireference_rec.address4
7034 ,x_telephone => new_ireference_rec.telephone
7035 ,x_fax => new_ireference_rec.fax
7036 ,x_email => new_ireference_rec.email
7037 ,x_statement => EMPTY_CLOB()
7038 ,x_predicted_grades => new_ireference_rec.predictedgrades
7039 ,x_mode => 'R'
7040 );
7041
7042 -- get the record for which the CLOB field has to be updated.
7043 OPEN old_clob_cur(old_refer_rec.rowid);
7044 FETCH old_clob_cur INTO l_old_clob_data;
7045
7046 -- open the CLOB and write the LONG data to it
7047 dbms_lob.open(l_old_clob_data, dbms_lob.lob_readwrite);
7048 dbms_lob.write(l_old_clob_data, LENGTH(new_ireference_rec.statement), 1, new_ireference_rec.statement);
7049 dbms_lob.close(l_old_clob_data);
7050 CLOSE old_clob_cur;
7051
7052 EXCEPTION
7053 WHEN OTHERS THEN
7054
7055 IF old_clob_cur%ISOPEN THEN
7056 CLOSE old_clob_cur;
7057 END IF;
7058
7059 g_error_code := '9998';
7060 fnd_file.put_line(fnd_file.log, SQLERRM);
7061
7062 END;
7063
7064 END IF; -- insert / update
7065
7066 END IF; -- main processing
7067
7068 EXCEPTION
7069 WHEN OTHERS THEN
7070 -- catch any unhandled/unexpected errors while processing a record.
7071 -- This would enable processing to continue with subsequent records.
7072
7073 -- Close any Open cursors
7074 IF old_refer_cur%ISOPEN THEN
7075 CLOSE old_refer_cur;
7076 END IF;
7077
7078 IF old_clob_cur%ISOPEN THEN
7079 CLOSE old_clob_cur;
7080 END IF;
7081
7082 g_error_code := '1055';
7083 fnd_file.put_line(fnd_file.log, SQLERRM);
7084 END;
7085
7086 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
7087 -- while processing the record.
7088 IF g_error_code IS NOT NULL THEN
7089
7090 UPDATE igs_uc_irefrnc_ints
7091 SET error_code = g_error_code
7092 WHERE rowid = new_ireference_rec.rowid;
7093
7094 -- log error message/meaning.
7095 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
7096
7097 -- update error count
7098 g_error_rec_cnt := g_error_rec_cnt + 1;
7099
7100 ELSE
7101
7102 UPDATE igs_uc_irefrnc_ints
7103 SET record_status = 'D',
7104 error_code = NULL
7105 WHERE rowid = new_ireference_rec.rowid;
7106
7107 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
7108 END IF;
7109
7110 END LOOP;
7111
7112 COMMIT;
7113 -- log processing complete for this view
7114 igs_uc_proc_ucas_data.log_proc_complete('IVREFERENCE', g_success_rec_cnt, g_error_rec_cnt);
7115
7116 EXCEPTION
7117 WHEN OTHERS THEN
7118 ROLLBACK;
7119 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
7120 fnd_message.set_token('VIEW', 'IVREFERENCE'||' - '||SQLERRM);
7121 fnd_file.put_line(fnd_file.log, fnd_message.get);
7122 END process_ivreference;
7123
7124
7125
7126
7127
7128 PROCEDURE process_ivformquals IS
7129 /******************************************************************
7130 Created By : rgangara
7131 Date Created By : 12-JUNE-2003
7132 Purpose : For processing IVFORMQUALS details from UCAS.
7133 Known limitations,enhancements,remarks:
7134 Change History
7135 Who When What
7136 jbaber 29-Jul-05 Removed mandatory validation for field qualid
7137 and changed logical primary key to
7138 appno, qual_type and title
7139 ******************************************************************/
7140
7141 -- get the records from interface tables where status is NEW.
7142 CURSOR new_ivfrmqual_cur IS
7143 SELECT ivfq.rowid,
7144 ivfq.*
7145 FROM igs_uc_ifrmqul_ints ivfq
7146 WHERE ivfq.record_status = 'N';
7147
7148 -- check for corresponding record in main table.
7149 CURSOR old_frmqual_cur(p_appno igs_uc_form_quals.app_no%TYPE,
7150 p_qualtype igs_uc_form_quals.qual_type%TYPE,
7151 p_title igs_uc_form_quals.title%TYPE) IS
7152 SELECT ufq.rowid,
7153 ufq.*
7154 FROM igs_uc_form_quals ufq
7155 WHERE ufq.app_no = p_appno
7156 AND ufq.qual_type = p_qualtype
7157 AND ufq.title = p_title;
7158
7159 old_frmqual_rec old_frmqual_cur%ROWTYPE;
7160
7161 BEGIN
7162
7163 -- initialize variables
7164 g_success_rec_cnt := 0;
7165 g_error_rec_cnt := 0;
7166 g_error_code := NULL;
7167
7168 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
7169 fnd_message.set_token('VIEW', 'IVFORMQUALS ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
7170 fnd_file.put_line(fnd_file.log, fnd_message.get);
7171
7172 -- Get all the reocords from interface table with status = 'N'
7173 FOR new_ivfrmqual_rec IN new_ivfrmqual_cur
7174 LOOP
7175
7176 BEGIN
7177 -- initialize record level variables.
7178 g_error_code := NULL;
7179 old_frmqual_rec := NULL;
7180
7181 -- log record processing info.
7182 fnd_message.set_name('IGS','IGS_UC_APPNO_QUAL_PROC');
7183 fnd_message.set_token('APPNO', TO_CHAR(new_ivfrmqual_rec.appno));
7184 fnd_message.set_token('QUAL', TO_CHAR(new_ivfrmqual_rec.qualid));
7185 fnd_file.put_line(fnd_file.log, fnd_message.get);
7186
7187
7188 -- no mandatory field validations as this is an update
7189 IF new_ivfrmqual_rec.appno IS NULL THEN
7190 g_error_code := '1037';
7191 END IF;
7192
7193
7194 ----------------------------
7195 -- AppNo validation
7196 ----------------------------
7197 IF g_error_code IS NULL THEN
7198 -- validate Applicant record details in UCAS Applicants table.
7199 -- This is because record gets inserted into igs_uc_app_choices as part of
7200 -- IVSTARN processing and hence at this stage the record must exist.
7201 validate_applicant (new_ivfrmqual_rec.appno, g_error_code);
7202
7203 END IF;
7204
7205
7206 ----------------------------
7207 -- MAIN PROCESSING Begins
7208 ----------------------------
7209 IF g_error_code IS NULL THEN
7210
7211 -- Check whether corresponding record already exists in main table.
7212 -- If exists then update else insert.
7213 OPEN old_frmqual_cur(new_ivfrmqual_rec.appno, new_ivfrmqual_rec.qualtype, new_ivfrmqual_rec.title);
7214 FETCH old_frmqual_cur INTO old_frmqual_rec;
7215 CLOSE old_frmqual_cur;
7216
7217
7218 IF old_frmqual_rec.rowid IS NULL THEN -- i.e. new record.
7219
7220 BEGIN
7221
7222 -- call the TBH to Insert the record
7223 igs_uc_form_quals_pkg.insert_row -- IGSXI51B.pls
7224 (
7225 x_rowid => old_frmqual_rec.rowid
7226 ,x_app_no => new_ivfrmqual_rec.appno
7227 ,x_qual_id => new_ivfrmqual_rec.qualid
7228 ,x_qual_type => new_ivfrmqual_rec.qualtype
7229 ,x_award_body => new_ivfrmqual_rec.awardbody
7230 ,x_title => new_ivfrmqual_rec.title
7231 ,x_grade => new_ivfrmqual_rec.grade
7232 ,x_qual_date => new_ivfrmqual_rec.qualdate
7233 ,x_mode => 'R'
7234 );
7235
7236 EXCEPTION
7237 WHEN OTHERS THEN
7238 g_error_code := '9999';
7239 fnd_file.put_line(fnd_file.log, SQLERRM);
7240
7241 END;
7242
7243
7244 ELSE -- update
7245
7246 BEGIN
7247 igs_uc_form_quals_pkg.update_row -- IGSXI51B.pls
7248 (
7249 x_rowid => old_frmqual_rec.rowid
7250 ,x_app_no => old_frmqual_rec.app_no
7251 ,x_qual_id => new_ivfrmqual_rec.qualid
7252 ,x_qual_type => old_frmqual_rec.qual_type
7253 ,x_award_body => new_ivfrmqual_rec.awardbody
7254 ,x_title => old_frmqual_rec.title
7255 ,x_grade => new_ivfrmqual_rec.grade
7256 ,x_qual_date => new_ivfrmqual_rec.qualdate
7257 ,x_mode => 'R'
7258 );
7259
7260 EXCEPTION
7261 WHEN OTHERS THEN
7262 g_error_code := '9998';
7263 fnd_file.put_line(fnd_file.log, SQLERRM);
7264
7265 END;
7266
7267 END IF; -- insert / update
7268
7269 END IF; -- main processing
7270
7271 EXCEPTION
7272 WHEN OTHERS THEN
7273 -- catch any unhandled/unexpected errors while processing a record.
7274 -- This would enable processing to continue with subsequent records.
7275
7276 -- Close any Open cursors
7277 IF old_frmqual_cur%ISOPEN THEN
7278 CLOSE old_frmqual_cur;
7279 END IF;
7280
7281 g_error_code := '1055';
7282 fnd_file.put_line(fnd_file.log, SQLERRM);
7283 END;
7284
7285 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
7286 -- while processing the record.
7287 IF g_error_code IS NOT NULL THEN
7288
7289 UPDATE igs_uc_ifrmqul_ints
7290 SET error_code = g_error_code
7291 WHERE rowid = new_ivfrmqual_rec.rowid;
7292
7293 -- log error message/meaning.
7294 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
7295
7296 -- update error count
7297 g_error_rec_cnt := g_error_rec_cnt + 1;
7298
7299 ELSE
7300
7301 UPDATE igs_uc_ifrmqul_ints
7302 SET record_status = 'D',
7303 error_code = NULL
7304 WHERE rowid = new_ivfrmqual_rec.rowid;
7305
7306 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
7307 END IF;
7308
7309 END LOOP;
7310
7311 COMMIT;
7312 -- log processing complete for this view
7313 igs_uc_proc_ucas_data.log_proc_complete('IVFORMQUALS', g_success_rec_cnt, g_error_rec_cnt);
7314
7315 EXCEPTION
7316 WHEN OTHERS THEN
7317 ROLLBACK;
7318 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
7319 fnd_message.set_token('VIEW', 'IVFORMQUALS'||' - '||SQLERRM);
7320 fnd_file.put_line(fnd_file.log, fnd_message.get);
7321 END process_ivformquals;
7322
7323
7324
7325 PROCEDURE process_ivstarpqr IS
7326 /******************************************************************
7327 Created By : rgangara
7328 Date Created By : 12-JUNE-2003
7329 Purpose : For processing IVSTARPQR (Applicant Results) details from UCAS.
7330 For this view the data coming from Hercules is different from the data that comes from
7331 Marvin. From Hercules Subject ID value comes. Based on the subject ID, other field values like
7332 Subject Code, year, sitting, awarding body etc is derived.
7333 However, data coming from Marvin does not have subject ID value. Instead fields
7334 Known limitations,enhancements,remarks:
7335 Change History
7336 Who When What
7337 pmarada 12-aug-2003 Changed the l_proc_reqd valiable initial value to Y, moved the validate_appno
7338 validation to first place. bug 3091859, 3092173
7339 dsridhar 21-AUG-2003 Bug No: 3106972. Added the code to assign the value for subject id when values
7340 for the cursor c_subjectid is found.
7341 dsridhar 25-AUG-2003 Bug No: 3108657. The year data in COM_EBL table is 4 digits whereas the transaction
7342 data coming from UCAS has 2 digits. Hence need to convert 2 digit year to 4 digit
7343 year. If the year is between 50 and 99, 1900 is added. If the year is between 00 and
7344 49, 2000 is added.
7345 dsridhar 27-AUG-2003 Bug No. 3114787. In procedure process_ivstarpqr even if a sigle record fails then all
7346 the processing is rolled back.
7347 smaddali 3-sep-03 Bug No: 3122898. 1. making successful record_status = L ,
7348 2. Making error_code = 2001 for successful records with error in one qualification
7349 3. For *P marvin records making eblresult = grade1 + grade2
7350 ******************************************************************/
7351
7352 -- get the records from interface tables where status is NEW.
7353 CURSOR new_ivstarpqr_cur (cp_appno igs_uc_istrpqr_ints.appno%TYPE) IS
7354 SELECT ivpqr.rowid,
7355 ivpqr.*
7356 FROM igs_uc_istrpqr_ints ivpqr
7357 WHERE ivpqr.record_status = 'N'
7358 AND ivpqr.appno = cp_appno ;
7359
7360
7361
7362 -- check for corresponding record in main table.
7363 CURSOR old_starpqr_cur(p_appno igs_uc_app_results.app_no%TYPE,
7364 p_sub_id igs_uc_app_results.subject_id%TYPE) IS
7365 SELECT uapr.rowid,
7366 uapr.*
7367 FROM igs_uc_app_results uapr
7368 WHERE uapr.app_no = p_appno
7369 AND uapr.subject_id = p_sub_id;
7370
7371
7372 -- get the system and app_id for the Application from UCAS Applicants table.
7373 CURSOR get_appl_dets (p_appno igs_uc_applicants.app_no%TYPE) IS
7374 SELECT app_id,
7375 system_code
7376 FROM igs_uc_applicants
7377 WHERE app_no = p_appno;
7378
7379 -- get the unique list of appno that would be processed
7380 CURSOR new_appl_cur IS
7381 SELECT DISTINCT appno
7382 FROM igs_uc_istrpqr_ints
7383 WHERE record_status = 'N';
7384
7385 -- get all the records for an applicant
7386 CURSOR get_appno_cur(cp_appno igs_uc_app_results.app_no%TYPE) IS
7387 SELECT rowid
7388 FROM igs_uc_app_results
7389 WHERE app_no = cp_appno;
7390
7391 CURSOR validate_subject (p_subject igs_uc_app_results.subject_id%TYPE) IS
7392 SELECT rowid
7393 ,subject_id
7394 ,year
7395 ,sitting
7396 ,awarding_body
7397 ,external_ref
7398 ,exam_level
7399 ,title
7400 ,subject_code
7401 ,imported
7402 FROM igs_uc_com_ebl_subj
7403 WHERE subject_id = p_subject;
7404
7405
7406 -- For data coming from Marvin INterface
7407 CURSOR c_map_exam_ebl(cp_exam_board_code IGS_UC_MAP_EBL_QUAL.exam_board_code%TYPE ,
7408 cp_ebl_code IGS_UC_MAP_EBL_QUAL.ebl_format%TYPE ) IS
7409 SELECT exam_level ,
7410 awarding_body,
7411 conv_ebl_format
7412 FROM igs_uc_map_ebl_qual
7413 WHERE exam_board_code = cp_exam_board_code
7414 AND ebl_format = cp_ebl_code
7415 AND closed_ind = 'N' ;
7416
7417 c_map_exam_ebl_rec c_map_exam_ebl%ROWTYPE ;
7418
7419
7420 -- For deriving subject ID For data coming from Marvin INterface
7421 CURSOR c_subjectid ( cp_year Igs_uc_com_ebl_subj.year%TYPE ,
7422 cp_sitting Igs_uc_com_ebl_subj.sitting%TYPE ,
7423 cp_awarding_body Igs_uc_com_ebl_subj.awarding_body%TYPE ,
7424 cp_exam_level Igs_uc_com_ebl_subj.exam_level%TYPE ,
7425 cp_ebl_subject Igs_uc_com_ebl_subj.subject_code%TYPE ) IS
7426 SELECT ebl.subject_id
7427 FROM Igs_uc_com_ebl_subj ebl , igs_uc_ref_subj ref
7428 WHERE ebl.subject_code = ref.subj_code
7429 AND ebl.year = cp_year
7430 AND ebl.sitting = cp_sitting
7431 AND ebl.awarding_body = cp_awarding_body
7432 AND ebl.exam_level = cp_exam_level
7433 AND ref.ebl_subj = cp_ebl_subject
7434 ORDER BY ebl.external_ref DESC ;
7435
7436 -- variables
7437 appl_det_rec get_appl_dets%ROWTYPE;
7438 old_starpqr_rec old_starpqr_cur%ROWTYPE;
7439 subject_rec validate_subject%ROWTYPE;
7440 l_proc_reqd VARCHAR2(1);
7441 l_gen_ebl_format igs_uc_istrpqr_ints.eblsubject%TYPE;
7442 l_conv_ebl_code igs_uc_istrpqr_ints.eblsubject%TYPE;
7443 l_subjectid igs_uc_istrpqr_ints.subjectid%TYPE;
7444 l_appno_failed BOOLEAN ;
7445 BEGIN
7446
7447 -- initialize variables
7448 g_success_rec_cnt := 0;
7449 g_error_rec_cnt := 0;
7450 g_error_code := NULL;
7451
7452 fnd_message.set_name('IGS','IGS_UC_PROC_VIEW_DATA');
7453 fnd_message.set_token('VIEW', 'IVSTARPQR ON '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
7454 fnd_file.put_line(fnd_file.log, fnd_message.get);
7455
7456 -- Bug No. 3114787. Code added to so that all the records for an applicant get processed or none
7457 -- the processing is rolled back.
7458 -- LOOP through the Applications to be processed
7459 FOR new_appl_rec IN new_appl_cur LOOP
7460
7461 -- initialise flag that this applicant has not failed any validation
7462 l_appno_failed := FALSE;
7463
7464 -- initialise error_code = NULL for all interface records of this applicant in status NEW
7465 UPDATE igs_uc_istrpqr_ints
7466 SET error_code = NULL
7467 WHERE record_status = 'N' AND appno = new_appl_rec.appno ;
7468
7469 -- Delete all the qualification records for the applicant before inserting.
7470 FOR get_appno_rec IN get_appno_cur(new_appl_rec.appno)
7471 LOOP
7472 igs_uc_app_results_pkg.delete_row(get_appno_rec.rowid);
7473 END LOOP;
7474
7475 -- Get all the reocords from interface table with status = 'N'
7476 FOR new_ivstarpqr_rec IN new_ivstarpqr_cur(new_appl_rec.appno)
7477 LOOP
7478
7479 BEGIN
7480 -- initialize record level variables.
7481 g_error_code := NULL;
7482 l_proc_reqd := 'Y';
7483 l_gen_ebl_format := NULL;
7484 l_conv_ebl_code := NULL;
7485 l_subjectid := NULL;
7486
7487 -- log record processing info.
7488 fnd_message.set_name('IGS','IGS_UC_APPNO_SUBJ_PROC');
7489 fnd_message.set_token('APPNO', TO_CHAR(new_ivstarpqr_rec.appno));
7490 fnd_message.set_token('SUBJ', TO_CHAR(new_ivstarpqr_rec.subjectid));
7491 fnd_file.put_line(fnd_file.log, fnd_message.get);
7492
7493 ----------------------------
7494 -- AppNo validation
7495 ----------------------------
7496 -- validate Applicant record details in UCAS Applicants table.
7497 -- This is because record gets inserted into igs_uc_app_choices as part of
7498 -- IVSTARN processing and hence at this stage the record must exist.
7499 validate_applicant (new_ivstarpqr_rec.appno, g_error_code);
7500 -- If applicant exists in uc_applicants table then Proceed
7501
7502 ----------------------------
7503 -- Bug No. 3108657. The year data in COM_EBL table is 4 digits whereas the transaction data coming from UCAS
7504 -- has 2 digits. Hence need to convert 2 digit year to 4 digit year.
7505 -- If the year is between 50 and 99, 1900 is added.
7506 -- If the year is between 00 and 49, 2000 is added.
7507 ----------------------------
7508 IF new_ivstarpqr_rec.yearofexam >= 50 AND new_ivstarpqr_rec.yearofexam <= 99 THEN
7509 new_ivstarpqr_rec.yearofexam := new_ivstarpqr_rec.yearofexam + 1900;
7510 ELSIF new_ivstarpqr_rec.yearofexam >= 0 AND new_ivstarpqr_rec.yearofexam <= 49 THEN
7511 new_ivstarpqr_rec.yearofexam := new_ivstarpqr_rec.yearofexam + 2000;
7512 END IF;
7513
7514
7515 IF g_error_code IS NULL THEN
7516 --------------------------------------------------------------------
7517 -- PROCESSING NEEDED EXCLUSIVELY FOR DATA RCVD FROM MARVIN INTERFACE
7518 -- Records populated through Marvin Interface is identified as it
7519 -- would have a value of 'P' or 'R' in Marvin Type field.
7520 -- For Hercules this field would be NULL.
7521 --------------------------------------------------------------------
7522 IF new_ivstarpqr_rec.marvin_type IS NOT NULL THEN
7523
7524 -- Do not process for '*R' record with Match Ind = 'N'.
7525 IF new_ivstarpqr_rec.Matchind = 'N' AND new_ivstarpqr_rec.marvin_type = 'R' THEN
7526 l_proc_reqd := 'N';
7527 ELSE
7528
7529 -- Get the generic ebl format for the ebl_code given in the flat file
7530 -- It can be in K1N/K2N/K3N/K4N format
7531 l_gen_ebl_format := TRANSLATE(new_ivstarpqr_rec.eblsubject, '0123456789', 'NNNNNNNNNN') ;
7532
7533
7534 IF l_gen_ebl_format = 'KNN' AND SUBSTR(new_ivstarpqr_rec.eblsubject,2,1) IN ('1','2','3','4') THEN
7535 l_gen_ebl_format := 'K' || SUBSTR(new_ivstarpqr_rec.eblsubject,2,1) || 'N' ;
7536
7537 ELSE
7538 -- Else it can be in ANN/NAN/NNA format . If exam board is B/F/E/I/Q/S/Y/Z then take format as
7539 -- XXX because seed data for these exam levels exists only for ebl format XXX
7540 l_gen_ebl_format := TRANSLATE(new_ivstarpqr_rec.eblsubject, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'NNNNNNNNNNAAAAAAAAAAAAAAAAAAAAAAAAAA') ;
7541
7542 IF l_gen_ebl_format NOT IN ('ANN','NAN','NNA') OR new_ivstarpqr_rec.examboard IN ('B','F','E','I','Q','S','Y','Z') THEN
7543 -- If it is not in ANN/NAN/NNA format then take the generic format XXX
7544 l_gen_ebl_format := 'XXX' ;
7545 END IF ;
7546 END IF ;
7547
7548
7549 -- Get the awarding body and exam level corresponding to the exam board code and generic ebl code -- from the seeded table
7550 -- If no seeded record found then log error message and skip this transaction , else continue
7551 c_map_exam_ebl_rec := NULL;
7552 OPEN c_map_exam_ebl (new_ivstarpqr_rec.examboard, l_gen_ebl_format ) ;
7553 FETCH c_map_exam_ebl INTO c_map_exam_ebl_rec ;
7554
7555 IF c_map_exam_ebl%NOTFOUND THEN
7556 CLOSE c_map_exam_ebl ;
7557 g_error_code := '1059';
7558 fnd_message.set_name( 'IGS','IGS_UC_NO_EBL_MAP_REC') ;
7559 fnd_message.set_token ('EXAM_BRD', new_ivstarpqr_rec.examboard) ;
7560 fnd_message.set_token('EBL_CD',l_gen_ebl_format) ;
7561 fnd_file.put_line(fnd_file.LOG,fnd_message.get()) ;
7562
7563 ELSE
7564 -- If mapping seeded record is found then set the correct exam_level in cases where the cursor
7565 -- will fetch more than 1 rows , these cases are exam board A/L/O/N/W and generic ebl code ANN
7566 CLOSE c_map_exam_ebl ;
7567
7568 IF new_ivstarpqr_rec.examboard IN ('A','L','N','O','W') AND l_gen_ebl_format = 'ANN' THEN
7569 IF new_ivstarpqr_rec.marvin_type = 'P' THEN
7570 -- For *P transactions , take the row with exam level = A
7571 c_map_exam_ebl_rec.exam_level := 'A' ;
7572
7573 ELSIF new_ivstarpqr_rec.marvin_type = '*R' THEN
7574
7575 -- For *R transactions depending on grade1 and 2 fields take wither exam level A or AE
7576 IF new_ivstarpqr_rec.grade1 IS NULL AND new_ivstarpqr_rec.grade2 IS NOT NULL THEN
7577 c_map_exam_ebl_rec.exam_level := 'AE' ;
7578 ELSE
7579 c_map_exam_ebl_rec.exam_level := 'A' ;
7580 END IF ;
7581
7582 END IF ;
7583 END IF ;
7584
7585 -- Convert the ebl code from the generic ebl format into ANN format if it is currently in NAN/NNA format
7586 IF l_gen_ebl_format = 'NAN' THEN
7587 l_conv_ebl_code := SUBSTR(new_ivstarpqr_rec.eblsubject,2,1) || SUBSTR(new_ivstarpqr_rec.eblsubject,1,1) || SUBSTR(new_ivstarpqr_rec.eblsubject,3,1) ;
7588
7589 ELSIF l_gen_ebl_format = 'NNA' THEN
7590 l_conv_ebl_code := SUBSTR(new_ivstarpqr_rec.eblsubject,3,1) || SUBSTR(new_ivstarpqr_rec.eblsubject,1,2) ;
7591
7592 ELSE
7593 l_conv_ebl_code := new_ivstarpqr_rec.eblsubject ;
7594 END IF ;
7595
7596 -- Get the subjectid for the awarding_body,year,sitting,ebl_code and exam_level
7597 OPEN c_subjectid(new_ivstarpqr_rec.yearofexam ,
7598 new_ivstarpqr_rec.sitting,
7599 c_map_exam_ebl_rec.awarding_body,
7600 c_map_exam_ebl_rec.exam_level,
7601 l_conv_ebl_code ) ;
7602
7603 FETCH c_subjectid INTO l_subjectid ;
7604
7605 IF c_subjectid%NOTFOUND THEN
7606 -- If no subjectid record found with the combination of passed year , sitting , awarding body,
7607 -- exam_level and ebl_code then modify the awarding body as follows and check if a subjectid exists
7608 -- for this new awarding body
7609 CLOSE c_subjectid ;
7610 IF c_map_exam_ebl_rec.awarding_body = 'X' AND l_gen_ebl_format IN ( 'ANN','NAN','NNA') THEN
7611 c_map_exam_ebl_rec.awarding_body := 'A' ;
7612 ELSIF c_map_exam_ebl_rec.awarding_body = 'U' AND l_gen_ebl_format IN ( 'ANN','NAN','NNA') THEN
7613 c_map_exam_ebl_rec.awarding_body := 'L' ;
7614 ELSIF c_map_exam_ebl_rec.awarding_body = 'V' AND l_gen_ebl_format IN ( 'ANN','NAN','NNA') THEN
7615 c_map_exam_ebl_rec.awarding_body := 'O';
7616 END IF ;
7617
7618 -- Fetch the subjectid with the new awarding body code and if no record found this time also
7619 -- then log error and skip this record
7620 OPEN c_subjectid(new_ivstarpqr_rec.yearofexam,
7621 new_ivstarpqr_rec.sitting,
7622 c_map_exam_ebl_rec.awarding_body,
7623 c_map_exam_ebl_rec.exam_level,
7624 l_conv_ebl_code ) ;
7625
7626 FETCH c_subjectid INTO l_subjectid ;
7627 IF c_subjectid%NOTFOUND THEN
7628 CLOSE c_subjectid ;
7629 g_error_code := '1021'; -- subject not in ebl subject table.
7630
7631 fnd_message.set_name( 'IGS','IGS_UC_NO_EBL_SUBJ_REC') ;
7632 fnd_message.set_token ('YEAR', new_ivstarpqr_rec.yearofexam) ;
7633 fnd_message.set_token('SITTING', new_ivstarpqr_rec.sitting) ;
7634 fnd_message.set_token('AWD_BDY',c_map_exam_ebl_rec.awarding_body) ;
7635 fnd_message.set_token('EXAM_LEVEL',c_map_exam_ebl_rec.exam_level) ;
7636 fnd_message.set_token('EBL_SUBJ',l_conv_ebl_code ) ;
7637 fnd_file.put_line(fnd_file.LOG,fnd_message.get()) ;
7638 ELSE
7639 -- populate subject ID value into Rec so that it can be processed as usual(as a record)
7640 new_ivstarpqr_rec.subjectid := l_subjectid;
7641 CLOSE c_subjectid ;
7642 END IF ;
7643 ELSE
7644 new_ivstarpqr_rec.subjectid := l_subjectid;
7645 CLOSE c_subjectid ;
7646 END IF ;
7647
7648
7649 --Do the further processing only when the Subject ID is available in IGS_UC_COM_EBL_SUBJ table.
7650 IF l_subjectid IS NOT NULL THEN
7651
7652 /************** II) Derive the 3 result fields eblresult, eblamended and claimedresult ***************/
7653 IF new_ivstarpqr_rec.marvin_type = 'P' THEN
7654 -- only eblresult is populated for *P transactions , the fields claimedresult and eblamended
7655 -- are populated as null
7656 new_ivstarpqr_rec.eblresult := new_ivstarpqr_rec.grade1 || new_ivstarpqr_rec.grade2 ;
7657
7658 ELSIF new_ivstarpqr_rec.marvin_type = 'R' THEN
7659
7660 -- For *R transactions all three result fields are derived based on the matchind
7661 IF new_ivstarpqr_rec.matchind IN ( 'F','P','T','U') THEN
7662 -- 1. derive eblresult field to be populated into igs_uc_mv_ivstarpqr table
7663 new_ivstarpqr_rec.eblresult := new_ivstarpqr_rec.grade1 || new_ivstarpqr_rec.grade2;
7664
7665 ELSIF new_ivstarpqr_rec.matchind = 'C' THEN
7666 -- 2. derive eblamended field to be populated into igs_uc_mv_ivstarpqr table
7667 new_ivstarpqr_rec.eblamended := new_ivstarpqr_rec.grade1 || new_ivstarpqr_rec.grade2;
7668
7669 ELSIF new_ivstarpqr_rec.matchind = 'A' THEN
7670 -- 3. derive claimedresult field to be populated into igs_uc_mv_ivstarpqr table
7671 new_ivstarpqr_rec.claimedresult := new_ivstarpqr_rec.grade1 || new_ivstarpqr_rec.grade2;
7672 END IF ;
7673
7674 END IF ; -- end of *p/*r transaction for Marvin Interface.
7675
7676 END IF; --End of l_subjectid IS NOT NULL Check
7677
7678 END IF ; --End of c_map_exam_ebl%NOTFOUND check.
7679
7680 END IF; -- *R transaction with Match Ind check
7681
7682 END IF; -- End of check for Marvin populated record.
7683
7684 END IF; -- error code check
7685 --------------------------------------------------------------------
7686 -- End of processing needed only for records populated from Marvin Interface
7687 --------------------------------------------------------------------
7688
7689
7690 ---- Begin common processing for Hercules and Marvin
7691 IF l_proc_reqd = 'Y' AND g_error_code IS NULL THEN
7692 -- by pass all further processing for this record
7693
7694 -- no mandatory field validations as this is an update
7695 IF new_ivstarpqr_rec.appno IS NULL OR new_ivstarpqr_rec.subjectid IS NULL THEN
7696 g_error_code := '1037';
7697 END IF;
7698
7699 ----------------------------
7700 -- EBL SUBJECT validation
7701 ----------------------------
7702 IF g_error_code IS NULL THEN
7703 -- validate that the Subject ID from UCAS exists in COM EBL Subject table.
7704 subject_rec := NULL;
7705 OPEN validate_subject(new_ivstarpqr_rec.subjectid);
7706 FETCH validate_subject INTO subject_rec;
7707 IF validate_subject%NOTFOUND THEN
7708 g_error_code := '1021'; -- subject not in ebl subject table.
7709 END IF;
7710 CLOSE validate_subject ;
7711 END IF;
7712
7713 ----------------------------
7714 -- MAIN PROCESSING Begins
7715 ----------------------------
7716 IF g_error_code IS NULL THEN
7717
7718 -- Gt Application system and ID - required while inserting
7719 -- Record would always be found otherwise the above validation - Error 1000 would have failed.
7720 appl_det_rec := NULL; -- initialize
7721 OPEN get_appl_dets(new_ivstarpqr_rec.appno);
7722 FETCH get_appl_dets INTO appl_det_rec;
7723 CLOSE get_appl_dets;
7724
7725 -- Check whether corresponding record already exists in main table.
7726 -- If exists then update else insert.
7727 old_starpqr_rec := NULL;
7728 OPEN old_starpqr_cur(new_ivstarpqr_rec.appno, new_ivstarpqr_rec.subjectid);
7729 FETCH old_starpqr_cur INTO old_starpqr_rec;
7730 CLOSE old_starpqr_cur;
7731
7732
7733 IF old_starpqr_rec.rowid IS NULL THEN -- i.e. new record.
7734
7735 BEGIN
7736 -- call the TBH to update the record
7737 igs_uc_app_results_pkg.insert_row (
7738 x_rowid => old_starpqr_rec.rowid
7739 ,x_app_result_id => old_starpqr_rec.app_result_id -- since it would also be NULL when record does not exist.
7740 ,x_app_id => appl_det_rec.app_id
7741 ,x_app_no => new_ivstarpqr_rec.appno
7742 ,x_enquiry_no => NULL
7743 ,x_exam_level => subject_rec.exam_level
7744 ,x_year => subject_rec.year
7745 ,x_sitting => subject_rec.sitting
7746 ,x_award_body => subject_rec.awarding_body
7747 ,x_subject_id => new_ivstarpqr_rec.subjectid
7748 ,x_predicted_result => NULL
7749 ,x_result_in_offer => NULL
7750 ,x_ebl_result => new_ivstarpqr_rec.eblresult
7751 ,x_ebl_amended_result => new_ivstarpqr_rec.eblamended
7752 ,x_claimed_result => new_ivstarpqr_rec.claimedresult
7753 ,x_imported => 'Y'
7754 ,x_mode => 'R'
7755 );
7756
7757 EXCEPTION
7758 WHEN OTHERS THEN
7759 g_error_code := '9999';
7760 fnd_file.put_line(fnd_file.log, SQLERRM);
7761 END;
7762
7763
7764 ELSE -- update
7765
7766 BEGIN
7767
7768 -- call the TBH to update the record
7769 igs_uc_app_results_pkg.update_row (
7770 x_rowid => old_starpqr_rec.rowid
7771 ,x_app_result_id => old_starpqr_rec.app_result_id
7772 ,x_app_id => old_starpqr_rec.app_id
7773 ,x_app_no => old_starpqr_rec.app_no
7774 ,x_enquiry_no => old_starpqr_rec.enquiry_no
7775 ,x_exam_level => old_starpqr_rec.exam_level
7776 ,x_year => old_starpqr_rec.year
7777 ,x_sitting => old_starpqr_rec.sitting
7778 ,x_award_body => old_starpqr_rec.award_body
7779 ,x_subject_id => old_starpqr_rec.subject_id
7780 ,x_predicted_result => old_starpqr_rec.predicted_result
7781 ,x_result_in_offer => old_starpqr_rec.result_in_offer
7782 ,x_ebl_result => new_ivstarpqr_rec.eblresult
7783 ,x_ebl_amended_result => new_ivstarpqr_rec.eblamended
7784 ,x_claimed_result => new_ivstarpqr_rec.claimedresult
7785 ,x_imported => old_starpqr_rec.imported
7786 ,x_mode => 'R'
7787 );
7788
7789 EXCEPTION
7790 WHEN OTHERS THEN
7791 g_error_code := '9998';
7792 END;
7793
7794 END IF; -- insert / update
7795
7796 END IF; -- error code is null , main processing
7797
7798 END IF; -- Check for bypass of record processing
7799
7800 EXCEPTION
7801 WHEN OTHERS THEN
7802 -- catch any unhandled/unexpected errors while processing a record.
7803 -- This would enable processing to continue with subsequent records.
7804
7805 -- Close any Open cursors
7806 IF old_starpqr_cur%ISOPEN THEN
7807 CLOSE old_starpqr_cur;
7808 END IF;
7809
7810 IF get_appl_dets%ISOPEN THEN
7811 CLOSE get_appl_dets;
7812 END IF;
7813
7814 IF validate_subject%ISOPEN THEN
7815 CLOSE validate_subject;
7816 END IF;
7817
7818 IF c_map_exam_ebl%ISOPEN THEN
7819 CLOSE c_map_exam_ebl;
7820 END IF;
7821
7822 IF c_subjectid%ISOPEN THEN
7823 CLOSE c_subjectid;
7824 END IF;
7825
7826 g_error_code := '1055';
7827 fnd_file.put_line(fnd_file.log, SQLERRM);
7828 END;
7829
7830 -- update the interface table rec - record_status if successfully processed or Error Code if any error encountered
7831 -- while processing the record.
7832 IF g_error_code IS NOT NULL THEN
7833 -- set flag that this applicant has failed a validation
7834 l_appno_failed := TRUE;
7835
7836 -- update this record with derived error code
7837 UPDATE igs_uc_istrpqr_ints
7838 SET error_code = g_error_code
7839 WHERE rowid = new_ivstarpqr_rec.rowid ;
7840
7841 -- log error message/meaning.
7842 igs_uc_proc_ucas_data.log_error_msg(g_error_code);
7843
7844 -- update error count
7845 g_error_rec_cnt := g_error_rec_cnt + 1;
7846
7847 ELSE
7848 -- increment success count
7849 g_success_rec_cnt := g_success_rec_cnt + 1; -- count successfully processed records
7850 END IF;
7851
7852 END LOOP; -- inner loop i.e for the applicant
7853
7854 -- smaddali added this logic for bug#3122898
7855 IF l_appno_failed THEN
7856 -- Delete all the qualification records for the applicant before inserting.
7857 FOR get_appno_rec IN get_appno_cur(new_appl_rec.appno)
7858 LOOP
7859 igs_uc_app_results_pkg.delete_row(get_appno_rec.rowid);
7860 END LOOP;
7861
7862 -- update INTS records for this appno which are successful to set error_code=2001
7863 UPDATE igs_uc_istrpqr_ints SET error_code = '2001'
7864 WHERE record_status = 'N' AND appno = new_appl_rec.appno AND error_code IS NULL ;
7865
7866 ELSE
7867 -- update INTS records for this appno which are all successful to set record_status = L
7868 UPDATE igs_uc_istrpqr_ints SET record_status = 'L' , error_code = NULL
7869 WHERE record_status = 'N' AND appno = new_appl_rec.appno ;
7870
7871 END IF ;
7872
7873 END LOOP; -- outer loop - applicant level
7874
7875 COMMIT;
7876 -- log processing complete for this view
7877 igs_uc_proc_ucas_data.log_proc_complete('IVSTARPQR', g_success_rec_cnt, g_error_rec_cnt);
7878
7879 EXCEPTION
7880 WHEN OTHERS THEN
7881 ROLLBACK;
7882 fnd_message.set_name('IGS','IGS_UC_ERROR_PROC_DATA');
7883 fnd_message.set_token('VIEW', 'IVSTARPQR'||' - '||SQLERRM);
7884 fnd_file.put_line(fnd_file.log, fnd_message.get);
7885 END process_ivstarpqr;
7886
7887
7888 END igs_uc_proc_application_data;