2: /* $Header: hxtgenai.pkb 120.3.12010000.4 2009/09/29 11:26:09 asrajago ship $ */
3:
4: -------------------------------------------------------------------------------
5:
6: g_debug boolean := hr_utility.debug_enabled;
7: PROCEDURE AAI_VALIDATIONS
8: (p_assignment_id NUMBER
9: ,p_earning_policy NUMBER
10: ,p_rotation_plan NUMBER
210: And assignment_id = p_assignment_id;
211:
212: BEGIN
213:
214: g_debug :=hr_utility.debug_enabled;
215: if g_debug then
216: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',10);
217: end if;
218:
212: BEGIN
213:
214: g_debug :=hr_utility.debug_enabled;
215: if g_debug then
216: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',10);
217: end if;
218:
219: /* Get the assignment business group id */
220: OPEN c_asg_bus_grp_id;
221: FETCH c_asg_bus_grp_id into asg_bus_grp_id;
222: CLOSE c_asg_bus_grp_id;
223:
224: if g_debug then
225: hr_utility.trace('asg_bus_grp_id :'||asg_bus_grp_id);
226: end if;
227:
228: /* IF AUTOGEN_HOURS_YN is 'Y', then ROTATION_PLAN_NAME is required */
229: IF p_autogen_hours_yn = 'Y' and p_rotation_plan IS NULL THEN
228: /* IF AUTOGEN_HOURS_YN is 'Y', then ROTATION_PLAN_NAME is required */
229: IF p_autogen_hours_yn = 'Y' and p_rotation_plan IS NULL THEN
230: --
231: if g_debug then
232: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',20);
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
232: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',20);
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
237: hr_utility.raise_error;
238: --
239: END IF;
240:
233: end if;
234: -- FND_MESSAGE.SET_NAME('HXT','HXT_39496_ROT_PLAN_REQD');
235: -- FND_MESSAGE.ERROR;
236: hr_utility.set_message(809, 'HXT_39496_ROT_PLAN_REQD');
237: hr_utility.raise_error;
238: --
239: END IF;
240:
241: /* Check for rotation plan */
240:
241: /* Check for rotation plan */
242: IF p_rotation_plan is NOT NULL THEN
243: if g_debug then
244: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',25);
245: end if;
246: OPEN chk_rot_plan;
247: FETCH chk_rot_plan INTO l_rtp_compatible;
248: CLOSE chk_rot_plan;
248: CLOSE chk_rot_plan;
249: IF l_rtp_compatible IS NULL THEN
250: --
251: if g_debug then
252: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',30);
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
252: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',30);
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
257: hr_utility.raise_error;
258: --
259: END IF;
260: END IF;
253: end if;
254: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_ROT_PLAN_ERR');
255: -- FND_MESSAGE.ERROR;
256: hr_utility.set_message(809, 'HXT_xxxxx_ROT_PLAN_ERR');
257: hr_utility.raise_error;
258: --
259: END IF;
260: END IF;
261:
260: END IF;
261:
262: /* Check whether Earning policy and Assignment are compatible */
263: if g_debug then
264: hr_utility.trace('p_assignment_id is :'|| p_assignment_id);
265: hr_utility.trace('p_earning_policy is :'|| p_earning_policy);
266: end if;
267: OPEN chk_earning_policy;
268: FETCH chk_earning_policy into l_egp_compatible;
261:
262: /* Check whether Earning policy and Assignment are compatible */
263: if g_debug then
264: hr_utility.trace('p_assignment_id is :'|| p_assignment_id);
265: hr_utility.trace('p_earning_policy is :'|| p_earning_policy);
266: end if;
267: OPEN chk_earning_policy;
268: FETCH chk_earning_policy into l_egp_compatible;
269: CLOSE chk_earning_policy;
269: CLOSE chk_earning_policy;
270: IF l_egp_compatible IS NULL THEN
271: --
272: if g_debug then
273: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',40);
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
273: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',40);
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
278: hr_utility.raise_error;
279: --
280: END IF;
281:
274: end if;
275: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_EARN_POL_ERR');
276: -- FND_MESSAGE.ERROR;
277: hr_utility.set_message(809,'HXT_xxxxx_EARN_POL_ERR');
278: hr_utility.raise_error;
279: --
280: END IF;
281:
282: /* Check whether Shift Differential Policy and Assignment are compatible */
281:
282: /* Check whether Shift Differential Policy and Assignment are compatible */
283: IF p_shift_differential_policy is NOT NULL THEN
284: if g_debug then
285: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',45);
286: end if;
287: OPEN chk_shift_diff_policy;
288: FETCH chk_shift_diff_policy into l_sdp_compatible;
289: CLOSE chk_shift_diff_policy;
289: CLOSE chk_shift_diff_policy;
290: IF l_sdp_compatible IS NULL THEN
291: --
292: if g_debug then
293: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',50);
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
293: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',50);
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
298: hr_utility.raise_error;
299: --
300: END IF;
301: END IF;
294: end if;
295: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_SDP_ERR');
296: -- FND_MESSAGE.ERROR;
297: hr_utility.set_message(809,'HXT_xxxxx_SDP_ERR');
298: hr_utility.raise_error;
299: --
300: END IF;
301: END IF;
302:
302:
303: /* Check whether Hour Deduction Policy and Assignment are compatible */
304: IF p_hour_deduction_policy is NOT NULL THEN
305: if g_debug then
306: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',55);
307: end if;
308: OPEN chk_hour_deduct_policy;
309: FETCH chk_hour_deduct_policy into l_hdp_compatible;
310: CLOSE chk_hour_deduct_policy;
310: CLOSE chk_hour_deduct_policy;
311: IF l_hdp_compatible IS NULL THEN
312: --
313: if g_debug then
314: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',60);
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
314: hr_utility.set_location('HXT_GEN_AAI.AAI_VALIDATIONS',60);
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
319: hr_utility.raise_error;
320: --
321: END IF;
322: END IF;
315: end if;
316: -- FND_MESSAGE.SET_NAME('HXT','HXT_xxxxx_HDP_ERR');
317: -- FND_MESSAGE.ERROR;
318: hr_utility.set_message(809,'HXT_xxxxx_HDP_ERR');
319: hr_utility.raise_error;
320: --
321: END IF;
322: END IF;
323:
408: FROM sys.dual;
409: l_id NUMBER(15);
410:
411: BEGIN
412: g_debug :=hr_utility.debug_enabled;
413: if g_debug then
414: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',10);
415: end if;
416:
410:
411: BEGIN
412: g_debug :=hr_utility.debug_enabled;
413: if g_debug then
414: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',10);
415: end if;
416:
417: /* First, make sure AAI row doesn't already exist for this assignment */
418: OPEN dup_aai;
418: OPEN dup_aai;
419: FETCH dup_aai into l_duplicate_row;
420: IF dup_aai%FOUND THEN
421: if g_debug then
422: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',20);
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
422: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',20);
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
427: hr_utility.raise_error;
428: CLOSE dup_aai;
429: END IF;
430: CLOSE dup_aai;
423: end if;
424: -- FND_MESSAGE.SET_NAME('HXT','HXT_39481_INFO_EXST_FOR_ASSIGN');
425: -- FND_MESSAGE.Error;
426: hr_utility.set_message(809,'HXT_39481_INFO_EXST_FOR_ASSIGN');
427: hr_utility.raise_error;
428: CLOSE dup_aai;
429: END IF;
430: CLOSE dup_aai;
431:
429: END IF;
430: CLOSE dup_aai;
431:
432: if g_debug then
433: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',30);
434: end if;
435: HXT_GEN_AAI.AAI_VALIDATIONS
436: (p_assignment_id => p_assignment_id
437: ,p_earning_policy => p_earning_policy
441: ,p_autogen_hours_yn => p_autogen_hours_yn
442: ,p_effective_start_date => p_effective_start_date
443: );
444: if g_debug then
445: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',40);
446: end if;
447:
448: /* Create unique ID for AAI row */
449: IF (p_id is null) THEN
447:
448: /* Create unique ID for AAI row */
449: IF (p_id is null) THEN
450: if g_debug then
451: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',50);
452: end if;
453: OPEN create_unique_id;
454: FETCH create_unique_id into l_id;
455: if g_debug then
452: end if;
453: OPEN create_unique_id;
454: FETCH create_unique_id into l_id;
455: if g_debug then
456: hr_utility.trace('l_id is :'|| l_id);
457: end if;
458: IF create_unique_id%NOTFOUND THEN
459: if g_debug then
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
456: hr_utility.trace('l_id is :'|| l_id);
457: end if;
458: IF create_unique_id%NOTFOUND THEN
459: if g_debug then
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
460: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',60);
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
465: hr_utility.raise_error;
466: END IF;
467: CLOSE create_unique_id;
468: END IF;
461: end if;
462: -- fnd_message.set_name('HXT', 'HXT_39124_ROW_IN_DUAL_NF');
463: -- fnd_message.error;
464: hr_utility.set_message(809,'HXT_39124_ROW_IN_DUAL_NF');
465: hr_utility.raise_error;
466: END IF;
467: CLOSE create_unique_id;
468: END IF;
469:
467: CLOSE create_unique_id;
468: END IF;
469:
470: if g_debug then
471: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',70);
472: end if;
473:
474: INSERT into HXT_ADD_ASSIGN_INFO_F
475: (id
563: ,p_attribute29
564: ,p_attribute30);
565:
566: if g_debug then
567: hr_utility.set_location('HXT_GEN_AAI.Create_Otlr_Add_Assign_Info ',80);
568: end if;
569:
570: END Create_Otlr_Add_Assign_Info ;
571:
694:
695:
696:
697: BEGIN
698: g_debug :=hr_utility.debug_enabled;
699: if g_debug then
700: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
701: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
702: end if;
696:
697: BEGIN
698: g_debug :=hr_utility.debug_enabled;
699: if g_debug then
700: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
701: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
702: end if;
703:
704: -- Bug 8938280
697: BEGIN
698: g_debug :=hr_utility.debug_enabled;
699: if g_debug then
700: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',10);
701: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',20);
702: end if;
703:
704: -- Bug 8938280
705: -- Validation call here is wrong, commenting this out.
715: );
716: */
717:
718: if g_debug then
719: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',30);
720: end if;
721:
722: OPEN c2;
723: FETCH c2 into p_rowid,l_effective_start_date,l_effective_end_date;
729: THEN
730: IF p_effective_date > l_effective_end_date
731: OR p_effective_date < l_effective_start_date
732: THEN
733: hr_utility.trace(' p_effective_date :'||p_effective_date);
734: hr_utility.trace(' l_effective_start_date :'||l_effective_start_date);
735: hr_utility.trace(' l_effective_end_date :'||l_effective_end_date);
736: hr_utility.trace(' Effective Date falls outside the range '
737: ||' for the given record. Updates would be '
730: IF p_effective_date > l_effective_end_date
731: OR p_effective_date < l_effective_start_date
732: THEN
733: hr_utility.trace(' p_effective_date :'||p_effective_date);
734: hr_utility.trace(' l_effective_start_date :'||l_effective_start_date);
735: hr_utility.trace(' l_effective_end_date :'||l_effective_end_date);
736: hr_utility.trace(' Effective Date falls outside the range '
737: ||' for the given record. Updates would be '
738: ||' done based on p_effective_date ');
731: OR p_effective_date < l_effective_start_date
732: THEN
733: hr_utility.trace(' p_effective_date :'||p_effective_date);
734: hr_utility.trace(' l_effective_start_date :'||l_effective_start_date);
735: hr_utility.trace(' l_effective_end_date :'||l_effective_end_date);
736: hr_utility.trace(' Effective Date falls outside the range '
737: ||' for the given record. Updates would be '
738: ||' done based on p_effective_date ');
739: END IF;
732: THEN
733: hr_utility.trace(' p_effective_date :'||p_effective_date);
734: hr_utility.trace(' l_effective_start_date :'||l_effective_start_date);
735: hr_utility.trace(' l_effective_end_date :'||l_effective_end_date);
736: hr_utility.trace(' Effective Date falls outside the range '
737: ||' for the given record. Updates would be '
738: ||' done based on p_effective_date ');
739: END IF;
740: END IF;
759: */
760:
761: IF p_rowid is NOT NULL THEN
762: if g_debug then
763: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
764: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
765: hr_utility.trace('Rowid is :'|| p_rowid);
766: end if;
767: IF l_datetrack_mode = 'CORRECTION' THEN
760:
761: IF p_rowid is NOT NULL THEN
762: if g_debug then
763: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
764: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
765: hr_utility.trace('Rowid is :'|| p_rowid);
766: end if;
767: IF l_datetrack_mode = 'CORRECTION' THEN
768: if g_debug then
761: IF p_rowid is NOT NULL THEN
762: if g_debug then
763: hr_utility.trace('effective_start_date is :'|| l_effective_start_date);
764: hr_utility.trace('effective_end_date is :'|| l_effective_end_date);
765: hr_utility.trace('Rowid is :'|| p_rowid);
766: end if;
767: IF l_datetrack_mode = 'CORRECTION' THEN
768: if g_debug then
769: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',40);
765: hr_utility.trace('Rowid is :'|| p_rowid);
766: end if;
767: IF l_datetrack_mode = 'CORRECTION' THEN
768: if g_debug then
769: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',40);
770: end if;
771:
772: -- Bug 8938280
773: -- Added this validation call here. Parameters are same as
834: /* end date the existing record and then create a new record if an
835: existing record found */
836:
837: if g_debug then
838: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',50);
839: end if;
840:
841: -- Bug 8938280
842: -- Added this validation call here. Parameter for effective
874:
875: IF (idtab.COUNT >0)
876: THEN
877: if g_debug then
878: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',60);
879: end if;
880:
881: -- Bug 8327591
882: -- Not required anymore.
892:
893:
894:
895: if g_debug then
896: hr_utility.trace('p_effective_date is :'||p_effective_date);
897: end if;
898:
899: UPDATE hxt_add_assign_info_f aai
900: SET aai.effective_end_date = p_effective_date - 1
907: WHERE rowid = p_rowid;
908: END IF;
909:
910: if g_debug then
911: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',70);
912: hr_utility.trace('p_id is :'||p_id);
913: end if;
914:
915: INSERT into HXT_ADD_ASSIGN_INFO_F
908: END IF;
909:
910: if g_debug then
911: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',70);
912: hr_utility.trace('p_id is :'||p_id);
913: end if;
914:
915: INSERT into HXT_ADD_ASSIGN_INFO_F
916: (id
1005: ,p_attribute29
1006: ,p_attribute30);
1007:
1008: if g_debug then
1009: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',80);
1010: end if;
1011:
1012: ELSE
1013: /* INVALID datetrack_mode */
1010: end if;
1011:
1012: ELSE
1013: /* INVALID datetrack_mode */
1014: hr_utility.set_message(809,'HXT_xxxxx_INVALID_DTMODE');
1015: hr_utility.raise_error;
1016: END IF;
1017:
1018: if g_debug then
1011:
1012: ELSE
1013: /* INVALID datetrack_mode */
1014: hr_utility.set_message(809,'HXT_xxxxx_INVALID_DTMODE');
1015: hr_utility.raise_error;
1016: END IF;
1017:
1018: if g_debug then
1019: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',90);
1015: hr_utility.raise_error;
1016: END IF;
1017:
1018: if g_debug then
1019: hr_utility.set_location('HXT_GEN_AAI.Update_Otlr_Add_Assign_Info ',90);
1020: end if;
1021: END IF;
1022:
1023: END Update_Otlr_Add_Assign_Info ;
1023: END Update_Otlr_Add_Assign_Info ;
1024:
1025: -------------------------------------------------------------------------------
1026: --begin
1027: --hr_utility.trace_on(null,'mhanda');
1028:
1029: END HXT_GEN_AAI;