[Home] [Help]
PACKAGE BODY: APPS.PER_SHA_BUS
Source
1 Package Body per_sha_bus as
2 /* $Header: pesharhi.pkb 115.6 2002/12/06 16:54:11 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sha_bus.'; -- Global package name
9 --
10 --
11 -- The following two global variables are only to be used by the
12 -- return_legislation_code function.
13 --
14 g_std_holiday_absences_id number default null;
15 g_legislation_code varchar2(150) default null;
16 --
17 -- -----------------------------------------------------------------
18 -- |-----------------------< chk_non_updateable_args >--------------|
19 -- -----------------------------------------------------------------
20 --
21 Procedure chk_non_updateable_args
22 (p_rec in per_sha_shd.g_rec_type
23 ) is
24 --
25 l_proc varchar2(72) := g_package||'chk_non_updateable_args';
26 l_error exception;
27 l_argument varchar2(30);
28 --
29 Begin
30 hr_utility.set_location('Entering:'||l_proc, 10);
31 --
32 -- Only proceed with validation if a row exists for
33 -- the current record in the HR Schema
34 --
35 if not per_sha_shd.api_updating
36 (p_std_holiday_absences_id => p_rec.std_holiday_absences_id,
37 p_object_version_number => p_rec.object_version_number)
38 then
39 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
40 hr_utility.set_message_token('PROCEDURE', l_proc);
41 hr_utility.set_message_token('STEP', '20');
42 hr_utility.raise_error;
43 end if;
44 hr_utility.set_location(l_proc, 30);
45 --
46 if nvl(p_rec.person_id, hr_api.g_number) <>
47 nvl(per_sha_shd.g_old_rec.person_id
48 ,hr_api.g_number
49 ) then
50 l_argument := 'person_id';
51 raise l_error;
52 end if;
53 --
54 hr_utility.set_location(l_proc, 40);
55 exception
56 when l_error then
57 hr_api.argument_changed_error
58 (p_api_name => l_proc
59 ,p_argument => l_argument
60 );
61 when others then
62 raise;
63 hr_utility.set_location(' Leaving:'||l_proc, 50);
64 end chk_non_updateable_args;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-------------------------< chk_date_not_taken >---------------------------|
68 -- ----------------------------------------------------------------------------
69 --
70 -- Descriiption :
71 --
72 -- DATE_NOT_TAKEN is mandatory and cannot be updated if the ACTUAL_DATE_TAKEN
73 -- is not NULL or the expired flag is set.
74 --
75 -- Pre-conditions :
76 -- Format for date_not_taken must be correct
77 --
78 -- In Arguments :
79 -- p_std_holiday_absences_id
80 -- p_date_not_taken
81 -- p_actual_date_taken
82 -- p_expired
83 -- p_object_version_number
84 --
85 -- Post Success :
86 -- Processing continues
87 --
88 -- Post Failure :
89 -- An application error will be raised and processing is
90 -- terminated
91 --
92 -- Access Status :
93 -- Internal Table Handler Use only.
94 --
95 -- {End of Comments}
96 --
97 -- ---------------------------------------------------------------------------
98 procedure chk_date_not_taken
99 (p_std_holiday_absences_id in per_std_holiday_absences.std_holiday_absences_id%TYPE
100 ,p_date_not_taken in per_std_holiday_absences.date_not_taken%TYPE
101 ,p_actual_date_taken in per_std_holiday_absences.actual_date_taken%TYPE
102 ,p_expired in per_std_holiday_absences.expired%TYPE
103 ,p_object_version_number in per_std_holiday_absences.object_version_number%TYPE
104 ) is
105 --
106 l_proc varchar2(72) := g_package||'chk_date_not_taken';
107 l_api_updating boolean;
108 --
109 begin
110 hr_utility.set_location('Entering:'||l_proc, 10);
111 --
112 -- Check mandatory parameters have been set
113 --
114 BEGIN
115 hr_api.mandatory_arg_error
116 (p_api_name => l_proc
117 ,p_argument => 'date_not_taken'
118 ,p_argument_value => p_date_not_taken
119 );
120 EXCEPTION
121 WHEN OTHERS THEN
122 hr_utility.set_message(800,'PER_50042_DATE_NOT_TAKEN_NULL');
123 hr_utility.raise_error;
124 END;
125 --
126 -- Check whether field is being updated
127 --
128 l_api_updating := per_sha_shd.api_updating
129 (p_std_holiday_absences_id => p_std_holiday_absences_id,
130 p_object_version_number => p_object_version_number);
131 --
132 if (l_api_updating AND
133 per_sha_shd.g_old_rec.date_not_taken <> p_date_not_taken) then
134 --
135 -- Check whether the ACTUAL_DATE_TAKEN is NULL
136 --
137 if (p_actual_date_taken IS NOT NULL) then
138 hr_utility.set_message(800,'PER_50029_SHA_HOL_UPDATE');
139 hr_utility.raise_error;
140 elsif (p_expired = 'Y') then
141 hr_utility.set_message(800,'PER_50040_SHA_HOL_UPDATE_EXPD');
142 hr_utility.raise_error;
143 end if;
144 end if;
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 3);
147 --
148 end chk_date_not_taken;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |----------------------------< chk_person_id >-----------------------------|
152 -- ----------------------------------------------------------------------------
153 --
154 -- Descriiption :
155 -- PERSON_ID is mandatory and must exist in PER_PEOPLE_F for the date
156 -- of the holiday, DATE_NOT_TAKEN.
157 --
158 -- Pre-conditions :
159 -- None
160 --
161 -- In Arguments :
162 -- p_std_holiday_absences_id
163 -- p_person_id
164 -- p_date_not_taken
165 --
166 -- Post Success :
167 -- Processing continues
168 --
169 -- Post Failure :
170 -- An application error will be raised and processing is
171 -- terminated
172 --
173 -- Access Status :
174 -- Internal Table Handler Use only.
175 --
176 -- {End of Comments}
177 --
178 -- ---------------------------------------------------------------------------
179 procedure chk_person_id
180 (p_std_holiday_absences_id in per_std_holiday_absences.std_holiday_absences_id%TYPE
181 ,p_person_id in per_std_holiday_absences.person_id%TYPE
182 ,p_date_not_taken in per_std_holiday_absences.date_not_taken%TYPE
183 ) is
184 --
185 l_proc varchar2(72) := g_package||'chk_person_id';
186 l_dummy number;
187 --
188 CURSOR csr_valid_person_id IS
189 SELECT per.person_id
190 FROM per_people_f per
191 WHERE per.person_id = p_person_id
192 AND p_date_not_taken BETWEEN per.effective_start_date
193 AND per.effective_end_date;
194 begin
195 hr_utility.set_location('Entering:'||l_proc, 10);
196 --
197 -- Check mandatory parameters have been set
198 --
199 hr_api.mandatory_arg_error
200 (p_api_name => l_proc
201 ,p_argument => 'person_id'
202 ,p_argument_value => p_person_id
203 );
204 --
205 -- Check that the PERSON_ID exists in PER_PEOPLE_F
206 --
207 open csr_valid_person_id;
208 fetch csr_valid_person_id into l_dummy;
209 if (csr_valid_person_id%NOTFOUND) then
210 close csr_valid_person_id;
211 hr_utility.set_message(800,'HR_52361_PTU_INVALID_PERSON_ID');
212 hr_utility.raise_error;
213 end if;
214 --
215 hr_utility.set_location(' Leaving:'||l_proc, 3);
216 --
217 end chk_person_id;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |----------------------< chk_standard_holiday_id >-------------------------|
221 -- ----------------------------------------------------------------------------
222 --
223 -- Descriiption :
224 -- STANDARD_HOLIDAY_ID is mandatory and must exist in
225 -- PER_STANDARD_HOLIDAYS
226 --
227 -- Pre-conditions :
228 -- None
229 --
230 -- In Arguments :
231 -- p_std_holiday_absences_id
232 -- p_standard_holiday_id
233 -- p_actual_date_taken
234 -- p_expired
235 -- p_object_version_number
236 --
237 -- Post Success :
238 -- Processing continues
239 --
240 -- Post Failure :
241 -- An application error will be raised and processing is
242 -- terminated
243 --
244 -- Access Status :
245 -- Internal Table Handler Use only.
246 --
247 -- {End of Comments}
248 --
249 -- ---------------------------------------------------------------------------
250 procedure chk_standard_holiday_id
251 (p_std_holiday_absences_id in per_std_holiday_absences.std_holiday_absences_id%TYPE
252 ,p_standard_holiday_id in per_std_holiday_absences.standard_holiday_id%TYPE
253 ,p_actual_date_taken in per_std_holiday_absences.actual_date_taken%TYPE
254 ,p_expired in per_std_holiday_absences.expired%TYPE
255 ,p_object_version_number in per_std_holiday_absences.object_version_number%TYPE
256 ) is
257 --
258 l_proc varchar2(72) := g_package||'chk_standard_holiday_id';
259 l_dummy number;
260 l_api_updating boolean;
261 --
262 CURSOR csr_valid_std_hol_id IS
263 SELECT sth.standard_holiday_id
264 FROM per_standard_holidays sth
265 WHERE sth.standard_holiday_id = p_standard_holiday_id;
266 begin
267 hr_utility.set_location('Entering:'||l_proc, 10);
268 --
269 -- Check mandatory parameters have been set
270 --
271 hr_api.mandatory_arg_error
272 (p_api_name => l_proc
273 ,p_argument => 'standard_holiday_id'
274 ,p_argument_value => p_standard_holiday_id
275 );
276 --
277 -- Check that the STANDARD_HOLIDAY_ID exists in PER_STANDARD_HOLIDAYS
278 --
279 open csr_valid_std_hol_id;
280 fetch csr_valid_std_hol_id into l_dummy;
281 if (csr_valid_std_hol_id%NOTFOUND) then
282 close csr_valid_std_hol_id;
283 hr_utility.set_message(800,'PER_50038_SHA_INVALID_HOL_ID');
284 hr_utility.raise_error;
285 end if;
286 --
287 -- Update is not allowed if the ACTUAL_DATE_TAKEN is not NULL or the
288 -- EXPIRED flag is 'checked'
289 --
290 l_api_updating := per_sha_shd.api_updating
291 (p_std_holiday_absences_id => p_std_holiday_absences_id,
292 p_object_version_number => p_object_version_number);
293 --
294 if (l_api_updating AND
295 per_sha_shd.g_old_rec.standard_holiday_id <> p_standard_holiday_id) then
296 if (p_actual_date_taken is not NULL) then
297 hr_utility.set_message(800,'PER_50028_SHA_HOL_UPDATE_ID');
298 hr_utility.raise_error;
299 elsif (p_expired = 'Y') then
300 hr_utility.set_message(800,'PER_50039_SHA_EXPIRED_POP');
301 hr_utility.raise_error;
302 end if;
303 end if;
304 --
305 hr_utility.set_location(' Leaving:'||l_proc, 3);
306 --
307 end chk_standard_holiday_id;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |-----------------------< chk_actual_date_taken >--------------------------|
311 -- ----------------------------------------------------------------------------
312 --
313 -- Descriiption :
314 -- This check procedure ensures that
315 -- a) the ACTUAL_DATE_TAKEN does not overlap with the Standard Holidays
316 -- defined for the Legislation/Sub-Legislation.
317 -- b) the ACTUAL_DATE_TAKEN cannot be updated if the expired flag is set.
318 --
319 -- Pre-conditions :
320 -- None
321 --
322 -- In Arguments :
323 -- p_std_holiday_absences_id
324 -- p_actual_date_taken
325 -- p_person_id
326 -- p_expired
327 -- p_object_version_number
328 --
329 -- Post Success :
330 -- Processing continues
331 --
332 -- Post Failure :
333 -- An application error will be raised and processing is
334 -- terminated
335 --
336 -- Access Status :
337 -- Internal Table Handler Use only.
338 --
339 -- {End of Comments}
340 --
341 -- ---------------------------------------------------------------------------
342 procedure chk_actual_date_taken
343 (p_std_holiday_absences_id in per_std_holiday_absences.std_holiday_absences_id%TYPE
344 ,p_actual_date_taken in per_std_holiday_absences.actual_date_taken%TYPE
345 ,p_person_id in per_std_holiday_absences.person_id%TYPE
346 ,p_expired in per_std_holiday_absences.expired%TYPE
347 ,p_object_version_number in per_std_holiday_absences.object_version_number%TYPE
348 ) is
349 --
350 l_proc varchar2(72) := g_package||'chk_actual_date_taken';
351 l_dummy number(15);
352 l_api_updating boolean;
353 --
354 CURSOR csr_valid_actual_date_taken IS
355 SELECT NVL(sth.standard_holiday_id,99)
356 FROM per_standard_holidays sth,
357 per_people_f per,
358 per_business_groups bus
359 WHERE per.person_id = p_person_id
360 AND p_actual_date_taken BETWEEN per.effective_start_date
361 AND per.effective_end_date
362 AND bus.business_group_id = per.business_group_id
363 AND sth.legislation_code = bus.legislation_code
364 AND p_actual_date_taken BETWEEN sth.holiday_date
365 AND NVL(sth.holiday_date_end, sth.holiday_date);
366 --
367 begin
368 hr_utility.set_location('Entering:'||l_proc, 10);
369 --
370 -- Check whether field is being updated
371 --
372 l_api_updating := per_sha_shd.api_updating
373 (p_std_holiday_absences_id => p_std_holiday_absences_id,
374 p_object_version_number => p_object_version_number);
375 --
376 if ((l_api_updating AND
377 nvl(per_sha_shd.g_old_rec.actual_date_taken, hr_api.g_date) <>
378 nvl(p_actual_date_taken, hr_api.g_date))
379 OR
380 (NOT l_api_updating AND p_actual_date_taken IS NOT NULL)) then
381 --
382 -- Check that the EXPIRED flag is not checked
383 --
384 if (p_expired = 'Y') then
385 hr_utility.set_message(801,'PER_50026_SHA_EXPIRED_CHKD');
386 hr_utility.raise_error;
387 end if;
388 --
389 -- Check that the ACTUAL_DATE_TAKEN does not overlap with any of the
390 -- Standard Holidays
391 --
392 open csr_valid_actual_date_taken;
393 fetch csr_valid_actual_date_taken into l_dummy;
394 if (csr_valid_actual_date_taken%FOUND) then
395 close csr_valid_actual_date_taken;
396 hr_utility.set_message(800,'PER_50025_SHA_DATE_NO_OVERLAP');
397 hr_utility.raise_error;
398 end if;
399 end if;
400 --
401 hr_utility.set_location(' Leaving:'||l_proc, 3);
402 --
403 end chk_actual_date_taken;
404 --
405 -- ----------------------------------------------------------------------------
406 -- |---------------------------< chk_expired >--------------------------------|
407 -- ----------------------------------------------------------------------------
408 --
409 -- Descriiption :
410 -- This check procedure ensures that the EXPIRED flag is not checked if
411 -- the ACTUAL_DATE_TAKEN is not NULL
412 --
413 -- Pre-conditions :
414 -- This must be either 'Y' or 'N'
415 --
416 -- In Arguments :
417 -- p_std_holiday_absences_id
418 -- p_expired
419 -- p_actual_date_taken
420 -- p_object_version_number
421 --
422 -- Post Success :
423 -- Processing continues
424 --
425 -- Post Failure :
429 -- Access Status :
426 -- An application error will be raised and processing is
427 -- terminated
428 --
430 -- Internal Table Handler Use only.
431 --
432 -- {End of Comments}
433 --
434 -- ---------------------------------------------------------------------------
435 procedure chk_expired
436 (p_std_holiday_absences_id in per_std_holiday_absences.std_holiday_absences_id%TYPE
437 ,p_expired in per_std_holiday_absences.expired%TYPE
438 ,p_actual_date_taken in per_std_holiday_absences.actual_date_taken%TYPE
439 ,p_object_version_number in per_std_holiday_absences.object_version_number%TYPE
440 ) is
441 --
442 l_proc varchar2(72) := g_package||'chk_expired';
443 l_api_updating boolean;
444 --
445 begin
446 hr_utility.set_location('Entering:'||l_proc, 10);
447 --
448 -- Check whether field is being updated
449 --
450 l_api_updating := per_sha_shd.api_updating
451 (p_std_holiday_absences_id => p_std_holiday_absences_id,
452 p_object_version_number => p_object_version_number);
453
454 if ((l_api_updating AND
455 nvl(per_sha_shd.g_old_rec.expired, hr_api.g_varchar2) <>
456 nvl(p_expired, hr_api.g_varchar2))
457 OR
458 NOT l_api_updating) then
459 --
460 -- The EXPIRED flag can only be set if the ACTUAL_DATE_TAKEN is NULL
461 --
462 if (p_actual_date_taken is not NULL AND
463 p_expired = 'Y') then
464 hr_utility.set_message(800,'PER_50027_SHA_EXPIRED_UPD');
465 hr_utility.raise_error;
466 end if;
467 end if;
468 --
469 hr_utility.set_location(' Leaving:'||l_proc, 3);
470 --
471 end chk_expired;
472 --
473 -- -----------------------------------------------------------------------
474 -- |------------------------------< chk_df >-----------------------------|
475 -- -----------------------------------------------------------------------
476 --
477 -- Description:
478 -- Validates the all Descriptive Flexfield values.
479 --
480 -- Pre-conditions:
481 -- All other columns have been validated. Must be called as the
482 -- last step from insert_validate and update_validate.
483 --
484 -- In Arguments:
485 -- p_rec
486 --
487 -- Post Success:
488 -- If the Descriptive Flexfield structure column and data values are
489 -- all valid this procedure will end normally and processing will
490 -- continue.
491 --
492 -- Post Failure:
493 -- If the Descriptive Flexfield structure column value or any of
494 -- the data values are invalid then an application error is raised as
495 -- a PL/SQL exception.
496 --
497 -- Access Status:
498 -- Internal Row Handler Use Only.
499 --
500 procedure chk_df
501 (p_rec in per_sha_shd.g_rec_type) is
502 --
503 l_proc varchar2(72) := g_package||'chk_df';
504 --
505 begin
506 hr_utility.set_location('Entering:'||l_proc, 10);
507 --
508 if ((p_rec.std_holiday_absences_id is not null) and (
509 nvl(per_sha_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
510 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
511 nvl(per_sha_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
512 nvl(p_rec.attribute1, hr_api.g_varchar2) or
513 nvl(per_sha_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
514 nvl(p_rec.attribute2, hr_api.g_varchar2) or
515 nvl(per_sha_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
516 nvl(p_rec.attribute3, hr_api.g_varchar2) or
517 nvl(per_sha_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
518 nvl(p_rec.attribute4, hr_api.g_varchar2) or
519 nvl(per_sha_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
520 nvl(p_rec.attribute5, hr_api.g_varchar2) or
521 nvl(per_sha_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
522 nvl(p_rec.attribute6, hr_api.g_varchar2) or
523 nvl(per_sha_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
524 nvl(p_rec.attribute7, hr_api.g_varchar2) or
525 nvl(per_sha_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
526 nvl(p_rec.attribute8, hr_api.g_varchar2) or
527 nvl(per_sha_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
528 nvl(p_rec.attribute9, hr_api.g_varchar2) or
529 nvl(per_sha_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
530 nvl(p_rec.attribute10, hr_api.g_varchar2) or
531 nvl(per_sha_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
532 nvl(p_rec.attribute11, hr_api.g_varchar2) or
533 nvl(per_sha_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
534 nvl(p_rec.attribute12, hr_api.g_varchar2) or
535 nvl(per_sha_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
536 nvl(p_rec.attribute13, hr_api.g_varchar2) or
537 nvl(per_sha_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
538 nvl(p_rec.attribute14, hr_api.g_varchar2) or
539 nvl(per_sha_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
540 nvl(p_rec.attribute15, hr_api.g_varchar2) or
541 nvl(per_sha_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
542 nvl(p_rec.attribute16, hr_api.g_varchar2) or
543 nvl(per_sha_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
544 nvl(p_rec.attribute17, hr_api.g_varchar2) or
545 nvl(per_sha_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
546 nvl(p_rec.attribute18, hr_api.g_varchar2) or
547 nvl(per_sha_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
551 or
548 nvl(p_rec.attribute19, hr_api.g_varchar2) or
549 nvl(per_sha_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
550 nvl(p_rec.attribute20, hr_api.g_varchar2)))
552 (p_rec.std_holiday_absences_id is null) then
553 --
554 -- Only execute the validation if absolutely necessary:
555 -- a) During update, the structure column value or any
556 -- of the attribute values have actually changed.
557 -- b) During insert.
558 --
559 hr_dflex_utility.ins_or_upd_descflex_attribs
560 (p_appl_short_name => 'PER'
561 ,p_descflex_name => 'PER_STD_HOLIDAY_ABSENCES'
562 ,p_attribute_category => p_rec.attribute_category
563 ,p_attribute1_name => 'ATTRIBUTE1'
564 ,p_attribute1_value => p_rec.attribute1
565 ,p_attribute2_name => 'ATTRIBUTE2'
566 ,p_attribute2_value => p_rec.attribute2
567 ,p_attribute3_name => 'ATTRIBUTE3'
568 ,p_attribute3_value => p_rec.attribute3
569 ,p_attribute4_name => 'ATTRIBUTE4'
570 ,p_attribute4_value => p_rec.attribute4
571 ,p_attribute5_name => 'ATTRIBUTE5'
572 ,p_attribute5_value => p_rec.attribute5
573 ,p_attribute6_name => 'ATTRIBUTE6'
574 ,p_attribute6_value => p_rec.attribute6
575 ,p_attribute7_name => 'ATTRIBUTE7'
576 ,p_attribute7_value => p_rec.attribute7
577 ,p_attribute8_name => 'ATTRIBUTE8'
578 ,p_attribute8_value => p_rec.attribute8
579 ,p_attribute9_name => 'ATTRIBUTE9'
580 ,p_attribute9_value => p_rec.attribute9
581 ,p_attribute10_name => 'ATTRIBUTE10'
582 ,p_attribute10_value => p_rec.attribute10
583 ,p_attribute11_name => 'ATTRIBUTE11'
584 ,p_attribute11_value => p_rec.attribute11
585 ,p_attribute12_name => 'ATTRIBUTE12'
586 ,p_attribute12_value => p_rec.attribute12
587 ,p_attribute13_name => 'ATTRIBUTE13'
588 ,p_attribute13_value => p_rec.attribute13
589 ,p_attribute14_name => 'ATTRIBUTE14'
590 ,p_attribute14_value => p_rec.attribute14
591 ,p_attribute15_name => 'ATTRIBUTE15'
592 ,p_attribute15_value => p_rec.attribute15
593 ,p_attribute16_name => 'ATTRIBUTE16'
594 ,p_attribute16_value => p_rec.attribute16
595 ,p_attribute17_name => 'ATTRIBUTE17'
596 ,p_attribute17_value => p_rec.attribute17
597 ,p_attribute18_name => 'ATTRIBUTE18'
598 ,p_attribute18_value => p_rec.attribute18
599 ,p_attribute19_name => 'ATTRIBUTE19'
600 ,p_attribute19_value => p_rec.attribute19
601 ,p_attribute20_name => 'ATTRIBUTE20'
602 ,p_attribute20_value => p_rec.attribute20
603 );
604 end if;
605 --
606 hr_utility.set_location(' Leaving:'||l_proc, 20);
607 --
608 end chk_df;
609 --
610 -- ----------------------------------------------------------------------------
611 -- |---------------------------< insert_validate >----------------------------|
612 -- ----------------------------------------------------------------------------
613 Procedure insert_validate(p_rec in per_sha_shd.g_rec_type) is
614 --
615 l_proc varchar2(72) := g_package||'insert_validate';
616 --
617 Begin
618 hr_utility.set_location('Entering:'||l_proc, 5);
619 --
620 -- As this data is not within the context of a business group
621 -- the set_security_group_id procedure has zero passed
622 -- to it as the default security_group_id.
623 --
624 hr_api.set_security_group_id(p_security_group_id => 0);
625 --
626 hr_utility.set_location('Entering:'||l_proc, 7);
627 --
628 -- Validate Standard Holiday Dates not taken
629 --
630 chk_date_not_taken
631 (p_rec.std_holiday_absences_id,
632 p_rec.date_not_taken,
633 p_rec.actual_date_taken,
634 p_rec.expired,
635 p_rec.object_version_number);
636 --
637 -- Validate Person
638 --
639 chk_person_id
640 (p_rec.std_holiday_absences_id,
641 p_rec.person_id,
642 p_rec.date_not_taken);
643 --
644 -- Validate Standard Holiday Id
645 --
646 chk_standard_holiday_id
647 (p_rec.std_holiday_absences_id,
648 p_rec.standard_holiday_id,
649 p_rec.actual_date_taken,
650 p_rec.expired,
651 p_rec.object_version_number);
652 hr_utility.set_location(' Leaving:'||l_proc, 10);
653 --
654 -- Validate Actual Date Taken
655 --
656 chk_actual_date_taken
657 (p_rec.std_holiday_absences_id,
658 p_rec.actual_date_taken,
659 p_rec.person_id,
660 p_rec.expired,
661 p_rec.object_version_number);
662 --
663 -- Validate Expire Flag
664 --
665 chk_expired
666 (p_rec.std_holiday_absences_id,
667 p_rec.expired,
668 p_rec.actual_date_taken,
669 p_rec.object_version_number);
670 --
671 hr_utility.set_location(' Leaving:'||l_proc, 15);
672 -- call descriptive flexfield validation routines
673 --
674 per_sha_bus.chk_df(p_rec => p_rec);
675 --
676 hr_utility.set_location (l_proc, 20);
677 End insert_validate;
678 --
679 -- ----------------------------------------------------------------------------
680 -- |---------------------------< update_validate >----------------------------|
681 -- ----------------------------------------------------------------------------
682 Procedure update_validate(p_rec in per_sha_shd.g_rec_type) is
683 --
684 l_proc varchar2(72) := g_package||'update_validate';
685 --
686 Begin
687 hr_utility.set_location('Entering:'||l_proc, 5);
688 --
689 -- As this data is not within the context of a business group
690 -- the set_security_group_id procedure has zero passed
691 -- to it as the default security_group_id.
692 --
693 hr_api.set_security_group_id(p_security_group_id => 0);
694 --
695 hr_utility.set_location('Entering:'||l_proc, 7);
696 --
697 -- Check no non-updateable arguments have been updated
698 --
699 chk_non_updateable_args (p_rec => p_rec);
700 --
701 -- Validate Standard Holiday Dates not taken
702 --
703 chk_date_not_taken
704 (p_rec.std_holiday_absences_id,
705 p_rec.date_not_taken,
706 p_rec.actual_date_taken,
707 p_rec.expired,
711 --
708 p_rec.object_version_number);
709 --
710 -- Validate Standard Holiday Id
712 chk_standard_holiday_id
713 (p_rec.std_holiday_absences_id,
714 p_rec.standard_holiday_id,
715 p_rec.actual_date_taken,
716 p_rec.expired,
717 p_rec.object_version_number);
718 hr_utility.set_location(' Leaving:'||l_proc, 10);
719 --
720 -- Validate Actual Date Taken
721 --
722 chk_actual_date_taken
723 (p_rec.std_holiday_absences_id,
724 p_rec.actual_date_taken,
725 p_rec.person_id,
726 p_rec.expired,
727 p_rec.object_version_number);
728 --
729 -- Validate Expire Flag
730 --
731 chk_expired
732 (p_rec.std_holiday_absences_id,
733 p_rec.expired,
734 p_rec.actual_date_taken,
735 p_rec.object_version_number);
736 --
737 --
738 hr_utility.set_location (l_proc, 15);
739 --
740 -- call descriptive flexfield validation routines
741 --
742 per_sha_bus.chk_df(p_rec => p_rec);
743 --
744 hr_utility.set_location(' Leaving:'||l_proc, 20);
745 --
746 End update_validate;
747 --
748 -- ----------------------------------------------------------------------------
749 -- |---------------------------< delete_validate >----------------------------|
750 -- ----------------------------------------------------------------------------
751 Procedure delete_validate(p_rec in per_sha_shd.g_rec_type) is
752 --
753 l_proc varchar2(72) := g_package||'delete_validate';
754 --
755 Begin
756 hr_utility.set_location('Entering:'||l_proc, 5);
757 --
758 -- Call all supporting business operations
759 --
760 hr_utility.set_location(' Leaving:'||l_proc, 10);
761 End delete_validate;
762 --
763 --
764 -- ---------------------------------------------------------------------------
765 -- |---------------------< return_legislation_code >-------------------------|
766 -- ---------------------------------------------------------------------------
767 --
768 function return_legislation_code
769 (p_std_holiday_absences_id in number
770 ) return varchar2 is
771 --
772 -- Declare cursor
773 --
774 cursor csr_leg_code is
775 select pbg.legislation_code
776 from per_business_groups pbg
777 , per_people_f per
778 , per_std_holiday_absences sha
779 where sha.std_holiday_absences_id = p_std_holiday_absences_id
780 and per.person_id = sha.person_id
781 and pbg.business_group_id = per.business_group_id
782 order by per.effective_start_date;
783 --
784 -- Declare local variables
785 --
786 l_legislation_code varchar2(150);
787 l_proc varchar2(72) := g_package||'return_legislation_code';
788 begin
789 hr_utility.set_location('Entering:'|| l_proc, 10);
790 --
791 -- Ensure that all the mandatory parameter are not null
792 --
793 hr_api.mandatory_arg_error(p_api_name => l_proc,
794 p_argument => 'std_holiday_absences_id',
795 p_argument_value => p_std_holiday_absences_id);
796 --
797 if nvl(g_std_holiday_absences_id, hr_api.g_number) = p_std_holiday_absences_id then
798 --
799 -- The legislation code has already been found with a previous
800 -- call to this function. Just return the value in the global
801 -- variable.
802 --
803 l_legislation_code := g_legislation_code;
804 hr_utility.set_location(l_proc, 20);
805 else
806 --
807 -- The ID is different to the last call to this function
808 -- or this is the first call to this function.
809 --
810 open csr_leg_code;
811 fetch csr_leg_code into l_legislation_code;
812 if csr_leg_code%notfound then
813 close csr_leg_code;
814 --
815 -- The primary key is invalid therefore we must error
816 --
817 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
818 hr_utility.raise_error;
819 end if;
820 --
821 close csr_leg_code;
822 hr_utility.set_location(' Leaving:'|| l_proc, 20);
823 --
824 g_std_holiday_absences_id := p_std_holiday_absences_id;
825 g_legislation_code := l_legislation_code;
826 end if;
827 hr_utility.set_location(' Leaving:'|| l_proc, 25);
828 --
829 return l_legislation_code;
830 end return_legislation_code;
831 --
832 end per_sha_bus;