118:
119: BEGIN
120:
121: IF (l_debug = 'Y') THEN
122: okc_debug.Set_Indentation('OKC_RENEW_PVT');
123: okc_debug.log('100: Entered Auto_Renew', 2);
124: END IF;
125:
126: retcode := '0';
119: BEGIN
120:
121: IF (l_debug = 'Y') THEN
122: okc_debug.Set_Indentation('OKC_RENEW_PVT');
123: okc_debug.log('100: Entered Auto_Renew', 2);
124: END IF;
125:
126: retcode := '0';
127: fnd_msg_pub.initialize;
133: FOR auto_renew_rec IN cur_auto_renew
134: LOOP
135: l_contract_number := auto_renew_rec.contract_number;
136: IF (l_debug = 'Y') THEN
137: okc_debug.log('200: Contract Number ' || l_contract_number);
138: END IF;
139: If p_chr_id Is Not Null Then
140: l_duration := p_duration;
141: l_timeunit := p_uom_code;
180: p_auto_renew_rec.p_perpetual_flag := OKC_API.G_FALSE;
181:
182: -- FND_FILE.PUT_LINE( FND_FILE.LOG, 'Before Pre_Renew');
183: IF (l_debug = 'Y') THEN
184: okc_debug.log('300: Before Pre_Renew');
185: END IF;
186: OKC_RENEW_PUB.PRE_Renew(p_api_version => 1,
187: p_init_msg_list => OKC_API.G_TRUE,
188: x_return_status => l_return_status,
192: p_renew_in_parameters_rec => p_auto_renew_rec,
193: p_do_commit => OKC_API.G_TRUE ,
194: p_renewal_called_from_ui => p_renewal_called_from_ui);
195: IF (l_debug = 'Y') THEN
196: okc_debug.log('400: After Pre_Renew');
197: END IF;
198:
199: -- FND_FILE.PUT_LINE( FND_FILE.LOG, 'After Pre_Renew');
200: -- FND_FILE.PUT_LINE( FND_FILE.LOG, 'l_return_status ' || l_return_status)
228:
229: END LOOP;
230:
231: IF (l_debug = 'Y') THEN
232: okc_debug.log('800: Leaving Auto_Renew', 2);
233: okc_debug.Reset_Indentation;
234: END IF;
235:
236: EXCEPTION
229: END LOOP;
230:
231: IF (l_debug = 'Y') THEN
232: okc_debug.log('800: Leaving Auto_Renew', 2);
233: okc_debug.Reset_Indentation;
234: END IF;
235:
236: EXCEPTION
237: WHEN G_EXCEPTION_HALT_VALIDATION THEN
236: EXCEPTION
237: WHEN G_EXCEPTION_HALT_VALIDATION THEN
238:
239: IF (l_debug = 'Y') THEN
240: okc_debug.log('500: Exiting Auto_Renew:G_EXCEPTION_HALT_VALIDATION Exception', 2);
241: okc_debug.Reset_Indentation;
242: END IF;
243:
244: retcode := '2';
237: WHEN G_EXCEPTION_HALT_VALIDATION THEN
238:
239: IF (l_debug = 'Y') THEN
240: okc_debug.log('500: Exiting Auto_Renew:G_EXCEPTION_HALT_VALIDATION Exception', 2);
241: okc_debug.Reset_Indentation;
242: END IF;
243:
244: retcode := '2';
245:
253:
254: WHEN OTHERS THEN
255:
256: IF (l_debug = 'Y') THEN
257: okc_debug.log('700: Exiting Auto_Renew:OTHERS Exception', 2);
258: okc_debug.Reset_Indentation;
259: END IF;
260:
261: retcode := '2';
254: WHEN OTHERS THEN
255:
256: IF (l_debug = 'Y') THEN
257: okc_debug.log('700: Exiting Auto_Renew:OTHERS Exception', 2);
258: okc_debug.Reset_Indentation;
259: END IF;
260:
261: retcode := '2';
262: OKC_API.set_message(p_app_name => g_app_name,
315:
316: BEGIN
317:
318: IF (l_debug = 'Y') THEN
319: okc_debug.Set_Indentation('OKC_RENEW_PVT');
320: okc_debug.log('900: Entered is_renew_allowed', 2);
321: END IF;
322:
323: OPEN c_chr;
316: BEGIN
317:
318: IF (l_debug = 'Y') THEN
319: okc_debug.Set_Indentation('OKC_RENEW_PVT');
320: okc_debug.log('900: Entered is_renew_allowed', 2);
321: END IF;
322:
323: OPEN c_chr;
324: FETCH c_chr INTO l_code,l_template_yn,l_app_id,l_scs_code,l_k,l_mod,
330: END IF;
331:
332: IF l_template_yn = 'Y' then
333: IF (l_debug = 'Y') THEN
334: okc_debug.log('1000: Templates non-renewable !!');
335: END IF;
336: OKC_API.set_message(p_app_name => g_app_name,
337: p_msg_name => 'OKC_K_TEMPLATE',
338: p_token1 => 'NUMBER',
338: p_token1 => 'NUMBER',
339: p_token1_value => l_k);
340:
341: IF (l_debug = 'Y') THEN
342: okc_debug.log('1010: Leaving is_renew_allowed ', 2);
343: okc_debug.Reset_Indentation;
344: END IF;
345: RETURN(FALSE);
346: END IF;
339: p_token1_value => l_k);
340:
341: IF (l_debug = 'Y') THEN
342: okc_debug.log('1010: Leaving is_renew_allowed ', 2);
343: okc_debug.Reset_Indentation;
344: END IF;
345: RETURN(FALSE);
346: END IF;
347:
347:
348: -- A perpetual cannot be renewed further !!
349: IF l_end_date Is Null then
350: IF (l_debug = 'Y') THEN
351: okc_debug.log('1011: Perpetual Contracts non-renewable !!');
352: END IF;
353: OKC_API.set_message(p_app_name => g_app_name,
354: p_msg_name => 'OKC_NO_PERPETUAL',
355: p_token1 => 'component',
354: p_msg_name => 'OKC_NO_PERPETUAL',
355: p_token1 => 'component',
356: p_token1_value => l_k);
357: IF (l_debug = 'Y') THEN
358: okc_debug.log('1012: Leaving is_renew_allowed ', 2);
359: okc_debug.Reset_Indentation;
360: END IF;
361: RETURN(FALSE);
362: END IF;
355: p_token1 => 'component',
356: p_token1_value => l_k);
357: IF (l_debug = 'Y') THEN
358: okc_debug.log('1012: Leaving is_renew_allowed ', 2);
359: okc_debug.Reset_Indentation;
360: END IF;
361: RETURN(FALSE);
362: END IF;
363:
367:
368: --Bug 3431436 Future terminated contracts are non-renewable
369: IF (l_status in ('ACTIVE','EXPIRED','SIGNED') and l_date_terminated is not null)then
370: IF (l_debug = 'Y') THEN
371: okc_debug.log('1013: Future Terminated Contracts non-renewable !!');
372: END IF;
373: OKC_API.set_message(p_app_name => g_app_name,
374: p_msg_name => 'OKC_FUTURE_TERMINATED_K',
375: p_token1 => 'NUMBER',
374: p_msg_name => 'OKC_FUTURE_TERMINATED_K',
375: p_token1 => 'NUMBER',
376: p_token1_value => l_k );
377: IF (l_debug = 'Y') THEN
378: okc_debug.log('1014: Leaving is_renew_allowed ', 2);
379: okc_debug.Reset_Indentation;
380: END IF;
381: return(false);
382: END IF;
375: p_token1 => 'NUMBER',
376: p_token1_value => l_k );
377: IF (l_debug = 'Y') THEN
378: okc_debug.log('1014: Leaving is_renew_allowed ', 2);
379: okc_debug.Reset_Indentation;
380: END IF;
381: return(false);
382: END IF;
383:
384: If okc_util.Get_All_K_Access_Level(p_application_id => l_app_id,
385: p_chr_id => p_chr_id,
386: p_scs_code => l_scs_code) <> 'U' Then
387: IF (l_debug = 'Y') THEN
388: okc_debug.log('1015: Secured Contracts non-renewable !!');
389: END IF;
390: OKC_API.set_message(p_app_name => g_app_name,
391: p_msg_name => 'OKC_NO_UPDATE',
392: p_token1 => 'CHR',
391: p_msg_name => 'OKC_NO_UPDATE',
392: p_token1 => 'CHR',
393: p_token1_value => l_k);
394: IF (l_debug = 'Y') THEN
395: okc_debug.log('1016: Leaving is_renew_allowed ', 2);
396: okc_debug.Reset_Indentation;
397: END IF;
398: Return(FALSE);
399: End If;
392: p_token1 => 'CHR',
393: p_token1_value => l_k);
394: IF (l_debug = 'Y') THEN
395: okc_debug.log('1016: Leaving is_renew_allowed ', 2);
396: okc_debug.Reset_Indentation;
397: END IF;
398: Return(FALSE);
399: End If;
400:
403: --CLOSE c_sts;
404:
405: -- commenting for Bug 3118707
406: -- IF l_sts_code IN ('ACTIVE','EXPIRED','SIGNED') then
407: --okc_debug.log('1017: Leaving is_renew_allowed ', 2);
408: --okc_debug.Reset_Indentation;
409: -- return(TRUE);
410:
411:
404:
405: -- commenting for Bug 3118707
406: -- IF l_sts_code IN ('ACTIVE','EXPIRED','SIGNED') then
407: --okc_debug.log('1017: Leaving is_renew_allowed ', 2);
408: --okc_debug.Reset_Indentation;
409: -- return(TRUE);
410:
411:
412: -- invoke OKS procedure to check renew eligibility for service class
427: IF x_rnrl_rec.renewal_type = 'DNR' THEN
428: OKC_API.set_message(
429: G_APP_NAME,
430: G_DNR_MSG);
431: okc_debug.log('1000: Leaving is_renew_allowed ', 2);
432: okc_debug.Reset_Indentation;
433: return(FALSE);
434: End If;
435: IF (OKC_OKS_PUB.Is_Renew_Allowed(p_chr_id => p_chr_id,
428: OKC_API.set_message(
429: G_APP_NAME,
430: G_DNR_MSG);
431: okc_debug.log('1000: Leaving is_renew_allowed ', 2);
432: okc_debug.Reset_Indentation;
433: return(FALSE);
434: End If;
435: IF (OKC_OKS_PUB.Is_Renew_Allowed(p_chr_id => p_chr_id,
436: x_return_status => l_return_status)) Then
434: End If;
435: IF (OKC_OKS_PUB.Is_Renew_Allowed(p_chr_id => p_chr_id,
436: x_return_status => l_return_status)) Then
437: IF (l_debug = 'Y') THEN
438: okc_debug.log('1018: Leaving is_renew_allowed ', 2);
439: okc_debug.Reset_Indentation;
440: END IF;
441: return(TRUE);
442: ELSE
435: IF (OKC_OKS_PUB.Is_Renew_Allowed(p_chr_id => p_chr_id,
436: x_return_status => l_return_status)) Then
437: IF (l_debug = 'Y') THEN
438: okc_debug.log('1018: Leaving is_renew_allowed ', 2);
439: okc_debug.Reset_Indentation;
440: END IF;
441: return(TRUE);
442: ELSE
443: -- Bug 3280617
446: p_token1 => 'component',
447: p_token1_value => l_k);*/
448:
449: IF (l_debug = 'Y') THEN
450: okc_debug.log('1000: Leaving is_renew_allowed ', 2);
451: okc_debug.Reset_Indentation;
452: END IF;
453: return(FALSE);
454: END IF;
447: p_token1_value => l_k);*/
448:
449: IF (l_debug = 'Y') THEN
450: okc_debug.log('1000: Leaving is_renew_allowed ', 2);
451: okc_debug.Reset_Indentation;
452: END IF;
453: return(FALSE);
454: END IF;
455:
515:
516: BEGIN
517:
518: IF (l_debug = 'Y') THEN
519: okc_debug.Set_Indentation('OKC_RENEW_PVT');
520: okc_debug.log('1400: Entered VALIDATE', 2);
521: END IF;
522:
523: okc_api.init_msg_list(p_init_msg_list);
516: BEGIN
517:
518: IF (l_debug = 'Y') THEN
519: okc_debug.Set_Indentation('OKC_RENEW_PVT');
520: okc_debug.log('1400: Entered VALIDATE', 2);
521: END IF;
522:
523: okc_api.init_msg_list(p_init_msg_list);
524:
713: END IF; -- end p_context = G_miss_char
714: */
715:
716: IF (l_debug = 'Y') THEN
717: okc_debug.log('1500: Leaving VALIDATE', 2);
718: okc_debug.Reset_Indentation;
719: END IF;
720:
721: EXCEPTION
714: */
715:
716: IF (l_debug = 'Y') THEN
717: okc_debug.log('1500: Leaving VALIDATE', 2);
718: okc_debug.Reset_Indentation;
719: END IF;
720:
721: EXCEPTION
722: WHEN G_EXCEPTION_HALT_VALIDATION THEN
721: EXCEPTION
722: WHEN G_EXCEPTION_HALT_VALIDATION THEN
723:
724: IF (l_debug = 'Y') THEN
725: okc_debug.log('1600: Exiting VALIDATE:G_EXCEPTION_HALT_VALIDATION Exception', 2);
726: okc_debug.Reset_Indentation;
727: END IF;
728:
729: IF (l_debug = 'Y') THEN
722: WHEN G_EXCEPTION_HALT_VALIDATION THEN
723:
724: IF (l_debug = 'Y') THEN
725: okc_debug.log('1600: Exiting VALIDATE:G_EXCEPTION_HALT_VALIDATION Exception', 2);
726: okc_debug.Reset_Indentation;
727: END IF;
728:
729: IF (l_debug = 'Y') THEN
730: okc_debug.Reset_Indentation;
726: okc_debug.Reset_Indentation;
727: END IF;
728:
729: IF (l_debug = 'Y') THEN
730: okc_debug.Reset_Indentation;
731: END IF;
732:
733: -- NULL;
734: WHEN OTHERS THEN
733: -- NULL;
734: WHEN OTHERS THEN
735:
736: IF (l_debug = 'Y') THEN
737: okc_debug.log('1700: Exiting VALIDATE:OTHERS Exception', 2);
738: okc_debug.Reset_Indentation;
739: END IF;
740:
741: OKC_API.set_message(p_app_name => g_app_name,
734: WHEN OTHERS THEN
735:
736: IF (l_debug = 'Y') THEN
737: okc_debug.log('1700: Exiting VALIDATE:OTHERS Exception', 2);
738: okc_debug.Reset_Indentation;
739: END IF;
740:
741: OKC_API.set_message(p_app_name => g_app_name,
742: p_msg_name => g_unexpected_error,
852: -- AND chr_or_cle='CLE'; -- need to check if this is needed.
853:
854: Begin
855:
856: -- okc_debug.Set_Indentation('get_date_rec');
857: -- okc_debug.log('1800: Entered get_date_rec', 2);
858:
859: l_rec.id:=OKC_API.G_MISS_NUM;
860:
853:
854: Begin
855:
856: -- okc_debug.Set_Indentation('get_date_rec');
857: -- okc_debug.log('1800: Entered get_date_rec', 2);
858:
859: l_rec.id:=OKC_API.G_MISS_NUM;
860:
861: OPEN c_get_date_rec(p_id);
872: i BINARY_INTEGER;
873: l_api_name Varchar2(30) := 'get_tve_rec';
874: Begin
875:
876: -- okc_debug.Set_Indentation('get_tve_rec');
877: -- okc_debug.log('2000: Entered get_tve_rec', 2);
878:
879: l_rec.id:=OKC_API.G_MISS_NUM;
880: If g_time_tbl.count >0 then
873: l_api_name Varchar2(30) := 'get_tve_rec';
874: Begin
875:
876: -- okc_debug.Set_Indentation('get_tve_rec');
877: -- okc_debug.log('2000: Entered get_tve_rec', 2);
878:
879: l_rec.id:=OKC_API.G_MISS_NUM;
880: If g_time_tbl.count >0 then
881: i:=g_time_tbl.first;
880: If g_time_tbl.count >0 then
881: i:=g_time_tbl.first;
882: LOOP
883: If g_time_tbl(i).id=p_tve_id then
884: -- okc_debug.log('2100: Exiting get_tve_rec', 2);
885:
886: return g_time_tbl(i);
887: END IF;
888: Exit when i=g_time_tbl.last;
889: i:=g_time_tbl.next(i);
890: END LOOP;
891: END IF;
892:
893: -- okc_debug.log('1860: Leaving Function Get_TVE_Rec ', 2);
894: -- okc_debug.Reset_Indentation;
895:
896: return l_rec;
897: END;
890: END LOOP;
891: END IF;
892:
893: -- okc_debug.log('1860: Leaving Function Get_TVE_Rec ', 2);
894: -- okc_debug.Reset_Indentation;
895:
896: return l_rec;
897: END;
898:
912: l_new_end_date date :=OKC_API.G_MISS_DATE;
913: l_api_name Varchar2(30) := 'check_ia';
914: BEGIN
915:
916: -- okc_debug.Set_Indentation('check_ia');
917: -- okc_debug.log('2200: Entered check_ia', 2);
918:
919: --get dates
920: l_orig_start_date:=p_date_rec.orig_start_date;
913: l_api_name Varchar2(30) := 'check_ia';
914: BEGIN
915:
916: -- okc_debug.Set_Indentation('check_ia');
917: -- okc_debug.log('2200: Entered check_ia', 2);
918:
919: --get dates
920: l_orig_start_date:=p_date_rec.orig_start_date;
921: l_orig_end_date:=p_date_rec.orig_end_date;
931: l_isev_ext_rec_type.object_version_number:=p_obj_no;
932: l_isev_ext_rec_type.start_date:=l_new_start_date;
933: l_isev_ext_rec_type.end_date:=l_new_end_date;
934: --san comment update the ia
935: -- okc_debug.log('2300: Before update_ia_startend');
936: OKC_TIME_PUB.UPDATE_IA_STARTEND(
937: p_api_version=> p_api_version,
938: p_init_msg_list=> okc_api.g_false,
939: x_return_status=> l_return_status,
940: x_msg_count=> x_msg_count,
941: x_msg_data=> x_msg_data,
942: p_isev_ext_rec=> l_isev_ext_rec_type,
943: x_isev_ext_rec=> i_isev_ext_rec_type) ;
944: -- okc_debug.log('2400: After update_ia_startend');
945: IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
946: RAISE l_exception_stop;
947: END IF;
948:
953: to_char(l_new_start_date,'DD-MM-YYYY HH24:MI:SS'));
954: l_rulv_rec.comments := replace(l_rulv_rec.comments,
955: to_char(l_orig_end_date,'DD-MM-YYYY HH24:MI:SS'),
956: to_char(l_new_end_date,'DD-MM-YYYY HH24:MI:SS'));
957: -- okc_debug.log('2500: Before update_rule');
958: OKC_RULE_PUB.UPDATE_RULE( p_api_version => 1,
959: p_init_msg_list => OKC_API.G_FALSE,
960: x_return_status => l_return_status,
961: x_msg_count => x_msg_count,
962: x_msg_data => x_msg_data,
963: p_rulv_rec => l_rulv_rec,
964: x_rulv_rec => i_rulv_rec
965: );
966: -- okc_debug.log('2600: After update_rule');
967: IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
968: RAISE l_exception_stop;
969: END IF;
970: else
972: null;
973: end if;
974: END IF;
975:
976: -- okc_debug.log('2700: Leaving check_ia', 2);
977: -- okc_debug.Reset_Indentation;
978:
979: return l_return_status;
980:
973: end if;
974: END IF;
975:
976: -- okc_debug.log('2700: Leaving check_ia', 2);
977: -- okc_debug.Reset_Indentation;
978:
979: return l_return_status;
980:
981: EXCEPTION
980:
981: EXCEPTION
982: WHEN l_exception_stop then
983:
984: -- okc_debug.log('2800: Exiting check_ia:l_exception_stop Exception', 2);
985: -- okc_debug.Reset_Indentation;
986:
987: return l_return_status;
988: when others then
981: EXCEPTION
982: WHEN l_exception_stop then
983:
984: -- okc_debug.log('2800: Exiting check_ia:l_exception_stop Exception', 2);
985: -- okc_debug.Reset_Indentation;
986:
987: return l_return_status;
988: when others then
989:
986:
987: return l_return_status;
988: when others then
989:
990: -- okc_debug.log('2900: Exiting check_ia:others Exception', 2);
991: -- okc_debug.Reset_Indentation;
992:
993: OKC_API.set_message(p_app_name => g_app_name,
994: p_msg_name => g_unexpected_error,
987: return l_return_status;
988: when others then
989:
990: -- okc_debug.log('2900: Exiting check_ia:others Exception', 2);
991: -- okc_debug.Reset_Indentation;
992:
993: OKC_API.set_message(p_app_name => g_app_name,
994: p_msg_name => g_unexpected_error,
995: p_token1 => g_sqlcode_token,
1003: END check_ia;
1004: BEGIN
1005:
1006: IF (l_debug = 'Y') THEN
1007: okc_debug.Set_Indentation('Update_Rules');
1008: okc_debug.log('3000: Entered Update_Rules', 2);
1009: END IF;
1010:
1011: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1004: BEGIN
1005:
1006: IF (l_debug = 'Y') THEN
1007: okc_debug.Set_Indentation('Update_Rules');
1008: okc_debug.log('3000: Entered Update_Rules', 2);
1009: END IF;
1010:
1011: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1012:
1032: END IF;
1033:
1034: --for all the rules defined for the contract
1035: IF (l_debug = 'Y') THEN
1036: okc_debug.log('3100: Before cur_rules Cursor');
1037: END IF;
1038: FOR rule_rec in cur_rules(p_chr_id) loop
1039: IF (l_debug = 'Y') THEN
1040: okc_debug.set_trace_off;
1036: okc_debug.log('3100: Before cur_rules Cursor');
1037: END IF;
1038: FOR rule_rec in cur_rules(p_chr_id) loop
1039: IF (l_debug = 'Y') THEN
1040: okc_debug.set_trace_off;
1041: okc_debug.log('3200: Before get_date_rec');
1042: END IF;
1043: l_cle_dates_rec:=get_date_rec(rule_rec.parent_id);
1044: -- okc_debug.log('3300: After get_date_rec');
1037: END IF;
1038: FOR rule_rec in cur_rules(p_chr_id) loop
1039: IF (l_debug = 'Y') THEN
1040: okc_debug.set_trace_off;
1041: okc_debug.log('3200: Before get_date_rec');
1042: END IF;
1043: l_cle_dates_rec:=get_date_rec(rule_rec.parent_id);
1044: -- okc_debug.log('3300: After get_date_rec');
1045: IF l_cle_dates_rec.id <> OKC_API.G_MISS_NUM then
1040: okc_debug.set_trace_off;
1041: okc_debug.log('3200: Before get_date_rec');
1042: END IF;
1043: l_cle_dates_rec:=get_date_rec(rule_rec.parent_id);
1044: -- okc_debug.log('3300: After get_date_rec');
1045: IF l_cle_dates_rec.id <> OKC_API.G_MISS_NUM then
1046:
1047: okc_renew_pvt.g_rulv_rec.id := rule_rec.id;
1048: okc_renew_pvt.g_rulv_rec.object_version_number := rule_rec.object_version_number;
1050: -- /striping/
1051: p_appl_id := okc_rld_pvt.get_appl_id(rule_rec.rule_information_category);
1052: p_dff_name := okc_rld_pvt.get_dff_name(rule_rec.rule_information_category);
1053:
1054: -- okc_debug.log('3400: Before get_dff_column_values');
1055: -- okc_time_util_pub.get_dff_column_values( p_app_id => 510, -- /striping/
1056: okc_time_util_pub.get_dff_column_values( p_app_id => p_appl_id,
1057: -- p_dff_name => 'OKC Rule Developer DF', -- /striping/
1058: p_dff_name => p_dff_name,
1061: p_rule_id => rule_rec.id,
1062: p_col_vals => l_col_vals,
1063: p_no_of_cols => l_no_of_cols );
1064: IF (l_debug = 'Y') THEN
1065: okc_debug.set_trace_off;
1066: END IF;
1067: -- okc_debug.log('3500: After get_dff_column_values');
1068:
1069: if nvl(l_no_of_cols,0) >= 1 then
1063: p_no_of_cols => l_no_of_cols );
1064: IF (l_debug = 'Y') THEN
1065: okc_debug.set_trace_off;
1066: END IF;
1067: -- okc_debug.log('3500: After get_dff_column_values');
1068:
1069: if nvl(l_no_of_cols,0) >= 1 then
1070:
1071: --san comment disable the rule here later
1075: -- /striping/
1076: p_appl_id := okc_rld_pvt.get_appl_id(rule_rec.rule_information_category);
1077: p_dff_name := okc_rld_pvt.get_dff_name(rule_rec.rule_information_category);
1078:
1079: -- okc_debug.log('3600: Before get_dff_column_values');
1080: -- okc_time_util_pub.get_dff_column_values( p_app_id => 510, -- /striping/
1081: okc_time_util_pub.get_dff_column_values( p_app_id => p_appl_id,
1082: -- p_dff_name => 'OKC Rule Developer DF', -- /striping/
1083: p_dff_name => p_dff_name,
1086: p_rule_id => rule_rec.id,
1087: p_col_vals => l_col_vals,
1088: p_no_of_cols => l_no_of_cols );
1089: IF (l_debug = 'Y') THEN
1090: okc_debug.set_trace_off;
1091: END IF;
1092: -- okc_debug.log('3700: After get_dff_column_values');
1093: if nvl(l_no_of_cols,0) >= 1 then
1094:
1088: p_no_of_cols => l_no_of_cols );
1089: IF (l_debug = 'Y') THEN
1090: okc_debug.set_trace_off;
1091: END IF;
1092: -- okc_debug.log('3700: After get_dff_column_values');
1093: if nvl(l_no_of_cols,0) >= 1 then
1094:
1095: -- Implies that there are some rule attribute categories for the rule which have time values
1096: -- okc_debug.log('3800: Before For Loop');
1092: -- okc_debug.log('3700: After get_dff_column_values');
1093: if nvl(l_no_of_cols,0) >= 1 then
1094:
1095: -- Implies that there are some rule attribute categories for the rule which have time values
1096: -- okc_debug.log('3800: Before For Loop');
1097: for i in l_col_vals.first..l_col_vals.last
1098: loop
1099: if l_col_vals.exists(i) then
1100: tve_rec:=get_tve_rec(l_col_vals(i).col_value);
1127: END IF; --tve_type
1128: END IF; -- tve_rec is OKC_API.G_MISS_NUM
1129: END IF; -- if col_vals exists
1130: END loop;
1131: -- okc_debug.log('3900: After For Loop');
1132: END IF; -- if col_vals>=1
1133: -- okc_debug.log('4000: After EndIf');
1134: END IF; -- id not found in dates_rec table
1135: -- okc_debug.log('41000: After EndIf');
1129: END IF; -- if col_vals exists
1130: END loop;
1131: -- okc_debug.log('3900: After For Loop');
1132: END IF; -- if col_vals>=1
1133: -- okc_debug.log('4000: After EndIf');
1134: END IF; -- id not found in dates_rec table
1135: -- okc_debug.log('41000: After EndIf');
1136: END loop;
1137: IF (l_debug = 'Y') THEN
1131: -- okc_debug.log('3900: After For Loop');
1132: END IF; -- if col_vals>=1
1133: -- okc_debug.log('4000: After EndIf');
1134: END IF; -- id not found in dates_rec table
1135: -- okc_debug.log('41000: After EndIf');
1136: END loop;
1137: IF (l_debug = 'Y') THEN
1138: okc_debug.set_trace_on;
1139: okc_debug.log('4200: After cur_rules Cursor');
1134: END IF; -- id not found in dates_rec table
1135: -- okc_debug.log('41000: After EndIf');
1136: END loop;
1137: IF (l_debug = 'Y') THEN
1138: okc_debug.set_trace_on;
1139: okc_debug.log('4200: After cur_rules Cursor');
1140: END IF;
1141: --reset the dates table
1142: -- g_cle_dates_tbl.delete;
1135: -- okc_debug.log('41000: After EndIf');
1136: END loop;
1137: IF (l_debug = 'Y') THEN
1138: okc_debug.set_trace_on;
1139: okc_debug.log('4200: After cur_rules Cursor');
1140: END IF;
1141: --reset the dates table
1142: -- g_cle_dates_tbl.delete;
1143:
1143:
1144: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1145:
1146: IF (l_debug = 'Y') THEN
1147: okc_debug.log('4300: Leaving Update_Rules', 2);
1148: okc_debug.Reset_Indentation;
1149: END IF;
1150:
1151: EXCEPTION
1144: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1145:
1146: IF (l_debug = 'Y') THEN
1147: okc_debug.log('4300: Leaving Update_Rules', 2);
1148: okc_debug.Reset_Indentation;
1149: END IF;
1150:
1151: EXCEPTION
1152: WHEN E_Resource_Busy THEN
1150:
1151: EXCEPTION
1152: WHEN E_Resource_Busy THEN
1153: IF (l_debug = 'Y') THEN
1154: okc_debug.set_trace_on;
1155: okc_debug.log('4400: Exiting Update_Rules:E_Resource_Busy Exception', 2);
1156: okc_debug.Reset_Indentation;
1157: END IF;
1158:
1151: EXCEPTION
1152: WHEN E_Resource_Busy THEN
1153: IF (l_debug = 'Y') THEN
1154: okc_debug.set_trace_on;
1155: okc_debug.log('4400: Exiting Update_Rules:E_Resource_Busy Exception', 2);
1156: okc_debug.Reset_Indentation;
1157: END IF;
1158:
1159:
1152: WHEN E_Resource_Busy THEN
1153: IF (l_debug = 'Y') THEN
1154: okc_debug.set_trace_on;
1155: okc_debug.log('4400: Exiting Update_Rules:E_Resource_Busy Exception', 2);
1156: okc_debug.Reset_Indentation;
1157: END IF;
1158:
1159:
1160: IF (cur_time_values%ISOPEN) THEN
1166: RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
1167:
1168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1169: IF (l_debug = 'Y') THEN
1170: okc_debug.set_trace_on;
1171: okc_debug.log('4500: Exiting Update_Rules:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1172: okc_debug.Reset_Indentation;
1173: END IF;
1174:
1167:
1168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1169: IF (l_debug = 'Y') THEN
1170: okc_debug.set_trace_on;
1171: okc_debug.log('4500: Exiting Update_Rules:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1172: okc_debug.Reset_Indentation;
1173: END IF;
1174:
1175: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1168: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1169: IF (l_debug = 'Y') THEN
1170: okc_debug.set_trace_on;
1171: okc_debug.log('4500: Exiting Update_Rules:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1172: okc_debug.Reset_Indentation;
1173: END IF;
1174:
1175: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1176: (l_api_name,
1181: '_PROCESS');
1182:
1183: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1184: IF (l_debug = 'Y') THEN
1185: okc_debug.set_trace_on;
1186: okc_debug.log('4600: Exiting Update_Rules:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1187: okc_debug.Reset_Indentation;
1188: END IF;
1189:
1182:
1183: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1184: IF (l_debug = 'Y') THEN
1185: okc_debug.set_trace_on;
1186: okc_debug.log('4600: Exiting Update_Rules:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1187: okc_debug.Reset_Indentation;
1188: END IF;
1189:
1190: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1183: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1184: IF (l_debug = 'Y') THEN
1185: okc_debug.set_trace_on;
1186: okc_debug.log('4600: Exiting Update_Rules:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1187: okc_debug.Reset_Indentation;
1188: END IF;
1189:
1190: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1191: (l_api_name,
1196: '_PROCESS');
1197:
1198: WHEN OTHERS THEN
1199: IF (l_debug = 'Y') THEN
1200: okc_debug.set_trace_on;
1201: okc_debug.log('4700: Exiting Update_Rules:OTHERS Exception', 2);
1202: okc_debug.Reset_Indentation;
1203: END IF;
1204:
1197:
1198: WHEN OTHERS THEN
1199: IF (l_debug = 'Y') THEN
1200: okc_debug.set_trace_on;
1201: okc_debug.log('4700: Exiting Update_Rules:OTHERS Exception', 2);
1202: okc_debug.Reset_Indentation;
1203: END IF;
1204:
1205: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1198: WHEN OTHERS THEN
1199: IF (l_debug = 'Y') THEN
1200: okc_debug.set_trace_on;
1201: okc_debug.log('4700: Exiting Update_Rules:OTHERS Exception', 2);
1202: okc_debug.Reset_Indentation;
1203: END IF;
1204:
1205: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1206: (l_api_name,
1244: l_uom_code okx_units_of_measure_v.uom_code%type;
1245: BEGIN
1246:
1247: IF (l_debug = 'Y') THEN
1248: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1249: okc_debug.log('4800: Entered update_condition_headers', 2);
1250: END IF;
1251:
1252: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1245: BEGIN
1246:
1247: IF (l_debug = 'Y') THEN
1248: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1249: okc_debug.log('4800: Entered update_condition_headers', 2);
1250: END IF;
1251:
1252: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1253:
1262: raise OKC_API.G_EXCEPTION_ERROR;
1263: END IF;
1264:
1265: IF (l_debug = 'Y') THEN
1266: okc_debug.log('4900: Before cur_condition_headers Cursor');
1267: END IF;
1268: FOR conditions_rec in cur_condition_headers loop
1269:
1270: l_cnh_rec.id := conditions_rec.id;
1292: END if;
1293:
1294:
1295: IF (l_debug = 'Y') THEN
1296: okc_debug.log('5000: Before update_cond_hdrs');
1297: END IF;
1298: okc_conditions_pub.update_cond_hdrs(
1299: p_api_version => 1,
1300: p_init_msg_list => OKC_API.G_FALSE,
1303: x_msg_data => x_msg_data,
1304: p_cnhv_rec => l_cnh_rec,
1305: x_cnhv_rec => i_cnh_rec );
1306: IF (l_debug = 'Y') THEN
1307: okc_debug.log('5100: After update_cond_hdrs');
1308: END IF;
1309:
1310: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1311: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1317:
1318: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1319:
1320: IF (l_debug = 'Y') THEN
1321: okc_debug.log(' 5200: Leaving update_condition_headers', 2);
1322: okc_debug.Reset_Indentation;
1323: END IF;
1324:
1325: EXCEPTION
1318: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1319:
1320: IF (l_debug = 'Y') THEN
1321: okc_debug.log(' 5200: Leaving update_condition_headers', 2);
1322: okc_debug.Reset_Indentation;
1323: END IF;
1324:
1325: EXCEPTION
1326: WHEN E_Resource_Busy THEN
1325: EXCEPTION
1326: WHEN E_Resource_Busy THEN
1327:
1328: IF (l_debug = 'Y') THEN
1329: okc_debug.log('5300: Exiting update_condition_headers:E_Resource_Busy Exception', 2);
1330: okc_debug.Reset_Indentation;
1331: END IF;
1332:
1333:
1326: WHEN E_Resource_Busy THEN
1327:
1328: IF (l_debug = 'Y') THEN
1329: okc_debug.log('5300: Exiting update_condition_headers:E_Resource_Busy Exception', 2);
1330: okc_debug.Reset_Indentation;
1331: END IF;
1332:
1333:
1334: x_return_status := okc_api.g_ret_sts_error;
1338:
1339: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1340:
1341: IF (l_debug = 'Y') THEN
1342: okc_debug.log('5400: Exiting update_condition_headers:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1343: okc_debug.Reset_Indentation;
1344: END IF;
1345:
1346: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1339: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1340:
1341: IF (l_debug = 'Y') THEN
1342: okc_debug.log('5400: Exiting update_condition_headers:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1343: okc_debug.Reset_Indentation;
1344: END IF;
1345:
1346: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1347: (l_api_name,
1353:
1354: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1355:
1356: IF (l_debug = 'Y') THEN
1357: okc_debug.log('5500: Exiting update_condition_headers:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1358: okc_debug.Reset_Indentation;
1359: END IF;
1360:
1361: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1354: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1355:
1356: IF (l_debug = 'Y') THEN
1357: okc_debug.log('5500: Exiting update_condition_headers:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1358: okc_debug.Reset_Indentation;
1359: END IF;
1360:
1361: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1362: (l_api_name,
1368:
1369: WHEN OTHERS THEN
1370:
1371: IF (l_debug = 'Y') THEN
1372: okc_debug.log('5600: Exiting update_condition_headers:OTHERS Exception', 2);
1373: okc_debug.Reset_Indentation;
1374: END IF;
1375:
1376: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1369: WHEN OTHERS THEN
1370:
1371: IF (l_debug = 'Y') THEN
1372: okc_debug.log('5600: Exiting update_condition_headers:OTHERS Exception', 2);
1373: okc_debug.Reset_Indentation;
1374: END IF;
1375:
1376: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1377: (l_api_name,
1422: l_api_name constant VARCHAR2(30) := 'update_old_contract';
1423: l_date DATE := trunc(sysdate);
1424: BEGIN
1425: IF (l_debug = 'Y') THEN
1426: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1427: okc_debug.log('5700: Entered update_old_contract', 2);
1428: END IF;
1429:
1430: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1423: l_date DATE := trunc(sysdate);
1424: BEGIN
1425: IF (l_debug = 'Y') THEN
1426: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1427: okc_debug.log('5700: Entered update_old_contract', 2);
1428: END IF;
1429:
1430: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1431:
1449: l_chr_rec.date_renewed := l_date;
1450: --san rencol
1451:
1452: IF (l_debug = 'Y') THEN
1453: okc_debug.log('5800: Before lock_contract_header');
1454: END IF;
1455: okc_contract_pub.lock_contract_header(
1456: p_api_version => 1,
1457: p_init_msg_list => OKC_API.G_FALSE,
1459: x_msg_count => x_msg_count,
1460: x_msg_data => x_msg_data,
1461: p_chrv_rec => l_chr_rec );
1462: IF (l_debug = 'Y') THEN
1463: okc_debug.log('5900: After lock_contract_header');
1464: END IF;
1465:
1466: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1467: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1469: RAISE OKC_API.G_EXCEPTION_ERROR;
1470: END IF;
1471:
1472: IF (l_debug = 'Y') THEN
1473: okc_debug.log('6000: Before update_contract_header');
1474: END IF;
1475: okc_contract_pub.update_contract_header (
1476: p_api_version => 1,
1477: p_init_msg_list => OKC_API.G_FALSE,
1481: p_restricted_update => okc_api.g_true,
1482: p_chrv_rec => l_chr_rec,
1483: x_chrv_rec => i_chr_rec );
1484: IF (l_debug = 'Y') THEN
1485: okc_debug.log('6100: After update_contract_header');
1486: END IF;
1487:
1488: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1489: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1546: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1547: --dbms_output.put_line('old (-)');
1548:
1549: IF (l_debug = 'Y') THEN
1550: okc_debug.log('6200: Leaving update_old_contract', 2);
1551: okc_debug.Reset_Indentation;
1552: END IF;
1553:
1554: EXCEPTION
1547: --dbms_output.put_line('old (-)');
1548:
1549: IF (l_debug = 'Y') THEN
1550: okc_debug.log('6200: Leaving update_old_contract', 2);
1551: okc_debug.Reset_Indentation;
1552: END IF;
1553:
1554: EXCEPTION
1555: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1554: EXCEPTION
1555: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1556:
1557: IF (l_debug = 'Y') THEN
1558: okc_debug.log('6300: Exiting update_old_contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1559: okc_debug.Reset_Indentation;
1560: END IF;
1561:
1562: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1555: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1556:
1557: IF (l_debug = 'Y') THEN
1558: okc_debug.log('6300: Exiting update_old_contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
1559: okc_debug.Reset_Indentation;
1560: END IF;
1561:
1562: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1563: (l_api_name,
1569:
1570: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1571:
1572: IF (l_debug = 'Y') THEN
1573: okc_debug.log('6400: Exiting update_old_contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1574: okc_debug.Reset_Indentation;
1575: END IF;
1576:
1577: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1570: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1571:
1572: IF (l_debug = 'Y') THEN
1573: okc_debug.log('6400: Exiting update_old_contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
1574: okc_debug.Reset_Indentation;
1575: END IF;
1576:
1577: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1578: (l_api_name,
1584:
1585: WHEN OTHERS THEN
1586:
1587: IF (l_debug = 'Y') THEN
1588: okc_debug.log('6500: Exiting update_old_contract:OTHERS Exception', 2);
1589: okc_debug.Reset_Indentation;
1590: END IF;
1591:
1592: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1585: WHEN OTHERS THEN
1586:
1587: IF (l_debug = 'Y') THEN
1588: okc_debug.log('6500: Exiting update_old_contract:OTHERS Exception', 2);
1589: okc_debug.Reset_Indentation;
1590: END IF;
1591:
1592: x_return_status := OKC_API.HANDLE_EXCEPTIONS
1593: (l_api_name,
1728: l_api_name Varchar2(30) := 'get_parent';
1729: Begin
1730:
1731: IF (l_debug = 'Y') THEN
1732: okc_debug.Set_Indentation('get_parent');
1733: okc_debug.log('6500: Entered Get_Parent', 2);
1734: END IF;
1735:
1736: If l_parent_cle_tbl.count >0 then
1729: Begin
1730:
1731: IF (l_debug = 'Y') THEN
1732: okc_debug.Set_Indentation('get_parent');
1733: okc_debug.log('6500: Entered Get_Parent', 2);
1734: END IF;
1735:
1736: If l_parent_cle_tbl.count >0 then
1737: i:=l_parent_cle_tbl.first;
1738: LOOP
1739: If l_parent_cle_tbl(i).id=p_cle_id then
1740: -- MKS: Following line is introduced to fix Bug#2106425
1741: IF (l_debug = 'Y') THEN
1742: okc_debug.Reset_Indentation;
1743: END IF;
1744: return l_parent_cle_tbl(i);
1745: END IF;
1746: Exit when i=l_parent_cle_tbl.last;
1748: END LOOP;
1749: END IF;
1750:
1751: IF (l_debug = 'Y') THEN
1752: okc_debug.log('6510: Leaving Function Get_Parent ', 2);
1753: okc_debug.Reset_Indentation;
1754: END IF;
1755:
1756: return l_rec;
1749: END IF;
1750:
1751: IF (l_debug = 'Y') THEN
1752: okc_debug.log('6510: Leaving Function Get_Parent ', 2);
1753: okc_debug.Reset_Indentation;
1754: END IF;
1755:
1756: return l_rec;
1757: END;
1763: l_api_name Varchar2(30) := 'get_cle_renew_type';
1764: Begin
1765:
1766: IF (l_debug = 'Y') THEN
1767: okc_debug.Set_Indentation('get_cle_renew_type');
1768: okc_debug.log('6600: Entered get_cle_renew_type', 2);
1769: END IF;
1770:
1771:
1764: Begin
1765:
1766: IF (l_debug = 'Y') THEN
1767: okc_debug.Set_Indentation('get_cle_renew_type');
1768: okc_debug.log('6600: Entered get_cle_renew_type', 2);
1769: END IF;
1770:
1771:
1772: l_rule:=OKC_API.G_MISS_CHAR;
1776: If g_rules_tbl(i).comp_id = p_comp_id then
1777: l_rule:=g_rules_tbl(i).rule_type;
1778: -- MKS: Following line is introduced to fix Bug#2106425
1779: IF (l_debug = 'Y') THEN
1780: okc_debug.Reset_Indentation;
1781: END IF;
1782: return l_rule;
1783: End If;
1784: Exit when i = g_rules_tbl.last;
1786: End Loop;
1787: End If;
1788:
1789: IF (l_debug = 'Y') THEN
1790: okc_debug.log('6610: Leaving Function Get_Cle_Renew_Type ', 2);
1791: okc_debug.Reset_Indentation;
1792: END IF;
1793:
1794: return l_rule;
1787: End If;
1788:
1789: IF (l_debug = 'Y') THEN
1790: okc_debug.log('6610: Leaving Function Get_Cle_Renew_Type ', 2);
1791: okc_debug.Reset_Indentation;
1792: END IF;
1793:
1794: return l_rule;
1795: End;
1796:
1797: BEGIN
1798:
1799: IF (l_debug = 'Y') THEN
1800: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1801: okc_debug.log('6700: Entered Update_Renewal_Dates', 2);
1802: END IF;
1803:
1804: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1797: BEGIN
1798:
1799: IF (l_debug = 'Y') THEN
1800: okc_debug.Set_Indentation('OKC_RENEW_PVT');
1801: okc_debug.log('6700: Entered Update_Renewal_Dates', 2);
1802: END IF;
1803:
1804: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1805:
1838: l_chr_rec.END_date := p_parent_new_end_dt;
1839:
1840:
1841: IF (l_debug = 'Y') THEN
1842: okc_debug.log('6800: Before update_contract_header');
1843: END IF;
1844: l_chr_rec.start_date := TO_DATE(TO_CHAR(l_chr_rec.start_date, 'dd/mm/yyYY') || TO_CHAR(header_rec.start_date, 'hh24:mi:ss'), 'dd/mm/yyYYhh24:mi:ss');
1845: if l_chr_rec.end_date is not null then -- Added for Bugfix 2803674 to avoid Perpetual
1846: l_chr_rec.end_date := TO_DATE(TO_CHAR(l_chr_rec.end_date, 'dd/mm/yyYY') || TO_CHAR(header_rec.end_date, 'hh24:mi:ss'), 'dd/mm/yyYYhh24:mi:ss');
1856: x_chrv_rec => i_chr_rec );
1857:
1858:
1859: IF (l_debug = 'Y') THEN
1860: okc_debug.log('6900: After update_contract_header');
1861: END IF;
1862:
1863: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1864: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2000: END IF;
2001:
2002: END IF;
2003: IF (l_debug = 'Y') THEN
2004: okc_debug.log('7000: l_cle_renew_type ' || l_cle_renew_type);
2005: END IF;
2006:
2007: IF l_cle_renew_type='DNR' then
2008: l_cle:=l_cle+1;
2104: END IF;-- renew type FUL or KEP
2105:
2106:
2107: IF (l_debug = 'Y') THEN
2108: okc_debug.log('7100: Before update_contract_line');
2109: END IF;
2110:
2111: --Added decode for Bug 2911298
2112: SELECT TO_DATE(TO_CHAR(l_cle_rec.start_date, 'dd/mm/yyYY') || TO_CHAR(start_date, 'hh24:mi:ss'), 'dd/mm/yyYYhh24:mi:ss'),
2123: x_msg_data => x_msg_data,
2124: p_clev_rec => l_cle_rec,
2125: x_clev_rec => i_cle_rec );
2126: IF (l_debug = 'Y') THEN
2127: okc_debug.log('7200: After update_contract_line');
2128: END IF;
2129:
2130: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2131: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2211:
2212: --update the the dates and timevalues in the rules defined for renew copy
2213:
2214: IF (l_debug = 'Y') THEN
2215: okc_debug.log('7300: Before update_rules');
2216: END IF;
2217: update_rules(p_api_version => 1,
2218: p_init_msg_list => OKC_API.G_FALSE,
2219: x_return_status => l_return_status,
2221: x_msg_data => x_msg_data,
2222: p_chr_id => p_chr_id
2223: );
2224: IF (l_debug = 'Y') THEN
2225: okc_debug.log('7400: After update_rules');
2226: END IF;
2227:
2228: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2229: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2234: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2235:
2236:
2237: IF (l_debug = 'Y') THEN
2238: okc_debug.log('7500: Leaving Update_Renewal_Dates', 2);
2239: okc_debug.Reset_Indentation;
2240: END IF;
2241:
2242: EXCEPTION
2235:
2236:
2237: IF (l_debug = 'Y') THEN
2238: okc_debug.log('7500: Leaving Update_Renewal_Dates', 2);
2239: okc_debug.Reset_Indentation;
2240: END IF;
2241:
2242: EXCEPTION
2243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2242: EXCEPTION
2243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2244:
2245: IF (l_debug = 'Y') THEN
2246: okc_debug.log('7600: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_ERROR Exception', 2);
2247: okc_debug.Reset_Indentation;
2248: END IF;
2249:
2250: IF l_rencon_n_cur%ISOPEN then
2243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2244:
2245: IF (l_debug = 'Y') THEN
2246: okc_debug.log('7600: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_ERROR Exception', 2);
2247: okc_debug.Reset_Indentation;
2248: END IF;
2249:
2250: IF l_rencon_n_cur%ISOPEN then
2251: close l_rencon_n_cur;
2263:
2264: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2265:
2266: IF (l_debug = 'Y') THEN
2267: okc_debug.log('7700: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
2268: okc_debug.Reset_Indentation;
2269: END IF;
2270:
2271: IF l_rencon_n_cur%ISOPEN then
2264: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2265:
2266: IF (l_debug = 'Y') THEN
2267: okc_debug.log('7700: Exiting Update_Renewal_Dates:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
2268: okc_debug.Reset_Indentation;
2269: END IF;
2270:
2271: IF l_rencon_n_cur%ISOPEN then
2272: close l_rencon_n_cur;
2284:
2285: WHEN OTHERS THEN
2286:
2287: IF (l_debug = 'Y') THEN
2288: okc_debug.log('7800: Exiting Update_Renewal_Dates:OTHERS Exception', 2);
2289: okc_debug.Reset_Indentation;
2290: END IF;
2291:
2292: IF l_rencon_n_cur%ISOPEN then
2285: WHEN OTHERS THEN
2286:
2287: IF (l_debug = 'Y') THEN
2288: okc_debug.log('7800: Exiting Update_Renewal_Dates:OTHERS Exception', 2);
2289: okc_debug.Reset_Indentation;
2290: END IF;
2291:
2292: IF l_rencon_n_cur%ISOPEN then
2293: close l_rencon_n_cur;
2322: l_api_name Varchar2(30) := 'set_notify';
2323: BEGIN
2324:
2325: IF (l_debug = 'Y') THEN
2326: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2327: okc_debug.log('7900: Entered set_notify', 2);
2328: END IF;
2329:
2330: x_return_status :=OKC_API.G_RET_STS_SUCCESS;
2323: BEGIN
2324:
2325: IF (l_debug = 'Y') THEN
2326: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2327: okc_debug.log('7900: Entered set_notify', 2);
2328: END IF;
2329:
2330: x_return_status :=OKC_API.G_RET_STS_SUCCESS;
2331:
2410:
2411: END IF;
2412:
2413: IF (l_debug = 'Y') THEN
2414: okc_debug.log('8000: Leaving Set_Notify', 2);
2415: okc_debug.Reset_Indentation;
2416: END IF;
2417: END Set_Notify;
2418:
2411: END IF;
2412:
2413: IF (l_debug = 'Y') THEN
2414: okc_debug.log('8000: Leaving Set_Notify', 2);
2415: okc_debug.Reset_Indentation;
2416: END IF;
2417: END Set_Notify;
2418:
2419: --------------------------------------------------------------------------------------------
2506: l_api_name Varchar2(30) := 'notify';
2507: BEGIN
2508:
2509: IF (l_debug = 'Y') THEN
2510: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2511: okc_debug.log('8100: Entered notify', 2);
2512: END IF;
2513:
2514: IF p_ren_type = OKC_API.G_MISS_CHAR then
2507: BEGIN
2508:
2509: IF (l_debug = 'Y') THEN
2510: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2511: okc_debug.log('8100: Entered notify', 2);
2512: END IF;
2513:
2514: IF p_ren_type = OKC_API.G_MISS_CHAR then
2515: open cur_user(to_number(p_user));
2538: ''',p_ren_type=>'''||l_ren_type||''' ); end;';
2539:
2540:
2541: IF (l_debug = 'Y') THEN
2542: okc_debug.log('8200: Before proc_msg_call');
2543: END IF;
2544: OKC_ASYNC_PUB.proc_msg_call(
2545: p_api_version => 1,
2546: x_return_status => l_return_status,
2551: p_e_recipient => l_user_name,
2552: p_contract_id => p_renew_chr_id
2553: );
2554: IF (l_debug = 'Y') THEN
2555: okc_debug.log('8300: After proc_msg_call');
2556: END IF;
2557:
2558:
2559: IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
2562:
2563: END IF;
2564:
2565: IF (l_debug = 'Y') THEN
2566: okc_debug.log('8400: Leaving notify', 2);
2567: okc_debug.Reset_Indentation;
2568: END IF;
2569:
2570: return (l_return_status);
2563: END IF;
2564:
2565: IF (l_debug = 'Y') THEN
2566: okc_debug.log('8400: Leaving notify', 2);
2567: okc_debug.Reset_Indentation;
2568: END IF;
2569:
2570: return (l_return_status);
2571:
2572: EXCEPTION
2573: WHEN l_exception_stop then
2574:
2575: IF (l_debug = 'Y') THEN
2576: okc_debug.log('8500: Exiting notify:l_exception_stop Exception', 2);
2577: okc_debug.Reset_Indentation;
2578: END IF;
2579:
2580: return l_return_status;
2573: WHEN l_exception_stop then
2574:
2575: IF (l_debug = 'Y') THEN
2576: okc_debug.log('8500: Exiting notify:l_exception_stop Exception', 2);
2577: okc_debug.Reset_Indentation;
2578: END IF;
2579:
2580: return l_return_status;
2581: when others then
2580: return l_return_status;
2581: when others then
2582:
2583: IF (l_debug = 'Y') THEN
2584: okc_debug.log('8600: Exiting notify:others Exception', 2);
2585: okc_debug.Reset_Indentation;
2586: END IF;
2587:
2588: OKC_API.set_message(p_app_name => g_app_name,
2581: when others then
2582:
2583: IF (l_debug = 'Y') THEN
2584: okc_debug.log('8600: Exiting notify:others Exception', 2);
2585: okc_debug.Reset_Indentation;
2586: END IF;
2587:
2588: OKC_API.set_message(p_app_name => g_app_name,
2589: p_msg_name => g_unexpected_error,
2598:
2599: BEGIN
2600:
2601: IF (l_debug = 'Y') THEN
2602: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2603: okc_debug.log('8700: Entered post_renewed_contract', 2);
2604: END IF;
2605:
2606: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2599: BEGIN
2600:
2601: IF (l_debug = 'Y') THEN
2602: okc_debug.Set_Indentation('OKC_RENEW_PVT');
2603: okc_debug.log('8700: Entered post_renewed_contract', 2);
2604: END IF;
2605:
2606: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2607:
2642: l_contact :=p_contact;
2643:
2644: END IF;
2645: IF (l_debug = 'Y') THEN
2646: okc_debug.log('8800: l_ren_type ' || l_ren_type);
2647: END IF;
2648:
2649: IF l_ren_type in ('SFA','EVN','NSR') then
2650: If l_contact = OKC_API.G_MISS_CHAR then
2663: l_qcl_id := cur_header_rec.qcl_id;
2664: --
2665: If l_qcl_id <> OKC_API.G_MISS_NUM then
2666: IF (l_debug = 'Y') THEN
2667: okc_debug.log('8900: Before QA Check');
2668: END IF;
2669: OKC_QA_CHECK_PUB.execute_qa_check_list(
2670: p_api_version =>p_api_version
2671: ,p_init_msg_list=>okc_api.g_false
2676: ,p_chr_id=>p_renew_chr_id
2677: ,x_msg_tbl=>l_msg_tbl
2678: );
2679: IF (l_debug = 'Y') THEN
2680: okc_debug.log('9000: After QA Check');
2681: END IF;
2682: IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2683: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2684: ELSIF x_return_status = OKC_API.G_RET_STS_ERROR THEN
2724: Fetch cur_wf into l_pdf_id;
2725: close cur_wf;
2726: IF l_pdf_id <> OKC_API.G_MISS_NUM then
2727: IF (l_debug = 'Y') THEN
2728: okc_debug.log('9100: Before k_approval_start');
2729: END IF;
2730: OKC_CONTRACT_APPROVAL_PUB.k_approval_start(
2731: p_api_version=>p_api_version,
2732: p_init_msg_list=>okc_api.g_false,
2738: p_do_commit=>okc_api.g_false,
2739: p_access_level=>'Y'
2740: );
2741: IF (l_debug = 'Y') THEN
2742: okc_debug.log('9200: After k_approval_start');
2743: END IF;
2744: IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2745: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2746: ELSIF x_return_status = OKC_API.G_RET_STS_ERROR THEN
2760: -- call alex api to update status and resolve time values
2761:
2762: -- update the date approved of the contract
2763: IF (l_debug = 'Y') THEN
2764: okc_debug.log('9300: Before k_approved');
2765: END IF;
2766: OKC_CONTRACT_APPROVAL_PUB.k_approved(
2767: p_contract_id=>p_renew_chr_id,
2768: x_return_status=>x_return_status
2767: p_contract_id=>p_renew_chr_id,
2768: x_return_status=>x_return_status
2769: );
2770: IF (l_debug = 'Y') THEN
2771: okc_debug.log('9400: After k_approved');
2772: END IF;
2773: IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2774: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2775: ELSIF x_return_status = OKC_API.G_RET_STS_ERROR THEN
2776: RAISE OKC_API.G_EXCEPTION_ERROR;
2777: END IF;
2778: -- sign the contract
2779: IF (l_debug = 'Y') THEN
2780: okc_debug.log('9500: Before k_signed');
2781: END IF;
2782: OKC_CONTRACT_APPROVAL_PUB.k_signed(
2783: p_contract_id=>p_renew_chr_id,
2784: x_return_status=>x_return_status
2783: p_contract_id=>p_renew_chr_id,
2784: x_return_status=>x_return_status
2785: );
2786: IF (l_debug = 'Y') THEN
2787: okc_debug.log('9600: After k_signed');
2788: END IF;
2789: IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2790: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2791: ELSIF x_return_status = OKC_API.G_RET_STS_ERROR THEN
2804: END IF;-- if ren type sfa or evn
2805: -- start notify workflow
2806:
2807: IF (l_debug = 'Y') THEN
2808: okc_debug.log('9700: Before notify');
2809: END IF;
2810: --x_return_status := notify(l_wf_msg_tbl,l_contact);
2811: x_return_status := notify(l_contact);
2812: IF (l_debug = 'Y') THEN
2809: END IF;
2810: --x_return_status := notify(l_wf_msg_tbl,l_contact);
2811: x_return_status := notify(l_contact);
2812: IF (l_debug = 'Y') THEN
2813: okc_debug.log('9800: After notify');
2814: END IF;
2815: IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2816: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2817: ELSIF x_return_status = OKC_API.G_RET_STS_ERROR THEN
2834: close cur_startend;
2835: END IF;
2836:
2837: IF (l_debug = 'Y') THEN
2838: okc_debug.log('9900: Before acn_assemble');
2839: END IF;
2840: OKC_K_RENEW_ASMBLR_PVT.acn_assemble(
2841: p_api_version => 1,
2842: p_init_msg_list => OKC_API.G_FALSE,
2855: p_k_subclass => l_scs_code,
2856: p_k_status_code => l_k_status_code,
2857: p_estimated_amount => l_estimated_amount);
2858: IF (l_debug = 'Y') THEN
2859: okc_debug.log('10000: After acn_assemble');
2860: END IF;
2861:
2862: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
2863: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2867:
2868: -- Opportunity Integration starts from here. See bug 1865416 for more details.
2869: -- Create opportunity for this renewed contract only if it is allowed.
2870: IF (l_debug = 'Y') THEN
2871: okc_debug.log('11000: Before is_opp_creation_allowed');
2872: END IF;
2873: okc_opportunity_pub.is_opp_creation_allowed(
2874: p_context => 'RENEW',
2875: p_contract_id => p_renew_chr_id,
2874: p_context => 'RENEW',
2875: p_contract_id => p_renew_chr_id,
2876: x_return_status => l_return_status);
2877: IF (l_debug = 'Y') THEN
2878: okc_debug.log('10100: After is_opp_creation_allowed');
2879: okc_debug.log('10200: Return Status of opp_creation_allowed - ' || l_return_status);
2880: END IF;
2881: -- In case of unexpected error, raise the exception, however if it is
2882: -- a normal error, it means opportunity cannot be created and success
2875: p_contract_id => p_renew_chr_id,
2876: x_return_status => l_return_status);
2877: IF (l_debug = 'Y') THEN
2878: okc_debug.log('10100: After is_opp_creation_allowed');
2879: okc_debug.log('10200: Return Status of opp_creation_allowed - ' || l_return_status);
2880: END IF;
2881: -- In case of unexpected error, raise the exception, however if it is
2882: -- a normal error, it means opportunity cannot be created and success
2883: -- should be returned from this procedure.
2888: End If;
2889:
2890: If l_return_status = OKC_API.G_RET_STS_SUCCESS Then
2891: IF (l_debug = 'Y') THEN
2892: okc_debug.log('10300: Before Create_Opportunity');
2893: END IF;
2894:
2895: okc_opportunity_pub.create_opportunity(
2896: p_api_version => 1,
2904: x_msg_count => x_msg_count,
2905: x_return_status => l_return_status);
2906:
2907: IF (l_debug = 'Y') THEN
2908: okc_debug.log('10400: After Create_Opportunity');
2909: okc_debug.log('10500: Return Status of Create_Opportunity - ' || l_return_status);
2910: okc_debug.log('10600: Lead ID - ' || To_Char(l_lead_id));
2911: END IF;
2912:
2905: x_return_status => l_return_status);
2906:
2907: IF (l_debug = 'Y') THEN
2908: okc_debug.log('10400: After Create_Opportunity');
2909: okc_debug.log('10500: Return Status of Create_Opportunity - ' || l_return_status);
2910: okc_debug.log('10600: Lead ID - ' || To_Char(l_lead_id));
2911: END IF;
2912:
2913: If l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR Then
2906:
2907: IF (l_debug = 'Y') THEN
2908: okc_debug.log('10400: After Create_Opportunity');
2909: okc_debug.log('10500: Return Status of Create_Opportunity - ' || l_return_status);
2910: okc_debug.log('10600: Lead ID - ' || To_Char(l_lead_id));
2911: END IF;
2912:
2913: If l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR Then
2914: Raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2920: END IF; -- ren_type not 'DNR'
2921: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2922:
2923: IF (l_debug = 'Y') THEN
2924: okc_debug.log('10700: Leaving post_renewed_contract', 2);
2925: okc_debug.Reset_Indentation;
2926: END IF;
2927:
2928: EXCEPTION
2921: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2922:
2923: IF (l_debug = 'Y') THEN
2924: okc_debug.log('10700: Leaving post_renewed_contract', 2);
2925: okc_debug.Reset_Indentation;
2926: END IF;
2927:
2928: EXCEPTION
2929: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2928: EXCEPTION
2929: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2930:
2931: IF (l_debug = 'Y') THEN
2932: okc_debug.log('10800: Exiting post_renewed_contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
2933: okc_debug.Reset_Indentation;
2934: END IF;
2935:
2936: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2929: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2930:
2931: IF (l_debug = 'Y') THEN
2932: okc_debug.log('10800: Exiting post_renewed_contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
2933: okc_debug.Reset_Indentation;
2934: END IF;
2935:
2936: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2937: (l_api_name,
2943:
2944: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2945:
2946: IF (l_debug = 'Y') THEN
2947: okc_debug.log('10900: Exiting post_renewed_contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
2948: okc_debug.Reset_Indentation;
2949: END IF;
2950:
2951: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2944: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2945:
2946: IF (l_debug = 'Y') THEN
2947: okc_debug.log('10900: Exiting post_renewed_contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
2948: okc_debug.Reset_Indentation;
2949: END IF;
2950:
2951: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2952: (l_api_name,
2958:
2959: WHEN OTHERS THEN
2960:
2961: IF (l_debug = 'Y') THEN
2962: okc_debug.log('11000: Exiting post_renewed_contract:OTHERS Exception', 2);
2963: okc_debug.Reset_Indentation;
2964: END IF;
2965:
2966: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2959: WHEN OTHERS THEN
2960:
2961: IF (l_debug = 'Y') THEN
2962: okc_debug.log('11000: Exiting post_renewed_contract:OTHERS Exception', 2);
2963: okc_debug.Reset_Indentation;
2964: END IF;
2965:
2966: x_return_status := OKC_API.HANDLE_EXCEPTIONS
2967: (l_api_name,
3041: l_return_status Varchar2(1) := OKC_API.G_RET_STS_SUCCESS;
3042: Begin
3043:
3044: IF (l_debug = 'Y') THEN
3045: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3046: okc_debug.log('11100: Entered Set_Evergreen_Date_Uom', 2);
3047: END IF;
3048:
3049: p_return_status := l_return_status;
3042: Begin
3043:
3044: IF (l_debug = 'Y') THEN
3045: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3046: okc_debug.log('11100: Entered Set_Evergreen_Date_Uom', 2);
3047: END IF;
3048:
3049: p_return_status := l_return_status;
3050: --
3081: End If;
3082: End If;
3083:
3084: IF (l_debug = 'Y') THEN
3085: okc_debug.log('11150: Leaving Set_Evergreen_Date_Uom', 2);
3086: okc_debug.Reset_Indentation;
3087: END IF;
3088: End Set_Evergreen_Date_Uom;
3089: BEGIN
3082: End If;
3083:
3084: IF (l_debug = 'Y') THEN
3085: okc_debug.log('11150: Leaving Set_Evergreen_Date_Uom', 2);
3086: okc_debug.Reset_Indentation;
3087: END IF;
3088: End Set_Evergreen_Date_Uom;
3089: BEGIN
3090:
3088: End Set_Evergreen_Date_Uom;
3089: BEGIN
3090:
3091: IF (l_debug = 'Y') THEN
3092: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3093: okc_debug.log('11200: Entered set_attributes', 2);
3094: END IF;
3095:
3096: -- calculate new start date if not provided
3089: BEGIN
3090:
3091: IF (l_debug = 'Y') THEN
3092: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3093: okc_debug.log('11200: Entered set_attributes', 2);
3094: END IF;
3095:
3096: -- calculate new start date if not provided
3097: If p_renew_in_rec.p_start_date is null then
3141: p_renew_in_Rec.p_uom_code := Null;
3142: End If; -- end perpetual flag = OKC_API.G_FALSE
3143:
3144: IF (l_debug = 'Y') THEN
3145: okc_debug.log('11300: Leaving set_attributes', 2);
3146: okc_debug.Reset_Indentation;
3147: END IF;
3148:
3149: Return (l_return_status);
3142: End If; -- end perpetual flag = OKC_API.G_FALSE
3143:
3144: IF (l_debug = 'Y') THEN
3145: okc_debug.log('11300: Leaving set_attributes', 2);
3146: okc_debug.Reset_Indentation;
3147: END IF;
3148:
3149: Return (l_return_status);
3150:
3152: EXCEPTION
3153: when others then
3154:
3155: IF (l_debug = 'Y') THEN
3156: okc_debug.log('11400: Exiting set_attributes:others Exception', 2);
3157: okc_debug.Reset_Indentation;
3158: END IF;
3159:
3160: OKC_API.set_message(p_app_name => g_app_name,
3153: when others then
3154:
3155: IF (l_debug = 'Y') THEN
3156: okc_debug.log('11400: Exiting set_attributes:others Exception', 2);
3157: okc_debug.Reset_Indentation;
3158: END IF;
3159:
3160: OKC_API.set_message(p_app_name => g_app_name,
3161: p_msg_name => g_unexpected_error,
3169: END Set_Attributes;
3170: BEGIN
3171:
3172: IF (l_debug = 'Y') THEN
3173: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3174: okc_debug.log('11500: Entered Create_Renewed_Contract', 2);
3175: END IF;
3176:
3177: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3170: BEGIN
3171:
3172: IF (l_debug = 'Y') THEN
3173: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3174: okc_debug.log('11500: Entered Create_Renewed_Contract', 2);
3175: END IF;
3176:
3177: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3178:
3211: p_ren_type <> OKC_API.G_MISS_CHAR then
3212: l_ren_type := p_ren_type;
3213: END IF;
3214: IF (l_debug = 'Y') THEN
3215: okc_debug.log('11600: l_ren_type - ' || l_ren_type);
3216: END IF;
3217:
3218: --Renew is not allowed when renew_type is DNR
3219: If l_ren_type = 'DNR' then
3223: END IF;
3224:
3225: -- validate the contract to be renewed
3226: IF (l_debug = 'Y') THEN
3227: okc_debug.log('11700: Before validate');
3228: END IF;
3229: validate(p_api_version => 1,
3230: p_init_msg_list => 'F',
3231: x_return_status =>l_return_status,
3233: x_msg_data => x_msg_data,
3234: p_renew_in_parameters_rec => p_renew_in_parameters_rec,
3235: p_renewal_called_from_ui => p_renewal_called_from_ui);
3236: IF (l_debug = 'Y') THEN
3237: okc_debug.log('11800: After validate');
3238: END IF;
3239:
3240:
3241: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3261: r_inv_org := cur_header_rec.inv_organization_id;
3262: ----
3263:
3264: IF (l_debug = 'Y') THEN
3265: okc_debug.log('119900: Before copy_contract');
3266: END IF;
3267: okc_copy_contract_pub.copy_contract(
3268: p_api_version => 1,
3269: p_init_msg_list => 'F',
3282: --san comment dbms - take out the above 2 paramater
3283: x_chr_id => x_contract_id);
3284:
3285: IF (l_debug = 'Y') THEN
3286: okc_debug.log('12000: After copy_contract');
3287: END IF;
3288:
3289: IF l_return_status = 'W' then
3290: x_return_status := 'W';
3296: END IF;
3297:
3298: --update the start and end dates for the header and lines in the renew copy
3299: IF (l_debug = 'Y') THEN
3300: okc_debug.log('12100: Before update_renewal_dates');
3301: END IF;
3302: update_renewal_dates(p_api_version => 1,
3303: p_init_msg_list => OKC_API.G_FALSE,
3304: x_return_status => l_return_status,
3309: p_parent_new_end_dt => l_renew_in_parameters_rec.p_end_date,
3310: p_parent_old_st_dt => l_renew_in_parameters_rec.p_orig_start_date);
3311:
3312: IF (l_debug = 'Y') THEN
3313: okc_debug.log('12200: After update_renewal_dates');
3314: END IF;
3315:
3316:
3317: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
3323:
3324: --update date_active and date_inactive in the condition headers for the renew copy
3325:
3326: IF (l_debug = 'Y') THEN
3327: okc_debug.log('123300: Before update_condition_headers');
3328: END IF;
3329: update_condition_headers (p_api_version => 1,
3330: p_init_msg_list => OKC_API.G_FALSE,
3331: x_return_status => l_return_status,
3337: p_orig_start_date => l_renew_in_parameters_rec.p_orig_start_date,
3338: p_orig_end_date => l_renew_in_parameters_rec.p_orig_end_date);
3339:
3340: IF (l_debug = 'Y') THEN
3341: okc_debug.log('12400: After update_condition_headers');
3342: END IF;
3343:
3344: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
3345: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3349:
3350: --update the old contract - update date_renewed and links to renew copy
3351:
3352: IF (l_debug = 'Y') THEN
3353: okc_debug.log('12500: Before update_old_contract');
3354: END IF;
3355: update_old_contract(p_api_version => 1,
3356: p_init_msg_list => OKC_API.G_FALSE,
3357: x_return_status => l_return_status,
3360: p_new_header => x_contract_id ,
3361: p_chr_id => l_renew_in_parameters_rec.p_contract_id );
3362:
3363: IF (l_debug = 'Y') THEN
3364: okc_debug.log('12600: After update_old_contract');
3365: END IF;
3366:
3367: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
3368: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3380: IF ( p_renew_in_parameters_rec.p_context IS NOT NULL
3381: AND
3382: p_renew_in_parameters_rec.p_context <> OKC_API.G_MISS_CHAR ) THEN
3383: IF (l_debug = 'Y') THEN
3384: okc_debug.log('12700: Before create_k_from_q');
3385: END IF;
3386: okc_oc_int_qtk_pvt.create_k_from_q(x_return_status => l_return_status
3387: ,p_context => p_renew_in_parameters_rec.p_context
3388: ,p_chr_id => x_contract_id);
3388: ,p_chr_id => x_contract_id);
3389:
3390:
3391: IF (l_debug = 'Y') THEN
3392: okc_debug.log('12800: After create_k_from_q');
3393: END IF;
3394: IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
3395: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3396: ELSIF l_return_status = OKC_API.G_RET_STS_ERROR THEN
3405: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3406: --dbms_output.put_line('renew(-)');
3407:
3408: IF (l_debug = 'Y') THEN
3409: okc_debug.log('12900: Leaving Create_Renewed_Contract', 2);
3410: okc_debug.Reset_Indentation;
3411: END IF;
3412:
3413: EXCEPTION
3406: --dbms_output.put_line('renew(-)');
3407:
3408: IF (l_debug = 'Y') THEN
3409: okc_debug.log('12900: Leaving Create_Renewed_Contract', 2);
3410: okc_debug.Reset_Indentation;
3411: END IF;
3412:
3413: EXCEPTION
3414:
3414:
3415: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3416:
3417: IF (l_debug = 'Y') THEN
3418: okc_debug.log('13000: Exiting Create_Renewed_Contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
3419: okc_debug.Reset_Indentation;
3420: END IF;
3421:
3422: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3415: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3416:
3417: IF (l_debug = 'Y') THEN
3418: okc_debug.log('13000: Exiting Create_Renewed_Contract:OKC_API.G_EXCEPTION_ERROR Exception', 2);
3419: okc_debug.Reset_Indentation;
3420: END IF;
3421:
3422: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3423: (l_api_name,
3429:
3430: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3431:
3432: IF (l_debug = 'Y') THEN
3433: okc_debug.log('13100: Exiting Create_Renewed_Contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
3434: okc_debug.Reset_Indentation;
3435: END IF;
3436:
3437: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3430: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3431:
3432: IF (l_debug = 'Y') THEN
3433: okc_debug.log('13100: Exiting Create_Renewed_Contract:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
3434: okc_debug.Reset_Indentation;
3435: END IF;
3436:
3437: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3438: (l_api_name,
3444:
3445: WHEN OTHERS THEN
3446:
3447: IF (l_debug = 'Y') THEN
3448: okc_debug.log('13200: Exiting Create_Renewed_Contract:OTHERS Exception', 2);
3449: okc_debug.Reset_Indentation;
3450: END IF;
3451:
3452: OKC_API.set_message(p_app_name => g_app_name,
3445: WHEN OTHERS THEN
3446:
3447: IF (l_debug = 'Y') THEN
3448: okc_debug.log('13200: Exiting Create_Renewed_Contract:OTHERS Exception', 2);
3449: okc_debug.Reset_Indentation;
3450: END IF;
3451:
3452: OKC_API.set_message(p_app_name => g_app_name,
3453: p_msg_name => g_unexpected_error,
3494: WHERE level_sequence = l_level;
3495: Begin
3496:
3497: IF (l_debug = 'Y') THEN
3498: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3499: okc_debug.log('13300: Entered Update_Parents_Date_Renewed', 2);
3500: END IF;
3501:
3502: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3495: Begin
3496:
3497: IF (l_debug = 'Y') THEN
3498: okc_debug.Set_Indentation('OKC_RENEW_PVT');
3499: okc_debug.log('13300: Entered Update_Parents_Date_Renewed', 2);
3500: END IF;
3501:
3502: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3503:
3521: end if;
3522:
3523: -- Inserting into temporary table
3524: IF (l_debug = 'Y') THEN
3525: okc_debug.log('13400: Before Insert Into OKC_UPD_REN_TEMP');
3526: END IF;
3527: insert into OKC_UPD_REN_TEMP(DNZ_CHR_ID,
3528: CLE_ID,
3529: CLE_ID_ASCENDANT,
3604: End If;
3605: End If;
3606:
3607: IF (l_debug = 'Y') THEN
3608: okc_debug.log('13500: Leaving Update_Parents_Date_Renewed', 2);
3609: okc_debug.Reset_Indentation;
3610: END IF;
3611: EXCEPTION
3612: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3605: End If;
3606:
3607: IF (l_debug = 'Y') THEN
3608: okc_debug.log('13500: Leaving Update_Parents_Date_Renewed', 2);
3609: okc_debug.Reset_Indentation;
3610: END IF;
3611: EXCEPTION
3612: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3613:
3611: EXCEPTION
3612: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3613:
3614: IF (l_debug = 'Y') THEN
3615: okc_debug.log('13600: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_ERROR Exception', 2);
3616: okc_debug.Reset_Indentation;
3617: END IF;
3618:
3619: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3612: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3613:
3614: IF (l_debug = 'Y') THEN
3615: okc_debug.log('13600: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_ERROR Exception', 2);
3616: okc_debug.Reset_Indentation;
3617: END IF;
3618:
3619: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3620: (l_api_name,
3626:
3627: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3628:
3629: IF (l_debug = 'Y') THEN
3630: okc_debug.log('13700: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
3631: okc_debug.Reset_Indentation;
3632: END IF;
3633:
3634: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3627: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3628:
3629: IF (l_debug = 'Y') THEN
3630: okc_debug.log('13700: Exiting Update_Parents_Date_Renewed:OKC_API.G_EXCEPTION_UNEXPECTED_ERROR Exception', 2);
3631: okc_debug.Reset_Indentation;
3632: END IF;
3633:
3634: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3635: (l_api_name,
3641:
3642: WHEN Contract_Not_Found THEN
3643:
3644: IF (l_debug = 'Y') THEN
3645: okc_debug.log('13800: Exiting Update_Parents_Date_Renewed:Contract_Not_Found Exception', 2);
3646: okc_debug.Reset_Indentation;
3647: END IF;
3648:
3649: x_return_status := OKC_API.G_RET_STS_ERROR;
3642: WHEN Contract_Not_Found THEN
3643:
3644: IF (l_debug = 'Y') THEN
3645: okc_debug.log('13800: Exiting Update_Parents_Date_Renewed:Contract_Not_Found Exception', 2);
3646: okc_debug.Reset_Indentation;
3647: END IF;
3648:
3649: x_return_status := OKC_API.G_RET_STS_ERROR;
3650: OKC_API.set_message(G_APP_NAME, 'OKC_CONTRACT_NOT_FOUND');
3651:
3652: WHEN OTHERS THEN
3653:
3654: IF (l_debug = 'Y') THEN
3655: okc_debug.log('13900: Exiting Update_Parents_Date_Renewed:OTHERS Exception', 2);
3656: okc_debug.Reset_Indentation;
3657: END IF;
3658:
3659: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3652: WHEN OTHERS THEN
3653:
3654: IF (l_debug = 'Y') THEN
3655: okc_debug.log('13900: Exiting Update_Parents_Date_Renewed:OTHERS Exception', 2);
3656: okc_debug.Reset_Indentation;
3657: END IF;
3658:
3659: x_return_status := OKC_API.HANDLE_EXCEPTIONS
3660: (l_api_name,