[Home] [Help]
PACKAGE BODY: APPS.PER_ZA_EQT_BUS
Source
1 Package Body per_za_eqt_bus as
2 /* $Header: pezaeqbu.pkb 115.0 2001/02/04 22:31:38 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_za_eqt_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------< chk_qualification_type_id >-----------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure chk_qualification_type_id(p_qualification_type_id in number,
14 p_object_version_number in number) is
15 --
16 l_proc varchar2(72) := g_package||'chk_qualification_type_id';
17 l_api_updating boolean;
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 l_api_updating := per_za_eqt_shd.api_updating
23 (p_qualification_type_id => p_qualification_type_id,
24 p_object_version_number => p_object_version_number);
25 --
26 if (l_api_updating and
27 nvl(p_qualification_type_id,hr_api.g_number)
28 <> per_za_eqt_shd.g_old_rec.qualification_type_id or
29 not l_api_updating) then
30 --
31 if p_qualification_type_id is not null and
32 not l_api_updating then
33 --
34 -- raise error as PK not null
35 --
36 per_za_eqt_shd.constraint_error('PER_QUALIFICATION_TYPES_PK');
37 --
38 end if;
39 --
40 -- check if qualification_type_id has been updated
41 --
42 if nvl(p_qualification_type_id,hr_api.g_number)
43 <> per_za_eqt_shd.g_old_rec.qualification_type_id
44 and l_api_updating then
45 --
46 -- raise error as update is not allowed
47 --
48 per_za_eqt_shd.constraint_error('PER_QUALIFICATION_TYPES_PK');
49 --
50 end if;
51 --
52 end if;
53 --
54 hr_utility.set_location('Leaving:'||l_proc,5);
55 --
56 end chk_qualification_type_id;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |-----------------------< chk_qualification_name >-------------------------|
60 -- ----------------------------------------------------------------------------
61 Procedure chk_qualification_name(p_qualification_type_id in number,
62 p_name in varchar2,
63 p_object_version_number in number) is
64 --
65 l_proc varchar2(72) := g_package||'chk_qualification_name';
66 l_api_updating boolean;
67 l_dummy varchar2(1);
68 --
69 cursor c1 is
70 select null
71 from per_qualification_types per
72 where per.name = p_name;
73 --
74 Begin
75 hr_utility.set_location('Entering:'||l_proc, 5);
76 --
77 l_api_updating := per_za_eqt_shd.api_updating
78 (p_qualification_type_id => p_qualification_type_id,
79 p_object_version_number => p_object_version_number);
80 --
81 if (l_api_updating and
82 nvl(p_name,hr_api.g_varchar2) <> per_za_eqt_shd.g_old_rec.name or
83 not l_api_updating) then
84 --
85 if p_name is null then
86 --
87 -- raise error
88 --
89 per_za_eqt_shd.constraint_error('PER_QUALIFICATION_TYPES_UK');
90 --
91 end if;
92 --
93 -- check if the qualification name exists in the per_qualification_types
94 -- table.
95 --
96 if p_name <> per_za_eqt_shd.g_old_rec.name then
97 --
98 -- only check if it has changed so as to avoid unneccessary accesses to
99 -- the database
100 --
101 open c1;
102 --
103 fetch c1 into l_dummy;
104 if c1%found then
105 --
106 -- raise error
107 --
108 close c1;
109 per_za_eqt_shd.constraint_error('PER_QUALIFICATION_TYPES_UK');
110 --
111 end if;
112 --
113 close c1;
114 --
115 end if;
116 --
117 end if;
118 --
119 hr_utility.set_location('Leaving:'||l_proc,5);
120 --
121 end chk_qualification_name;
122 -- ----------------------------------------------------------------------------
123 -- |-----------------------------< chk_category >-----------------------------|
124 -- ----------------------------------------------------------------------------
125 --
126 -- Description
127 -- This procedure is used to check that the category lookup exists within the
128 -- lookup 'PER_CATEGORIES'.
129 --
130 -- Pre Conditions
131 -- None.
132 --
133 -- In Parameters
134 -- qualification_type_id PK of record being inserted or updated.
135 -- category value of lookup_code
136 -- effective_date effective date
137 -- object_version_number Object version number of record being
138 -- inserted or updated.
139 --
140 -- Post Success
141 -- Processing continues
142 --
143 -- Post Failure
144 -- Error handled by procedure
145 --
146 -- Access Status
147 -- Internal table handler use only.
148 --
149 Procedure chk_category(p_qualification_type_id in number,
150 p_category in varchar2,
151 p_effective_date in date,
152 p_object_version_number in number) is
153 --
154 l_proc varchar2(72) := g_package||'chk_category';
155 l_api_updating boolean;
156 --
157 Begin
158 --
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 --
161 l_api_updating := per_za_eqt_shd.api_updating
162 (p_qualification_type_id => p_qualification_type_id,
163 p_object_version_number => p_object_version_number);
164 --
165 if (l_api_updating
166 and nvl(p_category,hr_api.g_varchar2)
167 <> per_za_eqt_shd.g_old_rec.category
168 or not l_api_updating) then
169 --
170 -- check if value of category exists in lookup 'PER_CATEGORIES'
171 --
172 if hr_api.not_exists_in_hr_lookups(p_lookup_type => 'PER_CATEGORIES',
173 p_lookup_code => p_category,
174 p_effective_date => p_effective_date) then
175 --
176 -- raise error as does not exist as lookup
177 --
178 hr_utility.set_message(801,'HR_51880_EQT_CAT_LKP');
179 hr_utility.raise_error;
180 --
181 end if;
182 --
183 end if;
184 --
185 hr_utility.set_location('Leaving:'||l_proc,10);
186 --
187 end chk_category;
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------< chk_qualification_delete >-----------------------|
190 -- ----------------------------------------------------------------------------
191 Procedure chk_qualification_delete(p_qualification_type_id in number) is
192 --
193 l_proc varchar2(72) := g_package||'chk_qualification_delete';
194 l_api_updating boolean;
195 l_dummy varchar2(1);
196 --
197 cursor c1 is
198 select null
199 from per_qualifications per
200 where per.qualification_type_id = p_qualification_type_id;
201 --
202 Begin
203 --
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 --
206 open c1;
207 --
208 fetch c1 into l_dummy;
209 --
210 if c1%found then
211 --
212 -- error cannot delete qualification_type_id as it is used in the
213 -- per_qualifications table
214 --
215 close c1;
216 hr_utility.set_message(801,'HR_51537_EQT_QUAL_TAB_REF');
217 hr_utility.raise_error;
218 --
219 end if;
220 --
221 close c1;
222 --
223 hr_utility.set_location('Leaving:'||l_proc,5);
224 --
225 end chk_qualification_delete;
226 -- ----------------------------------------------------------------------------
227 -- |---------------------------< insert_validate >----------------------------|
228 -- ----------------------------------------------------------------------------
229 Procedure insert_validate(p_rec in per_za_eqt_shd.g_rec_type,
230 p_effective_date in date) is
231 --
232 l_proc varchar2(72) := g_package||'insert_validate';
233 --
234 Begin
235 --
236 hr_utility.set_location('Entering:'||l_proc, 5);
237 --
238 -- Call all supporting business operations
239 --
240 -- Business Rule Mapping
241 -- =====================
242 -- CHK_QUALIFICATION_TYPE_ID
243 --
244 chk_qualification_type_id(p_rec.qualification_type_id,
245 p_rec.object_version_number);
246 --
247 -- Business Rule Mapping
248 -- =====================
249 -- CHK_QUALIFICATION_NAME
250 -- CHK_QUALIFICATION_NAME_UNIQUE
251 --
252 chk_qualification_name(p_rec.qualification_type_id,
253 p_rec.name,
254 p_rec.object_version_number);
255 -- Business Rule Mapping
256 -- =====================
257 -- CHK_CATEGORY
258 --
259 chk_category(p_rec.qualification_type_id,
260 p_rec.category,
261 p_effective_date,
262 p_rec.object_version_number);
263 --
264 -- Descriptive Flex Check
265 -- ======================
266 --
267 IF hr_general.get_calling_context <>'FORMS' THEN
268 per_za_eqt_flex.df(p_rec => p_rec);
269 END IF;
270 --
271 hr_utility.set_location(' Leaving:'||l_proc, 10);
272 --
273 End insert_validate;
274 --
275 -- ----------------------------------------------------------------------------
276 -- |---------------------------< update_validate >----------------------------|
277 -- ----------------------------------------------------------------------------
278 Procedure update_validate(p_rec in per_za_eqt_shd.g_rec_type,
279 p_effective_date in date) is
280 --
281 l_proc varchar2(72) := g_package||'update_validate';
282 --
283 Begin
284 --
285 hr_utility.set_location('Entering:'||l_proc, 5);
286 --
287 -- Call all supporting business operations
288 --
289 -- Business Rule Mapping
290 -- =====================
291 -- CHK_QUALIFICATION_TYPE_ID
292 --
293 chk_qualification_type_id(p_rec.qualification_type_id,
294 p_rec.object_version_number);
295 --
296 -- Business Rule Mapping
297 -- =====================
298 -- CHK_QUALIFICATION_NAME
299 -- CHK_QUALIFICATION_NAME_UNIQUE
300 --
301 chk_qualification_name(p_rec.qualification_type_id,
302 p_rec.name,
303 p_rec.object_version_number);
304 -- Business Rule Mapping
305 -- =====================
306 -- CHK_CATEGORY
307 --
308 chk_category(p_rec.qualification_type_id,
309 p_rec.category,
310 p_effective_date,
311 p_rec.object_version_number);
312 --
313 -- Descriptive Flex Check
314 -- ======================
315 --
316 IF hr_general.get_calling_context <>'FORMS' THEN
317 per_za_eqt_flex.df(p_rec => p_rec);
318 END IF;
319 --
320 hr_utility.set_location(' Leaving:'||l_proc, 10);
321 --
322 End update_validate;
323 --
324 -- ----------------------------------------------------------------------------
325 -- |---------------------------< delete_validate >----------------------------|
326 -- ----------------------------------------------------------------------------
327 Procedure delete_validate(p_rec in per_za_eqt_shd.g_rec_type) is
328 --
329 l_proc varchar2(72) := g_package||'delete_validate';
330 --
331 Begin
332 hr_utility.set_location('Entering:'||l_proc, 5);
333 --
334 -- Call all supporting business operations
335 --
336 -- Business Rule Mapping
337 -- =====================
338 -- CHK_QUALIFICATION_DELETE
339 --
340 chk_qualification_delete(p_rec.qualification_type_id);
341 --
342 hr_utility.set_location(' Leaving:'||l_proc, 10);
343 End delete_validate;
344 --
345 end per_za_eqt_bus;