1 PACKAGE BODY hr_de_extra_person_checks AS
2 /* $Header: pedepeiv.pkb 120.1 2006/09/12 10:39:03 abppradh noship $ */
3 --
4 --
5 -- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 -- Person Extra Information checks.
7 --
8 -- - Military Service (DE_MILITARY_SERVICE).
9 --
10 -- 1. The Date From (p_pei_information1) must be on or before Date To (p_pei_information2).
11 --
12 -- - Residence Permit (DE_RESIDENCE_PERMITS).
13 --
14 -- 1. The Effective Date (p_pei_information6) must be on or before Expiry Date
15 -- (p_pei_information7).
16 --
17 -- - Work Permit (DE_WORK_PERMITS).
18 --
19 -- 1. The Effective Date (p_pei_information6) must be on or before Expiry Date
20 -- (p_pei_information7).
21 --
22 -- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 --
24 PROCEDURE person_information_checks
25 (p_pei_information_category IN VARCHAR2
26 ,p_pei_information1 IN VARCHAR2
27 ,p_pei_information2 IN VARCHAR2
28 ,p_pei_information6 IN VARCHAR2
29 ,p_pei_information7 IN VARCHAR2) IS
30 --
31 --
32 -- Local exceptions.
33 --
34 military_service_dates EXCEPTION;
35 permit_dates EXCEPTION;
36 --
37 --
38 -- Local variables.
39 --
40 l_lower_date DATE := TO_DATE('01/01/0001','DD/MM/YYYY');
41 l_upper_date DATE := TO_DATE('31/12/4712','DD/MM/YYYY');
42 BEGIN
43 --
44 --
45 -- Check if DE is installed
46 IF hr_utility.chk_product_install('Oracle Human Resources', 'DE') THEN
47
48 -- Military Service validation.
49 --
50 IF p_pei_information_category = 'DE_MILITARY_SERVICE' THEN
51 --
52 --
53 -- Convert parameters to dates.
54 --
55 IF p_pei_information1 IS NOT NULL THEN
56 l_lower_date := TRUNC(fnd_date.canonical_to_date(p_pei_information1));
57 END IF;
58 IF p_pei_information2 IS NOT NULL THEN
59 l_upper_date := TRUNC(fnd_date.canonical_to_date(p_pei_information2));
60 END IF;
61 --
62 --
63 -- Date From > Date To so error.
64 --
65 IF l_lower_date > l_upper_date THEN
66 RAISE military_service_dates;
67 END IF;
68 --
69 --
70 -- Residence Permit validation.
71 --
72 ELSIF p_pei_information_category = 'DE_RESIDENCE_PERMITS' THEN
73 --
74 --
75 -- Convert parameters to dates.
76 --
77 IF p_pei_information6 IS NOT NULL THEN
78 l_lower_date := TRUNC(fnd_date.canonical_to_date(p_pei_information6));
79 END IF;
80 IF p_pei_information7 IS NOT NULL THEN
81 l_upper_date := TRUNC(fnd_date.canonical_to_date(p_pei_information7));
82 END IF;
83 --
84 --
85 -- Effective Date > Expiry Date so error.
86 --
87 IF l_lower_date > l_upper_date THEN
88 RAISE permit_dates;
89 END IF;
90 --
91 --
92 -- Work Permit validation.
93 --
94 ELSIF p_pei_information_category = 'DE_WORK_PERMITS' THEN
95 --
96 --
97 -- Convert parameters to dates.
98 --
99 IF p_pei_information6 IS NOT NULL THEN
100 l_lower_date := TRUNC(fnd_date.canonical_to_date(p_pei_information6));
101 END IF;
102 IF p_pei_information7 IS NOT NULL THEN
103 l_upper_date := TRUNC(fnd_date.canonical_to_date(p_pei_information7));
104 END IF;
105 --
106 --
107 -- Effective Date > Expiry Date so error.
108 --
109 IF l_lower_date > l_upper_date THEN
110 RAISE permit_dates;
111 END IF;
112 END IF;
113
114 END IF;
115 EXCEPTION
116 --
117 --
118 -- Date From is not on or before Date To.
119 --
120 WHEN military_service_dates THEN
121 hr_utility.set_message(800, 'HR_DE_MILITARY_SERVICE_DATES');
122 hr_utility.raise_error;
123 --
124 --
125 -- Effective Date is not on or before Expiry Date.
126 --
127 WHEN permit_dates THEN
128 hr_utility.set_message(800, 'HR_DE_PERMIT_DATES');
129 hr_utility.raise_error;
130 END person_information_checks;
131 END hr_de_extra_person_checks;