[Home] [Help]
PACKAGE BODY: APPS.PER_MEA_BUS
Source
1 Package Body per_mea_bus as
2 /* $Header: pemearhi.pkb 115.9 2002/12/06 12:20:50 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_mea_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_medical_assessment_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |-------------------< chk_consultation_combination >----------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 -- Desciption :
21 --
22 -- Validates that the coonsultation_result and consultation_type are
23 -- valid combinations
24 --
25 -- Pre-conditions :
26 -- Format mask must be supplied.
27 --
28 -- In Arguments :
29 -- p_consultation_type
30 -- p_consultation_result
31 --
32 -- Post Success :
33 -- Processing continues
34 --
35 -- Post Failure :
36 -- An application error will be raised and processing is
37 -- terminated
38 --
39 -- Access Status :
40 -- Public Access.
41 --
42 -- {End of Comments}
43 --
44 -- ---------------------------------------------------------------------------
45 --
46 PROCEDURE chk_consultation_combination
47 (p_consultation_type IN per_medical_assessments.consultation_type%TYPE
48 ,p_consultation_result IN per_medical_assessments.consultation_result%TYPE) IS
49 --
50 -- Declare local variables
51 --
52 l_proc varchar2(72) := g_package||'chk_combination_id';
53 --
54 BEGIN
55 --
56 hr_utility.set_location('Entering:'|| l_proc, 10);
57 --
58 -- Check to see that the Conultation_Result and Type combination
59 -- Type combination are valid.
60 --
61 IF p_consultation_type = 'DA' AND
62 p_consultation_result = 'DI' THEN
63 --
64 hr_utility.set_message(800, 'HR_52734_MEA_INV_TYPE_RESULT');
65 hr_utility.raise_error;
66 --
67 END IF;
68 --
69 hr_utility.set_location('Leaving:'|| l_proc, 20);
70 --
71 END chk_consultation_combination;
72 --
73 -- ---------------------------------------------------------------------------
74 -- |---------------------------< chk_inc_consul_date >-----------------------|
75 -- ---------------------------------------------------------------------------
76 --
77 -- Desciption :
78 --
79 -- Validates that the consultation_date is after the incident date
80 --
81 -- Pre-conditions :
82 -- Format mask must be supplied.
83 --
84 -- In Arguments :
85 -- p_consultation_date
86 -- p_incident_date
87 --
88 -- Post Success :
89 -- Processing continues
90 --
91 -- Post Failure :
92 -- An application error will be raised and processing is
93 -- terminated
94 --
95 -- Access Status :
96 -- Internal Development Use Only
97 --
98 -- {End of Comments}
99 --
100 -- ---------------------------------------------------------------------------
101 --
102 PROCEDURE chk_inc_consul_date
103 (p_consultation_date IN per_medical_assessments.consultation_date%TYPE
104 ,p_incident_id IN per_medical_assessments.incident_id%TYPE) IS
105 --
106 -- Declare Local variables
107 --
108 l_proc VARCHAR2(72) := g_package||'chk_inc_consul_date';
109 l_incident_date DATE := NULL;
110 --
111 CURSOR get_incident_date IS
112 SELECT incident_date
113 FROM per_work_incidents pwi
114 WHERE pwi.incident_id = p_incident_id;
115 --
116 BEGIN
117 --
118 hr_utility.set_location('Entering:'|| l_proc, 10);
119 --
120 -- check that the consultation date is
121 -- after the incident date
122 --
123 IF p_incident_id is not NULL THEN
124 --
125 hr_utility.set_location(l_proc,20);
126 --
127 OPEN get_incident_date;
128 FETCH get_incident_date INTO l_incident_date;
129 CLOSE get_incident_date;
130 --
131 hr_utility.set_location(l_proc,30);
132 --
133 IF TRUNC(l_incident_date) > p_consultation_date THEN
134 --
135 hr_utility.set_message(800, 'HR_289014_INC_CON_DATE_INV');
136 hr_utility.raise_error;
137 --
138 END IF;
139 --
140 END IF;
141 --
142 hr_utility.set_location('Leaving:'|| l_proc, 50);
143 --
144 END chk_inc_consul_date;
145 --
146 -- ---------------------------------------------------------------------------
147 -- |-------------------------< chk_date_combinations >-----------------------|
148 -- ---------------------------------------------------------------------------
149 --
150 -- Desciption :
151 --
152 -- Validates that the consultation_date and next_consultation_date are
153 -- valid combinations
154 --
155 -- Pre-conditions :
156 -- Format mask must be supplied.
157 --
158 -- In Arguments :
159 -- p_consultation_date
160 -- p_next_consultation_date
161 --
162 -- Post Success :
163 -- Processing continues
164 --
165 -- Post Failure :
166 -- An application error will be raised and processing is
167 -- terminated
168 --
169 -- Access Status :
170 -- Internal Development Use Only
171 --
172 -- {End of Comments}
173 --
174 -- ---------------------------------------------------------------------------
175 --
176 PROCEDURE chk_date_combinations
177 (p_consultation_date IN per_medical_assessments.consultation_date%TYPE
178 ,p_next_consultation_date IN per_medical_assessments.next_consultation_date%TYPE) IS
179 --
180 -- Declare Local variables
181 --
182 l_proc VARCHAR2(72) := g_package||'chk_consultation_date_combinations';
183 --
184 BEGIN
185 --
186 hr_utility.set_location('Entering:'|| l_proc, 10);
187 --
188 -- check that the consultation date is
189 -- before the next consultation date
190 --
191 IF p_consultation_date > nvl(p_next_consultation_date,hr_api.g_eot) THEN
192 --
193 hr_utility.set_message(800, 'HR_52735_MEA_INV_DATE_COMB');
194 hr_utility.raise_error;
195 --
196 END IF;
197 --
198 hr_utility.set_location('Leaving:'|| l_proc, 50);
199 --
200 END chk_date_combinations;
201 --
202 --
203 -- ---------------------------------------------------------------------------
204 -- |----------------------------< chk_person_id >----------------------------|
205 -- ---------------------------------------------------------------------------
206 --
207 -- Desciption :
208 --
209 -- Validate that on insert PERSON_ID is not null and that
210 -- it exists in per_all_people_f on the effective_date.
211 --
212 --
213 -- Pre-conditions :
214 --
215 --
216 -- In Arguments :
217 -- p_medical_assessment_id
218 -- p_person_id
219 -- p_effective_date
220 --
221 -- Post Success :
222 -- Processing continues
223 --
224 -- Post Failure :
225 -- An application error will be raised and processing is
226 -- terminated
227 --
228 -- Access Status :
229 -- Internal Table Handler Use only.
230 --
231 -- {End of Comments}
232 --
233 -- ---------------------------------------------------------------------------
234 PROCEDURE chk_person_id
235 (p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE
236 ,p_person_id IN per_medical_assessments.person_id%TYPE
237 ,p_effective_date IN date) is
238 --
239 l_proc varchar2(72) := g_package||'chk_person_id';
240 l_dummy number;
241 --
242 CURSOR csr_person_id IS
243 SELECT null
244 FROM per_people_f per
245 WHERE per.person_id = p_person_id
246 AND p_effective_date BETWEEN per.effective_start_date
247 AND per.effective_end_date;
248 --
249 BEGIN
250 --
251 hr_utility.set_location('Entering:'||l_proc, 1);
252 --
253 -- Check mandatory person_id is set
254 --
255 if p_person_id is null then
256 --
257 hr_utility.set_message(800, 'HR_52742_MEA_PERSON_ID_NULL');
258 hr_utility.raise_error;
259 --
260 end if;
261 --
262 hr_utility.set_location(l_proc, 5);
263 --
264 -- Only proceed with validation if :
265 -- a) on insert (non-updateable param)
266 --
267 if (p_medical_assessment_id is null) then
268 --
269 hr_utility.set_location(l_proc, 10);
270 --
271 -- Check that the person_id is in the per_people_f view on the effective_date.
272 --
273 open csr_person_id;
274 fetch csr_person_id into l_dummy;
275 --
276 if csr_person_id%notfound then
277 --
278 close csr_person_id;
279 --
280 hr_utility.set_message(800, 'HR_52741_MEA_PERSON_ID_INV');
281 hr_utility.raise_error;
282 --
283 end if;
284 --
285 close csr_person_id;
286 --
287 end if;
288 --
289 hr_utility.set_location(' Leaving:'||l_proc, 15);
290 --
291 end chk_person_id;
292 --
293 -- ---------------------------------------------------------------------------
294 -- |----------------------< chk_organization_id >----------------------------|
295 -- ---------------------------------------------------------------------------
296 --
297 -- Desciption :
298 --
299 -- Validate organization_id is in same business group as person, and is
300 -- external type. Ensure organization_id is defined under class of
301 -- disability_org.
302 --
303 -- Pre-conditions :
304 --
305 --
306 -- In Arguments :
307 -- p_disability_id
308 -- p_organization_id
309 -- p_business_group_id
310 -- p_validation_start_date
311 --
312 -- Post Success :
313 -- Processing continues
314 --
315 -- Post Failure :
316 -- An application error will be raised and processing is
317 -- terminated
318 --
319 -- Access Status :
320 -- Internal Table Handler Use only.
321 --
322 -- {End of Comments}
323 --
324 PROCEDURE chk_organization_id
325 (p_medical_assessment_id IN per_medical_assessments.disability_id%TYPE
326 ,p_organization_id IN per_medical_assessments.organization_id%TYPE
327 ,p_business_group_id IN per_all_people_f.business_group_id%TYPE
328 ,p_effective_date IN date) IS
329 --
330 cursor csr_org is
331 select business_group_id
332 from hr_all_organization_units hou
333 where hou.organization_id = p_organization_id
334 and p_effective_date between hou.date_from and nvl(hou.date_to, hr_api.g_eot);
335 --
336 cursor csr_org_inf is
337 select null
338 from hr_organization_information hoi
339 where hoi.organization_id = p_organization_id
340 and hoi.org_information_context = 'CLASS'
341 and hoi.org_information1 = 'MEDICAL_ASSESSMENT_ORG'
342 and hoi.org_information2 = 'Y';
343 --
344 l_exists varchar2(1);
345 l_proc varchar2(72) := g_package||'chk_organization_id';
346 l_business_group_id per_assignments_f.business_group_id%TYPE;
347 --
348 BEGIN
349 --
350 hr_utility.set_location('Entering:'|| l_proc, 10);
351 --
352 -- Check mandatory parameters have been set
353 --
354 hr_api.mandatory_arg_error
355 (p_api_name => l_proc
356 ,p_argument => 'business_group_id'
357 ,p_argument_value => p_business_group_id);
358 --
359 hr_api.mandatory_arg_error
360 (p_api_name => l_proc
361 ,p_argument => 'effective_date'
362 ,p_argument_value => p_effective_date);
363 --
364 IF p_organization_id is not null AND
365 per_mea_shd.g_old_rec.organization_id <> p_organization_id THEN
366 --
367 hr_utility.set_location(l_proc, 20);
368 --
369 -- check org exists in hr_all_organization_units (fk) for the persons bg
370 -- within the validation date range.
371 --
372 OPEN csr_org;
373 FETCH csr_org INTO l_business_group_id;
374 --
375 IF csr_org%notfound THEN
376 --
377 CLOSE csr_org;
378 --
379 -- error as org not found
380 --
381 hr_utility.set_message(800, 'HR_52740_MEA_SERV_PROV_INV');
382 hr_utility.raise_error;
383 --
384 ELSIF l_business_group_id <> p_business_group_id THEN
385 --
386 CLOSE csr_org;
387 --
388 -- error as org is in different business group to person
389 --
390 hr_utility.set_message(800, 'HR_52744_MEA_ORG_BG_INV');
391 hr_utility.raise_error;
392 --
393 END IF;
394 --
395 CLOSE csr_org;
396 --
397 hr_utility.set_location(l_proc, 40);
398 --
399 -- check org exists in hr_organization_information for the relevant
400 -- organisation class.
401 --
402 OPEN csr_org_inf;
403 FETCH csr_org_inf INTO l_exists;
404 --
405 IF csr_org_inf%notfound THEN
406 --
407 CLOSE csr_org_inf;
408 --
409 -- error as org is not in the correct class of disability_org
410 --
411 hr_utility.set_message(800, 'HR_52743_MEA_SER_ORG_CLASS_INV');
412 hr_utility.raise_error;
413 --
414 END IF;
415 --
416 CLOSE csr_org_inf;
417 --
418 -- end if;
419 --
420 END IF;
421 --
422 hr_utility.set_location('Entering:'|| l_proc, 50);
423 --
424 END chk_organization_id;
425 --
426 -- ---------------------------------------------------------------------------
427 -- |----------------------< chk_consultation_date_id >------------------------|
428 -- ---------------------------------------------------------------------------
429 --
430 -- Desciption :
431 --
432 -- Validate consultation_date not after the next consultation date
433 --
434 -- Pre-conditions :
435 --
436 --
437 -- In Arguments :
438 -- p_consultation_date
439 -- p_next_consultation_date
440 --
441 -- Post Success :
442 -- Processing continues
443 --
444 -- Post Failure :
445 -- An application error will be raised and processing is
446 -- terminated
447 --
448 -- Access Status :
449 -- Internal Table Handler Use only.
450 --
451 -- {End of Comments}
452 --
453 PROCEDURE chk_consultation_date
454 (p_consultation_date IN per_medical_assessments.consultation_date%TYPE,
455 p_next_consultation_date IN per_medical_assessments.next_consultation_date%TYPE) IS
456 --
457 -- Declare Local variables
458 --
459 l_proc VARCHAR2(72) := g_package||'chk_consultation_date';
460 --
461 BEGIN
462 --
463 hr_utility.set_location('Entering:'|| l_proc, 10);
464 --
465 -- Check mandatory parameters have been set
466 --
467 hr_api.mandatory_arg_error
468 (p_api_name => l_proc
469 ,p_argument => 'consultation_date'
470 ,p_argument_value => p_consultation_date);
471 --
472 -- Check that the next_consultation_date is valid
476 (p_next_consultation_date => p_next_consultation_date
473 -- in relation to the consultation_date
474 --
475 per_mea_bus.chk_date_combinations
477 ,p_consultation_date => p_consultation_date);
478 --
479 hr_utility.set_location('Entering:'|| l_proc, 50);
480 --
481 END chk_consultation_date;
482 --
483 -- ---------------------------------------------------------------------------
484 -- |-----------------------< chk_consultation_type >-------------------------|
485 -- ---------------------------------------------------------------------------
486 --
487 -- Desciption :
488 --
489 -- Validates that value for mandatory consultation_type has been supplied
490 -- and that it is unique.
491 --
492 -- Pre-conditions :
493 -- Format mask must be supplied.
494 --
495 -- In Arguments :
496 -- p_medical_assessment_id
497 -- p_consultation_result
498 -- p_consultation_type
499 -- p_effective_date
500 --
501 -- Post Success :
502 -- Processing continues
503 --
504 -- Post Failure :
505 -- An application error will be raised and processing is
506 -- terminated
507 --
508 -- Access Status :
509 -- Internal Row Handler Use Only
510 --
511 -- {End of Comments}
512 --
513 -- ---------------------------------------------------------------------------
514 --
515 PROCEDURE chk_consultation_type
516 (p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE
517 ,p_consultation_type IN per_medical_assessments.consultation_type%TYPE
518 ,p_consultation_result IN per_medical_assessments.consultation_result%TYPE
519 ,p_effective_date IN date) IS
520 --
521 -- Declare Local Variables
522 --
523 l_proc varchar2(72) := g_package||'chk_consultation_type';
524 --
525 BEGIN
526 --
527 hr_utility.set_location('Entering:'||l_proc, 10);
528 --
529 -- Check mandatory parameters have been set
530 --
531 hr_api.mandatory_arg_error
532 (p_api_name => l_proc
533 ,p_argument => 'consultation_type'
534 ,p_argument_value => p_consultation_type);
535 --
536 hr_utility.set_location(l_proc, 20);
537 --
538 -- Only proceed with validation if :
539 -- a) Inserting or
540 -- b) The value for consultation type has changed
541 --
542 IF ( (p_medical_assessment_id is null) OR
543 ((p_medical_assessment_id is not null) AND
544 (per_mea_shd.g_old_rec.consultation_type <> p_consultation_type))) THEN
545 --
546 hr_utility.set_location(l_proc, 30);
547 --
548 -- Check that the consultation type exists in HR_LOOKUPS
549 --
550 IF hr_api.not_exists_in_hr_lookups
551 (p_effective_date => p_effective_date
552 ,p_lookup_type => 'CONSULTATION_TYPE'
553 ,p_lookup_code => p_consultation_type) THEN
554 --
555 hr_utility.set_location(l_proc, 40);
556 --
557 hr_utility.set_message(800, 'HR_52736_MEA_CONS_TYPE_INV');
558 hr_utility.raise_error;
559 --
560 END IF;
561 --
562 -- Check to see that the Conultation_Result and Type combination
563 -- Type combination are valid.
564 --
565 per_mea_bus.chk_consultation_combination
566 (p_consultation_type => p_consultation_type
567 ,p_consultation_result => p_consultation_result);
568 --
569 END IF;
570 --
571 hr_utility.set_location(' Leaving:'||l_proc, 50);
572 --
573 END chk_consultation_type;
574 --
575 -- ---------------------------------------------------------------------------
576 -- |----------------------< chk_consultation_result >------------------------|
577 -- ---------------------------------------------------------------------------
578 --
579 -- Desciption :
580 --
581 -- Validates that value for the consultation_result has been supplied
582 -- and that it is unique.
583 --
584 -- Pre-conditions :
585 -- Format mask must be supplied.
586 --
587 -- In Arguments :
588 -- p_medical_assessment_id
589 -- p_consultation_result
590 -- p_consultation_type
591 -- p_effective_date
592 --
593 -- Post Success :
594 -- Processing continues
595 --
596 -- Post Failure :
597 -- An application error will be raised and processing is
598 -- terminated
599 --
600 -- Access Status :
601 -- Internal Row Handler Use Only
602 --
603 -- {End of Comments}
604 --
605 -- ---------------------------------------------------------------------------
606 --
607 PROCEDURE chk_consultation_result
608 (p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE
609 ,p_consultation_result IN per_medical_assessments.consultation_result%TYPE
610 ,p_consultation_type IN per_medical_assessments.consultation_type%TYPE
611 ,p_effective_date IN date) is
612 --
613 -- Declare Local Variables
614 --
615 l_proc varchar2(72) := g_package||'chk_consultation_type';
616 --
617 BEGIN
618 --
619 hr_utility.set_location('Entering:'||l_proc, 10);
620 --
621 -- Only proceed with validation if :
622 -- a) Consultation_result is not null
623 -- b) The value for consultation result has changed
627 --
624 --
625 IF p_consultation_result IS NOT NULL OR
626 per_mea_shd.g_old_rec.consultation_result <> p_consultation_result THEN
628 hr_utility.set_location(l_proc, 20);
629 --
630 -- Check that the consultation result exists in HR_LOOKUPS
631 --
632 IF hr_api.not_exists_in_hr_lookups
633 (p_effective_date => p_effective_date
634 ,p_lookup_type => 'CONSULTATION_RESULT'
635 ,p_lookup_code => p_consultation_result) THEN
636 --
637 hr_utility.set_location(l_proc, 30);
638 --
639 hr_utility.set_message(800, 'HR_52737_MEA_CONS_RES_INV');
640 hr_utility.raise_error;
641 --
642 END IF;
643 --
644 -- Check to see that the Conultation_Result and Type combination
645 -- Type combination are valid.
646 --
647 per_mea_bus.chk_consultation_combination
648 (p_consultation_type => p_consultation_type
649 ,p_consultation_result => p_consultation_result);
650 --
651 END IF;
652 --
653 hr_utility.set_location(' Leaving:'||l_proc, 40);
654 --
655 END chk_consultation_result;
656 --
657 -- ---------------------------------------------------------------------------
658 -- |---------------------------< chk_incident_id >---------------------------|
659 -- ---------------------------------------------------------------------------
660 --
661 -- Desciption :
662 --
663 -- Validates that value for incident_id is vlaid
664 --
665 -- Pre-conditions :
666 -- Format mask must be supplied.
667 --
668 -- In Arguments :
669 -- p_incident_od
670 --
671 -- Post Success :
672 -- Processing continues
673 --
674 -- Post Failure :
675 -- An application error will be raised and processing is
676 -- terminated
677 --
678 -- Access Status :
679 -- Internal Row Handler Use Only
680 --
681 -- {End of Comments}
682 --
683 -- ---------------------------------------------------------------------------
684 --
685 PROCEDURE chk_incident_id
686 (p_incident_id IN per_medical_assessments.incident_id%TYPE
687 ,p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE) IS
688 --
689 -- Declare Curors
690 --
691 CURSOR c_incident_id IS
692 SELECT incident_id
693 FROM per_work_incidents pwi
694 WHERE pwi.incident_id = p_incident_id;
695 --
696 -- Declare local variables
697 --
698 l_proc VARCHAR2(72) := g_package||'set_security_group_id';
699 l_dummy_id per_medical_assessments.incident_id%TYPE;
700 --
701 BEGIN
702 --
703 hr_utility.set_location('Entering:'|| l_proc, 10);
704 --
705 -- Only proceed with validation if :
706 -- a) Incident ID is not blank
707 -- b) The value for incident_id has changed
708 --
709 IF p_incident_id IS NOT NULL OR
710 per_mea_shd.g_old_rec.incident_id <> p_incident_id THEN
711 --
712 hr_utility.set_location(l_proc, 20);
713 --
714 -- Check to see if a work incident record
715 -- exists for the incident_id.
716 --
717 OPEN c_incident_id;
718 FETCH c_incident_id INTO l_dummy_id;
719 --
720 IF c_incident_id%NOTFOUND THEN
721 --
722 CLOSE c_incident_id;
723 --
724 -- Work Incident record not found so id is invalid. Raise Error.
725 --
726 hr_utility.set_message(800, 'HR_52738_MEA_WORK_INC_INV');
727 hr_utility.raise_error;
728 --
729 END IF;
730 --
731 CLOSE c_incident_id;
732 --
733 END IF;
734 --
735 hr_utility.set_location(' Leaving:'|| l_proc, 30);
736 --
737 END chk_incident_id;
738 --
739 -- ---------------------------------------------------------------------------
740 -- |-----------------------< chk_valid_id_combinations>----------------------|
741 -- ---------------------------------------------------------------------------
742 --
743 -- Desciption :
744 --
745 -- Validates that the diability_id and incident_id are not present on
746 -- another medical assessment record.
747 --
748 -- Pre-conditions :
749 -- Format mask must be supplied.
750 --
751 -- In Arguments :
752 -- p_disability_id
753 -- p_medical_assessment_id
754 -- p_effective_date
755 --
756 -- Post Success :
757 -- Processing continues
758 --
759 -- Post Failure :
760 -- An application error will be raised and processing is
761 -- terminated
762 --
763 -- Access Status :
764 -- Internal Row Handler Use Only
765 --
766 -- {End of Comments}
767 --
768 -- ---------------------------------------------------------------------------
769 --
770 PROCEDURE chk_valid_id_combinations
771 (p_disability_id IN per_medical_assessments.disability_id%TYPE
772 ,p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE
773 ,p_incident_id IN per_medical_assessments.incident_id%TYPE
774 ,p_person_id IN per_medical_assessments.person_id%TYPE) IS
775 --
776 -- Declare cursor
777 --
778 CURSOR c_valid_id IS
779 SELECT medical_assessment_id
780 FROM per_medical_assessments mea
781 WHERE mea.medical_assessment_id <> p_medical_assessment_id
785 --
782 AND mea.incident_id = p_incident_id
783 AND mea.person_id = p_person_id
784 AND mea.disability_id = p_disability_id;
786 -- Declare local variables
787 --
788 l_dummy_id per_medical_assessments.medical_assessment_id%TYPE;
789 l_proc VARCHAR2(72) := g_package||'chk_valid_id_combinations';
790 --
791 BEGIN
792 --
793 hr_utility.set_location('Entering:'|| l_proc, 10);
794 --
795 -- Only proceed with validation if :
796 -- a) Disability ID and Incident ID are not NULL
797 -- b) The value for disability_id and Incident ID has changed.
798 --
799 IF p_disability_id IS NOT NULL AND
800 p_incident_id IS NOT NULL THEN
801 --
802 hr_utility.set_location(l_proc, 20);
803 --
804 -- Only continue if the disability_id or incident_id have
805 -- changed
806 --
807 IF per_mea_shd.g_old_rec.disability_id <> p_disability_id OR
808 per_mea_shd.g_old_rec.incident_id <> p_incident_id THEN
809 --
810 hr_utility.set_location(l_proc, 30);
811 --
812 -- Check to see if a medical assessment record exists
813 -- with the same disability and incident IDs.
814 --
815 OPEN c_valid_id;
816 FETCH c_valid_id INTO l_dummy_id;
817 --
818 hr_utility.set_location(l_proc, 40);
819 --
820 IF c_valid_id%FOUND THEN
821 --
822 CLOSE c_valid_id;
823 --
824 -- Disability record not found so id is invalid. Raise Error.
825 --
826 hr_utility.set_message(800, 'HR_52745_MEA_INC_DIS_EXISTS');
827 hr_utility.raise_error;
828 --
829 END IF;
830 --
831 CLOSE c_valid_id;
832 --
833 END IF;
834 --
835 END IF;
836 --
837 hr_utility.set_location('Leaving:'|| l_proc, 50);
838 --
839 END chk_valid_id_combinations;
840 --
841 -- ---------------------------------------------------------------------------
842 -- |----------------------------< chk_inc_against_dis >----------------------|
843 -- ---------------------------------------------------------------------------
844 --
845 -- Desciption :
846 --
847 -- Validates that incident id belongs to the disability record if
848 -- the disability ID passed in is not null.
849 --
850 -- Pre-conditions :
851 -- Format mask must be supplied.
852 --
853 -- In Arguments :
854 -- p_disability_id
855 -- p_incident_id
856 -- p_person_id
857 -- p_effective_date
858 --
859 -- Post Success :
860 -- Processing continues
861 --
862 -- Post Failure :
863 -- An application error will be raised and processing is
864 -- terminated
865 --
866 -- Access Status :
867 -- Internal Row Handler Use Only
868 --
869 -- {End of Comments}
870 --
871 -- ---------------------------------------------------------------------------
872 --
873
874 PROCEDURE chk_inc_against_dis
875 (p_disability_id IN per_medical_assessments.disability_id%TYPE
876 ,p_incident_id IN per_medical_assessments.incident_id%TYPE
877 ,p_person_id IN per_medical_assessments.person_id%TYPE
878 ,p_effective_date IN DATE) IS
879 --
880 -- Declare cursor
881 --
882 CURSOR c_disability_id IS
883 SELECT disability_id
884 FROM per_disabilities_f pdf
885 WHERE pdf.disability_id = p_disability_id
886 AND pdf.person_id = p_person_id
887 AND pdf.incident_id = p_incident_id
888 AND p_effective_date BETWEEN pdf.effective_start_date
889 AND pdf.effective_end_date;
890 --
891 --
892 -- Declare local variables
893 --
894 l_dummy_id per_medical_assessments.disability_id%TYPE;
895 l_proc VARCHAR2(72) := g_package||'chk_inc_against_dis';
896 --
897 BEGIN
898 --
899 hr_utility.set_location('Entering:'|| l_proc, 10);
900 --
901 -- Only proceed with validation if :
902 -- a) Disability ID and Incident ID are not NULL
903 -- b) The value for disability_id and Incident ID has changed.
904 --
905 IF p_disability_id IS NOT NULL AND
906 p_incident_id IS NOT NULL THEN
907 --
908 hr_utility.set_location(l_proc, 20);
909 --
910 -- Only continue if the disability_id or incident_id have
911 -- changed
912 --
913 IF per_mea_shd.g_old_rec.disability_id <> p_disability_id OR
914 per_mea_shd.g_old_rec.incident_id <> p_incident_id THEN
915 --
916 hr_utility.set_location(l_proc, 30);
917 --
918 -- Check to see if the work incident record has been assigned
919 -- to the disability record.
920 --
921 OPEN c_disability_id;
922 FETCH c_disability_id INTO l_dummy_id;
923 --
924 hr_utility.set_location(l_proc, 40);
925 --
926 IF c_disability_id%NOTFOUND THEN
927 --
928 CLOSE c_disability_id;
929 --
930 -- Disability record not found so id is invalid. Raise Error.
931 --
932 hr_utility.set_message(800, 'HR_52764_MEA_INC_DIS_INV');
933 hr_utility.raise_error;
934 --
935 END IF;
939 END IF;
936 --
937 CLOSE c_disability_id;
938 --
940 --
941 END IF;
942 --
943 hr_utility.set_location('Leaving:'|| l_proc, 50);
944 --
945 END chk_inc_against_dis;
946 --
947 -- ---------------------------------------------------------------------------
948 -- |---------------------------< chk_disability_id >---------------------------|
949 -- ---------------------------------------------------------------------------
950 --
951 -- Desciption :
952 --
953 -- Validates that value for disability_id is valid
954 --
955 -- Pre-conditions :
956 -- Format mask must be supplied.
957 --
958 -- In Arguments :
959 -- p_disability_id
960 -- p_medical_assessment_id
961 -- p_effective_date
962 --
963 -- Post Success :
964 -- Processing continues
965 --
966 -- Post Failure :
967 -- An application error will be raised and processing is
968 -- terminated
969 --
970 -- Access Status :
971 -- Internal Row Handler Use Only
972 --
973 -- {End of Comments}
974 --
975 -- ---------------------------------------------------------------------------
976 --
977 PROCEDURE chk_disability_id
978 (p_disability_id IN per_medical_assessments.disability_id%TYPE
979 ,p_medical_assessment_id IN per_medical_assessments.medical_assessment_id%TYPE
980 ,p_person_id IN per_medical_assessments.person_id%TYPE
981 ,p_object_version_number IN per_medical_assessments.object_version_number%TYPE
982 ,p_effective_date IN DATE) IS
983 --
984 -- Declare cursor
985 --
986 CURSOR c_disability_id IS
987 SELECT disability_id
988 FROM per_disabilities_f pdf
989 WHERE pdf.disability_id = p_disability_id
990 AND pdf.person_id = p_person_id
991 AND p_effective_date BETWEEN pdf.effective_start_date
992 AND pdf.effective_end_date;
993 --
994 -- Declare local variables
995 --
996 l_dummy_id per_medical_assessments.disability_id%TYPE;
997 l_proc VARCHAR2(72) := g_package||'chk_disability_id';
998 --
999 BEGIN
1000 --
1001 hr_utility.set_location('Entering:'|| l_proc, 10);
1002 --
1003 -- Only proceed with validation if :
1004 -- a) Disability ID is not NULL
1005 -- b) The value for disability_id has changed
1006 --
1007 IF p_disability_id is not null then
1008 --
1009 IF ((p_medical_assessment_id is null) or
1010 ((p_medical_assessment_id is not null) and
1011 (per_dis_shd.g_old_rec.disability_id <> p_disability_id))) then
1012 --
1013 hr_utility.set_location(l_proc, 20);
1014 --
1015 -- fix #1565679 (point 27) - make disability_id updatable on the medical assessment.
1016 --
1017 -- Check to see if a disability record exists for the disability id
1018 --
1019 OPEN c_disability_id;
1020 FETCH c_disability_id INTO l_dummy_id;
1021 --
1022 hr_utility.set_location(l_proc, 30);
1023 --
1024 IF c_disability_id%NOTFOUND THEN
1025 --
1026 CLOSE c_disability_id;
1027 --
1028 -- Disability record not found so id is invalid. Raise Error.
1029 --
1030 hr_utility.set_message(800, 'HR_52739_MEA_DIS_INV');
1031 hr_utility.raise_error;
1032 --
1033 END IF;
1034 --
1035 CLOSE c_disability_id;
1036 --
1037 END IF;
1038 END IF;
1039 --
1040 hr_utility.set_location('Leaving:'|| l_proc, 40);
1041 --
1042 END chk_disability_id;
1043 --
1044 -- ---------------------------------------------------------------------------
1045 -- |--------------------< chk_next_consultation_date >-----------------------|
1046 -- ---------------------------------------------------------------------------
1047 --
1048 -- Desciption :
1049 --
1050 -- Validates that value for disability_id is valid
1051 --
1052 -- Pre-conditions :
1053 -- Format mask must be supplied.
1054 --
1055 -- In Arguments :
1056 -- p_consultation_date
1057 -- p_next_consultation_date
1058 -- p_effective_date
1059 --
1060 -- Post Success :
1061 -- Processing continues
1062 --
1063 -- Post Failure :
1064 -- An application error will be raised and processing is
1065 -- terminated
1066 --
1067 -- Access Status :
1068 -- Internal Row Handler Use Only
1069 --
1070 -- {End of Comments}
1071 --
1072 -- ---------------------------------------------------------------------------
1073 --
1074 PROCEDURE chk_next_consultation_date
1075 (p_next_consultation_date IN per_medical_assessments.next_consultation_date%TYPE
1076 ,p_consultation_date IN per_medical_assessments.consultation_date%TYPE) IS
1077 --
1078 -- Declare local variables
1079 --
1080 l_proc VARCHAR2(72) := g_package||'chk_next_consultation_date';
1081 --
1082 BEGIN
1083 --
1084 hr_utility.set_location('Entering:'||l_proc, 10);
1085 --
1086 -- Check that the next_consultation_date is valid
1087 -- in relation to the consultation_date
1088 --
1089 per_mea_bus.chk_date_combinations
1093 hr_utility.set_location('Leaving:'||l_proc, 20);
1090 (p_next_consultation_date => p_next_consultation_date
1091 ,p_consultation_date => p_consultation_date);
1092 --
1094 --
1095 END chk_next_consultation_date;
1096 --
1097 -- ---------------------------------------------------------------------------
1098 -- |----------------------< set_security_group_id >--------------------------|
1099 -- ---------------------------------------------------------------------------
1100 --
1101 PROCEDURE set_security_group_id
1102 (p_medical_assessment_id IN NUMBER) is
1103 --
1104 -- Declare cursor
1105 --
1106 CURSOR csr_sec_grp is
1107 SELECT pbg.security_group_id
1108 FROM per_business_groups pbg,
1109 per_medical_assessments mea,
1110 per_people_f per
1111 WHERE mea.medical_assessment_id = p_medical_assessment_id
1112 AND per.person_id = mea.person_id
1113 AND pbg.business_group_id = per.business_group_id;
1114 --
1115 -- Declare local variables
1116 --
1117 l_security_group_id number;
1118 l_proc varchar2(72) := g_package||'set_security_group_id';
1119 --
1120 BEGIN
1121 --
1122 hr_utility.set_location('Entering:'|| l_proc, 10);
1123 --
1124 -- Ensure that all the mandatory parameter are not null
1125 --
1126 hr_api.mandatory_arg_error
1127 (p_api_name => l_proc
1128 ,p_argument => 'medical_assessment_id'
1129 ,p_argument_value => p_medical_assessment_id
1130 );
1131 --
1132 open csr_sec_grp;
1133 fetch csr_sec_grp into l_security_group_id;
1134 --
1135 if csr_sec_grp%notfound then
1136 --
1137 close csr_sec_grp;
1138 --
1139 -- The primary key is invalid therefore we must error
1140 --
1141 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1142 fnd_message.raise_error;
1143 --
1144 end if;
1145 close csr_sec_grp;
1146 --
1147 -- Set the security_group_id in CLIENT_INFO
1148 --
1149 hr_api.set_security_group_id
1150 (p_security_group_id => l_security_group_id
1151 );
1152 --
1153 hr_utility.set_location(' Leaving:'|| l_proc, 20);
1154 --
1155 END set_security_group_id;
1156 --
1157 -- ---------------------------------------------------------------------------
1158 -- |---------------------< return_legislation_code >-------------------------|
1159 -- ---------------------------------------------------------------------------
1160 --
1161 Function return_legislation_code
1162 (p_medical_assessment_id in number
1163 )
1164 Return Varchar2 Is
1165 --
1166 -- Declare cursor
1167 --
1168 cursor csr_leg_code is
1169 select pbg.legislation_code
1170 from per_medical_assessments mea,
1171 per_people_f per,
1172 per_business_groups pbg
1173 where mea.medical_assessment_id = p_medical_assessment_id
1174 and mea.person_id = per.person_id
1175 and per.business_group_id = pbg.business_group_id;
1176 --
1177 -- Declare local variables
1178 --
1179 l_legislation_code varchar2(150);
1180 l_proc varchar2(72) := g_package||'return_legislation_code';
1181 --
1182 Begin
1183 --
1184 hr_utility.set_location('Entering:'|| l_proc, 10);
1185 --
1186 -- Ensure that all the mandatory parameter are not null
1187 --
1188 hr_api.mandatory_arg_error
1189 (p_api_name => l_proc
1190 ,p_argument => 'medical_assessment_id'
1191 ,p_argument_value => p_medical_assessment_id
1192 );
1193 --
1194 if ( nvl(per_mea_bus.g_medical_assessment_id, hr_api.g_number)
1195 = p_medical_assessment_id) then
1196 --
1197 -- The legislation code has already been found with a previous
1198 -- call to this function. Just return the value in the global
1199 -- variable.
1200 --
1201 l_legislation_code := per_mea_bus.g_legislation_code;
1202 --
1203 hr_utility.set_location(l_proc, 20);
1204 else
1205 --
1206 -- The ID is different to the last call to this function
1207 -- or this is the first call to this function.
1208 --
1209 open csr_leg_code;
1210 fetch csr_leg_code into l_legislation_code;
1211 --
1212 if csr_leg_code%notfound then
1213 --
1214 -- The primary key is invalid therefore we must error
1215 --
1216 close csr_leg_code;
1217 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
1218 fnd_message.raise_error;
1219 end if;
1220 hr_utility.set_location(l_proc,30);
1221 --
1222 -- Set the global variables so the values are
1223 -- available for the next call to this function.
1224 --
1225 close csr_leg_code;
1226 per_mea_bus.g_medical_assessment_id := p_medical_assessment_id;
1227 per_mea_bus.g_legislation_code := l_legislation_code;
1228 end if;
1229 hr_utility.set_location(' Leaving:'|| l_proc, 40);
1230 return l_legislation_code;
1231 end return_legislation_code;
1232 --
1233 -- ----------------------------------------------------------------------------
1237 -- Description:
1234 -- |-----------------------------< chk_ddf >----------------------------------|
1235 -- ----------------------------------------------------------------------------
1236 --
1238 -- Validates all the Developer Descriptive Flexfield values.
1239 --
1240 -- Prerequisites:
1241 -- All other columns have been validated. Must be called as the
1242 -- last step from insert_validate and update_validate.
1243 --
1244 -- In Arguments:
1245 -- p_rec
1246 --
1247 -- Post Success:
1248 -- If the Developer Descriptive Flexfield structure column and data values
1249 -- are all valid this procedure will end normally and processing will
1250 -- continue.
1251 --
1252 -- Post Failure:
1253 -- If the Developer Descriptive Flexfield structure column value or any of
1254 -- the data values are invalid then an application error is raised as
1255 -- a PL/SQL exception.
1256 --
1257 -- Access Status:
1258 -- Internal Row Handler Use Only.
1259 --
1260 -- ----------------------------------------------------------------------------
1261 PROCEDURE chk_ddf
1262 (p_rec in per_mea_shd.g_rec_type
1263 ) is
1264 --
1265 l_proc varchar2(72) := g_package || 'chk_ddf';
1266 --
1267 BEGIN
1268 hr_utility.set_location('Entering:'||l_proc,10);
1269 --
1270 if ((p_rec.medical_assessment_id is not null) and (
1271 nvl(per_mea_shd.g_old_rec.mea_information_category, hr_api.g_varchar2) <>
1272 nvl(p_rec.mea_information_category, hr_api.g_varchar2) or
1273 nvl(per_mea_shd.g_old_rec.mea_information1, hr_api.g_varchar2) <>
1274 nvl(p_rec.mea_information1, hr_api.g_varchar2) or
1275 nvl(per_mea_shd.g_old_rec.mea_information2, hr_api.g_varchar2) <>
1276 nvl(p_rec.mea_information2, hr_api.g_varchar2) or
1277 nvl(per_mea_shd.g_old_rec.mea_information3, hr_api.g_varchar2) <>
1278 nvl(p_rec.mea_information3, hr_api.g_varchar2) or
1279 nvl(per_mea_shd.g_old_rec.mea_information4, hr_api.g_varchar2) <>
1280 nvl(p_rec.mea_information4, hr_api.g_varchar2) or
1281 nvl(per_mea_shd.g_old_rec.mea_information5, hr_api.g_varchar2) <>
1282 nvl(p_rec.mea_information5, hr_api.g_varchar2) or
1283 nvl(per_mea_shd.g_old_rec.mea_information6, hr_api.g_varchar2) <>
1284 nvl(p_rec.mea_information6, hr_api.g_varchar2) or
1285 nvl(per_mea_shd.g_old_rec.mea_information7, hr_api.g_varchar2) <>
1286 nvl(p_rec.mea_information7, hr_api.g_varchar2) or
1287 nvl(per_mea_shd.g_old_rec.mea_information8, hr_api.g_varchar2) <>
1288 nvl(p_rec.mea_information8, hr_api.g_varchar2) or
1289 nvl(per_mea_shd.g_old_rec.mea_information9, hr_api.g_varchar2) <>
1290 nvl(p_rec.mea_information9, hr_api.g_varchar2) or
1291 nvl(per_mea_shd.g_old_rec.mea_information10, hr_api.g_varchar2) <>
1292 nvl(p_rec.mea_information10, hr_api.g_varchar2) or
1293 nvl(per_mea_shd.g_old_rec.mea_information11, hr_api.g_varchar2) <>
1294 nvl(p_rec.mea_information11, hr_api.g_varchar2) or
1295 nvl(per_mea_shd.g_old_rec.mea_information12, hr_api.g_varchar2) <>
1296 nvl(p_rec.mea_information12, hr_api.g_varchar2) or
1297 nvl(per_mea_shd.g_old_rec.mea_information13, hr_api.g_varchar2) <>
1298 nvl(p_rec.mea_information13, hr_api.g_varchar2) or
1299 nvl(per_mea_shd.g_old_rec.mea_information14, hr_api.g_varchar2) <>
1300 nvl(p_rec.mea_information14, hr_api.g_varchar2) or
1301 nvl(per_mea_shd.g_old_rec.mea_information15, hr_api.g_varchar2) <>
1302 nvl(p_rec.mea_information15, hr_api.g_varchar2) or
1303 nvl(per_mea_shd.g_old_rec.mea_information16, hr_api.g_varchar2) <>
1304 nvl(p_rec.mea_information16, hr_api.g_varchar2) or
1305 nvl(per_mea_shd.g_old_rec.mea_information17, hr_api.g_varchar2) <>
1306 nvl(p_rec.mea_information17, hr_api.g_varchar2) or
1307 nvl(per_mea_shd.g_old_rec.mea_information18, hr_api.g_varchar2) <>
1308 nvl(p_rec.mea_information18, hr_api.g_varchar2) or
1309 nvl(per_mea_shd.g_old_rec.mea_information19, hr_api.g_varchar2) <>
1310 nvl(p_rec.mea_information19, hr_api.g_varchar2) or
1311 nvl(per_mea_shd.g_old_rec.mea_information20, hr_api.g_varchar2) <>
1312 nvl(p_rec.mea_information20, hr_api.g_varchar2) or
1313 nvl(per_mea_shd.g_old_rec.mea_information21, hr_api.g_varchar2) <>
1314 nvl(p_rec.mea_information21, hr_api.g_varchar2) or
1315 nvl(per_mea_shd.g_old_rec.mea_information22, hr_api.g_varchar2) <>
1316 nvl(p_rec.mea_information22, hr_api.g_varchar2) or
1317 nvl(per_mea_shd.g_old_rec.mea_information23, hr_api.g_varchar2) <>
1318 nvl(p_rec.mea_information23, hr_api.g_varchar2) or
1319 nvl(per_mea_shd.g_old_rec.mea_information24, hr_api.g_varchar2) <>
1320 nvl(p_rec.mea_information24, hr_api.g_varchar2) or
1321 nvl(per_mea_shd.g_old_rec.mea_information25, hr_api.g_varchar2) <>
1322 nvl(p_rec.mea_information25, hr_api.g_varchar2) or
1323 nvl(per_mea_shd.g_old_rec.mea_information26, hr_api.g_varchar2) <>
1324 nvl(p_rec.mea_information26, hr_api.g_varchar2) or
1325 nvl(per_mea_shd.g_old_rec.mea_information27, hr_api.g_varchar2) <>
1326 nvl(p_rec.mea_information27, hr_api.g_varchar2) or
1327 nvl(per_mea_shd.g_old_rec.mea_information28, hr_api.g_varchar2) <>
1328 nvl(p_rec.mea_information28, hr_api.g_varchar2) or
1329 nvl(per_mea_shd.g_old_rec.mea_information29, hr_api.g_varchar2) <>
1330 nvl(p_rec.mea_information29, hr_api.g_varchar2) or
1331 nvl(per_mea_shd.g_old_rec.mea_information30, hr_api.g_varchar2) <>
1332 nvl(p_rec.mea_information30, hr_api.g_varchar2) ))
1336 -- a) During update, the structure column value or any
1333 or (p_rec.medical_assessment_id is null) then
1334 --
1335 -- Only execute the validation if absolutely necessary:
1337 -- of the attribute values have actually changed.
1338 -- b) During insert.
1339 --
1340 hr_dflex_utility.ins_or_upd_descflex_attribs
1341 (p_appl_short_name => 'PER'
1342 ,p_descflex_name => 'Assessment Developer DF'
1343 ,p_attribute_category => p_rec.MEA_INFORMATION_CATEGORY
1344 ,p_attribute1_name => 'MEA_INFORMATION1'
1345 ,p_attribute1_value => p_rec.mea_information1
1346 ,p_attribute2_name => 'MEA_INFORMATION2'
1347 ,p_attribute2_value => p_rec.mea_information2
1348 ,p_attribute3_name => 'MEA_INFORMATION3'
1349 ,p_attribute3_value => p_rec.mea_information3
1350 ,p_attribute4_name => 'MEA_INFORMATION4'
1351 ,p_attribute4_value => p_rec.mea_information4
1352 ,p_attribute5_name => 'MEA_INFORMATION5'
1353 ,p_attribute5_value => p_rec.mea_information5
1354 ,p_attribute6_name => 'MEA_INFORMATION6'
1355 ,p_attribute6_value => p_rec.mea_information6
1356 ,p_attribute7_name => 'MEA_INFORMATION7'
1357 ,p_attribute7_value => p_rec.mea_information7
1358 ,p_attribute8_name => 'MEA_INFORMATION8'
1359 ,p_attribute8_value => p_rec.mea_information8
1360 ,p_attribute9_name => 'MEA_INFORMATION9'
1361 ,p_attribute9_value => p_rec.mea_information9
1362 ,p_attribute10_name => 'MEA_INFORMATION10'
1363 ,p_attribute10_value => p_rec.mea_information10
1364 ,p_attribute11_name => 'MEA_INFORMATION11'
1365 ,p_attribute11_value => p_rec.mea_information11
1366 ,p_attribute12_name => 'MEA_INFORMATION12'
1367 ,p_attribute12_value => p_rec.mea_information12
1368 ,p_attribute13_name => 'MEA_INFORMATION13'
1369 ,p_attribute13_value => p_rec.mea_information13
1370 ,p_attribute14_name => 'MEA_INFORMATION14'
1371 ,p_attribute14_value => p_rec.mea_information14
1372 ,p_attribute15_name => 'MEA_INFORMATION15'
1373 ,p_attribute15_value => p_rec.mea_information15
1374 ,p_attribute16_name => 'MEA_INFORMATION16'
1375 ,p_attribute16_value => p_rec.mea_information16
1376 ,p_attribute17_name => 'MEA_INFORMATION17'
1377 ,p_attribute17_value => p_rec.mea_information17
1378 ,p_attribute18_name => 'MEA_INFORMATION18'
1379 ,p_attribute18_value => p_rec.mea_information18
1380 ,p_attribute19_name => 'MEA_INFORMATION19'
1381 ,p_attribute19_value => p_rec.mea_information19
1382 ,p_attribute20_name => 'MEA_INFORMATION20'
1383 ,p_attribute20_value => p_rec.mea_information20
1384 ,p_attribute21_name => 'MEA_INFORMATION21'
1385 ,p_attribute21_value => p_rec.mea_information21
1386 ,p_attribute22_name => 'MEA_INFORMATION22'
1387 ,p_attribute22_value => p_rec.mea_information22
1388 ,p_attribute23_name => 'MEA_INFORMATION23'
1389 ,p_attribute23_value => p_rec.mea_information23
1390 ,p_attribute24_name => 'MEA_INFORMATION24'
1391 ,p_attribute24_value => p_rec.mea_information24
1392 ,p_attribute25_name => 'MEA_INFORMATION25'
1393 ,p_attribute25_value => p_rec.mea_information25
1394 ,p_attribute26_name => 'MEA_INFORMATION26'
1395 ,p_attribute26_value => p_rec.mea_information26
1396 ,p_attribute27_name => 'MEA_INFORMATION27'
1397 ,p_attribute27_value => p_rec.mea_information27
1398 ,p_attribute28_name => 'MEA_INFORMATION28'
1399 ,p_attribute28_value => p_rec.mea_information28
1400 ,p_attribute29_name => 'MEA_INFORMATION29'
1401 ,p_attribute29_value => p_rec.mea_information29
1402 ,p_attribute30_name => 'MEA_INFORMATION30'
1403 ,p_attribute30_value => p_rec.mea_information30
1404 );
1405 end if;
1406 --
1407 hr_utility.set_location(' Leaving:'||l_proc,20);
1408 end chk_ddf;
1409 --
1410 -- ----------------------------------------------------------------------------
1411 -- |------------------------------< chk_df >----------------------------------|
1412 -- ----------------------------------------------------------------------------
1413 --
1414 -- Description:
1415 -- Validates all the Descriptive Flexfield values.
1416 --
1417 -- Prerequisites:
1418 -- All other columns have been validated. Must be called as the
1419 -- last step from insert_validate and update_validate.
1420 --
1421 -- In Arguments:
1422 -- p_rec
1423 --
1424 -- Post Success:
1425 -- If the Descriptive Flexfield structure column and data values are
1426 -- all valid this procedure will end normally and processing will
1427 -- continue.
1428 --
1432 -- a PL/SQL exception.
1429 -- Post Failure:
1430 -- If the Descriptive Flexfield structure column value or any of
1431 -- the data values are invalid then an application error is raised as
1433 --
1434 -- Access Status:
1435 -- Internal Row Handler Use Only.
1436 --
1437 -- ----------------------------------------------------------------------------
1438 PROCEDURE chk_df
1439 (p_rec in per_mea_shd.g_rec_type
1440 ) is
1441 --
1442 l_proc varchar2(72) := g_package || 'chk_df';
1443 --
1444 BEGIN
1445 hr_utility.set_location('Entering:'||l_proc,10);
1446 --
1447 if ((p_rec.medical_assessment_id is not null) and (
1448 nvl(per_mea_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
1449 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
1450 nvl(per_mea_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
1451 nvl(p_rec.attribute1, hr_api.g_varchar2) or
1452 nvl(per_mea_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
1453 nvl(p_rec.attribute2, hr_api.g_varchar2) or
1454 nvl(per_mea_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
1455 nvl(p_rec.attribute3, hr_api.g_varchar2) or
1456 nvl(per_mea_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
1457 nvl(p_rec.attribute4, hr_api.g_varchar2) or
1458 nvl(per_mea_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
1459 nvl(p_rec.attribute5, hr_api.g_varchar2) or
1460 nvl(per_mea_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
1461 nvl(p_rec.attribute6, hr_api.g_varchar2) or
1462 nvl(per_mea_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
1463 nvl(p_rec.attribute7, hr_api.g_varchar2) or
1464 nvl(per_mea_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
1465 nvl(p_rec.attribute8, hr_api.g_varchar2) or
1466 nvl(per_mea_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
1467 nvl(p_rec.attribute9, hr_api.g_varchar2) or
1468 nvl(per_mea_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
1469 nvl(p_rec.attribute10, hr_api.g_varchar2) or
1470 nvl(per_mea_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
1471 nvl(p_rec.attribute11, hr_api.g_varchar2) or
1472 nvl(per_mea_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
1473 nvl(p_rec.attribute12, hr_api.g_varchar2) or
1474 nvl(per_mea_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
1475 nvl(p_rec.attribute13, hr_api.g_varchar2) or
1476 nvl(per_mea_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
1477 nvl(p_rec.attribute14, hr_api.g_varchar2) or
1478 nvl(per_mea_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
1479 nvl(p_rec.attribute15, hr_api.g_varchar2) or
1480 nvl(per_mea_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
1481 nvl(p_rec.attribute16, hr_api.g_varchar2) or
1482 nvl(per_mea_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
1483 nvl(p_rec.attribute17, hr_api.g_varchar2) or
1484 nvl(per_mea_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
1485 nvl(p_rec.attribute18, hr_api.g_varchar2) or
1486 nvl(per_mea_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
1487 nvl(p_rec.attribute19, hr_api.g_varchar2) or
1488 nvl(per_mea_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
1489 nvl(p_rec.attribute20, hr_api.g_varchar2) or
1490 nvl(per_mea_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
1491 nvl(p_rec.attribute21, hr_api.g_varchar2) or
1492 nvl(per_mea_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
1493 nvl(p_rec.attribute22, hr_api.g_varchar2) or
1494 nvl(per_mea_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
1495 nvl(p_rec.attribute23, hr_api.g_varchar2) or
1496 nvl(per_mea_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
1497 nvl(p_rec.attribute24, hr_api.g_varchar2) or
1498 nvl(per_mea_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
1499 nvl(p_rec.attribute25, hr_api.g_varchar2) or
1500 nvl(per_mea_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
1501 nvl(p_rec.attribute26, hr_api.g_varchar2) or
1502 nvl(per_mea_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
1503 nvl(p_rec.attribute27, hr_api.g_varchar2) or
1504 nvl(per_mea_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
1505 nvl(p_rec.attribute28, hr_api.g_varchar2) or
1506 nvl(per_mea_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
1507 nvl(p_rec.attribute29, hr_api.g_varchar2) or
1508 nvl(per_mea_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
1509 nvl(p_rec.attribute30, hr_api.g_varchar2) ))
1510 or (p_rec.medical_assessment_id is null) then
1511 --
1512 -- Only execute the validation if absolutely necessary:
1513 -- a) During update, the structure column value or any
1514 -- of the attribute values have actually changed.
1515 -- b) During insert.
1516 --
1517 hr_dflex_utility.ins_or_upd_descflex_attribs
1518 (p_appl_short_name => 'PER'
1519 ,p_descflex_name => 'PER_MEDICAL_ASSESSMENTS'
1520 ,p_attribute_category => p_rec.ATTRIBUTE_CATEGORY
1521 ,p_attribute1_name => 'ATTRIBUTE1'
1522 ,p_attribute1_value => p_rec.attribute1
1523 ,p_attribute2_name => 'ATTRIBUTE2'
1524 ,p_attribute2_value => p_rec.attribute2
1525 ,p_attribute3_name => 'ATTRIBUTE3'
1526 ,p_attribute3_value => p_rec.attribute3
1527 ,p_attribute4_name => 'ATTRIBUTE4'
1528 ,p_attribute4_value => p_rec.attribute4
1532 ,p_attribute6_value => p_rec.attribute6
1529 ,p_attribute5_name => 'ATTRIBUTE5'
1530 ,p_attribute5_value => p_rec.attribute5
1531 ,p_attribute6_name => 'ATTRIBUTE6'
1533 ,p_attribute7_name => 'ATTRIBUTE7'
1534 ,p_attribute7_value => p_rec.attribute7
1535 ,p_attribute8_name => 'ATTRIBUTE8'
1536 ,p_attribute8_value => p_rec.attribute8
1537 ,p_attribute9_name => 'ATTRIBUTE9'
1538 ,p_attribute9_value => p_rec.attribute9
1539 ,p_attribute10_name => 'ATTRIBUTE10'
1540 ,p_attribute10_value => p_rec.attribute10
1541 ,p_attribute11_name => 'ATTRIBUTE11'
1542 ,p_attribute11_value => p_rec.attribute11
1543 ,p_attribute12_name => 'ATTRIBUTE12'
1544 ,p_attribute12_value => p_rec.attribute12
1545 ,p_attribute13_name => 'ATTRIBUTE13'
1546 ,p_attribute13_value => p_rec.attribute13
1547 ,p_attribute14_name => 'ATTRIBUTE14'
1548 ,p_attribute14_value => p_rec.attribute14
1549 ,p_attribute15_name => 'ATTRIBUTE15'
1550 ,p_attribute15_value => p_rec.attribute15
1551 ,p_attribute16_name => 'ATTRIBUTE16'
1552 ,p_attribute16_value => p_rec.attribute16
1553 ,p_attribute17_name => 'ATTRIBUTE17'
1554 ,p_attribute17_value => p_rec.attribute17
1555 ,p_attribute18_name => 'ATTRIBUTE18'
1556 ,p_attribute18_value => p_rec.attribute18
1557 ,p_attribute19_name => 'ATTRIBUTE19'
1558 ,p_attribute19_value => p_rec.attribute19
1559 ,p_attribute20_name => 'ATTRIBUTE20'
1560 ,p_attribute20_value => p_rec.attribute20
1561 ,p_attribute21_name => 'ATTRIBUTE21'
1562 ,p_attribute21_value => p_rec.attribute21
1563 ,p_attribute22_name => 'ATTRIBUTE22'
1564 ,p_attribute22_value => p_rec.attribute22
1565 ,p_attribute23_name => 'ATTRIBUTE23'
1566 ,p_attribute23_value => p_rec.attribute23
1567 ,p_attribute24_name => 'ATTRIBUTE24'
1568 ,p_attribute24_value => p_rec.attribute24
1569 ,p_attribute25_name => 'ATTRIBUTE25'
1570 ,p_attribute25_value => p_rec.attribute25
1571 ,p_attribute26_name => 'ATTRIBUTE26'
1572 ,p_attribute26_value => p_rec.attribute26
1573 ,p_attribute27_name => 'ATTRIBUTE27'
1574 ,p_attribute27_value => p_rec.attribute27
1575 ,p_attribute28_name => 'ATTRIBUTE28'
1576 ,p_attribute28_value => p_rec.attribute28
1577 ,p_attribute29_name => 'ATTRIBUTE29'
1578 ,p_attribute29_value => p_rec.attribute29
1579 ,p_attribute30_name => 'ATTRIBUTE30'
1580 ,p_attribute30_value => p_rec.attribute30
1581 );
1582 end if;
1583 --
1584 hr_utility.set_location(' Leaving:'||l_proc,20);
1585 --
1586 end chk_df;
1587 --
1588 -- ----------------------------------------------------------------------------
1589 -- |-----------------------< chk_non_updateable_args >------------------------|
1590 -- ----------------------------------------------------------------------------
1591 -- {Start Of Comments}
1592 --
1593 -- Description:
1594 -- This procedure is used to ensure that non updateable attributes have
1595 -- not been updated. If an attribute has been updated an error is generated.
1596 --
1597 -- Pre Conditions:
1598 -- g_old_rec has been populated with details of the values currently in
1599 -- the database.
1600 --
1601 -- In Arguments:
1602 -- p_rec has been populated with the updated values the user would like the
1603 -- record set to.
1604 --
1605 -- Post Success:
1606 -- Processing continues if all the non updateable attributes have not
1607 -- changed.
1608 --
1609 -- Post Failure:
1610 -- An application error is raised if any of the non updatable attributes
1611 -- have been altered.
1612 --
1613 -- {End Of Comments}
1614 -- ----------------------------------------------------------------------------
1615 PROCEDURE chk_non_updateable_args
1616 (p_effective_date IN DATE
1617 ,p_rec IN per_mea_shd.g_rec_type
1618 ) IS
1619 --
1620 l_proc VARCHAR2(72) := g_package || 'chk_non_updateable_args';
1621 l_error EXCEPTION;
1622 l_argument VARCHAR2(30);
1623 --
1624 BEGIN
1625 --
1626 -- Only proceed with the validation if a row exists for the current
1627 -- record in the HR Schema.
1628 --
1629 IF NOT per_mea_shd.api_updating
1630 (p_medical_assessment_id => p_rec.medical_assessment_id
1631 ,p_object_version_number => p_rec.object_version_number) THEN
1632 --
1633 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
1634 fnd_message.set_token('PROCEDURE ', l_proc);
1635 fnd_message.set_token('STEP ', '5');
1636 fnd_message.raise_error;
1637 --
1638 END IF;
1639 --
1643 l_argument := 'person_id';
1640 IF nvl(p_rec.person_id, hr_api.g_number) <>
1641 nvl(per_mea_shd.g_old_rec.person_id,hr_api.g_number) THEN
1642 --
1644 RAISE l_error;
1645 --
1646 END IF;
1647 --
1648 EXCEPTION
1649 WHEN l_error THEN
1650 hr_api.argument_changed_error
1651 (p_api_name => l_proc
1652 ,p_argument => l_argument);
1653 WHEN OTHERS THEN
1654 RAISE;
1655 END chk_non_updateable_args;
1656 --
1657 -- ----------------------------------------------------------------------------
1658 -- |---------------------------< insert_validate >----------------------------|
1659 -- ----------------------------------------------------------------------------
1660 --
1661 PROCEDURE insert_validate
1662 (p_effective_date IN DATE
1663 ,p_rec IN per_mea_shd.g_rec_type) IS
1664 --
1665 -- Declare cursors
1666 --
1667 CURSOR csr_business_group is
1668 SELECT business_group_id
1669 FROM per_all_people_f pap
1670 WHERE pap.person_id = p_rec.person_id
1671 AND p_effective_date BETWEEN pap.effective_start_date AND pap.effective_end_date;
1672 --
1673 -- Declare local variables
1674 --
1675 l_proc VARCHAR2(72) := g_package||'insert_validate';
1676 l_business_group_id per_all_people_f.business_group_id%TYPE;
1677 --
1678 BEGIN
1679 --
1680 hr_utility.set_location('Entering:'||l_proc, 10);
1681 --
1682 -- Call all supporting business operations
1683 --
1684 per_per_bus.set_security_group_id(p_person_id => to_number(p_rec.person_id));
1685 --
1686 hr_utility.set_location(l_proc, 20);
1687 --
1688 -- Validate person id
1689 --
1690 per_mea_bus.chk_person_id
1691 (p_medical_assessment_id => p_rec.medical_assessment_id
1692 ,p_person_id => p_rec.person_id
1693 ,p_effective_date => p_effective_date);
1694 --
1695 hr_utility.set_location(l_proc, 30);
1696 --
1697 hr_utility.set_location(l_proc, 40);
1698 --
1699 -- Get Business Group ID for validating organization_id
1700 --
1701 OPEN csr_business_group;
1702 FETCH csr_business_group INTO l_business_group_id;
1703 --
1704 hr_utility.set_location(l_proc, 50);
1705 --
1706 IF csr_business_group%NOTFOUND THEN
1707 --
1708 CLOSE csr_business_group;
1709 --
1710 hr_utility.set_message(800, 'HR_52919_DIS_INV_ORG');
1711 hr_utility.raise_error;
1712 --
1713 END IF;
1714 --
1715 CLOSE csr_business_group;
1716 --
1717 hr_utility.set_location(l_proc, 60);
1718 --
1719 -- Validate Organization Id (Occupational Health Service Provider)
1720 --
1721 per_mea_bus.chk_organization_id
1722 (p_medical_assessment_id => p_rec.medical_assessment_id
1723 ,p_organization_id => p_rec.organization_id
1724 ,p_business_group_id => l_business_group_id
1725 ,p_effective_date => p_effective_date);
1726 --
1727 hr_utility.set_location(l_proc, 70);
1728 --
1729 -- Check Consultation Date
1730 --
1731 per_mea_bus.chk_consultation_date
1732 (p_consultation_date => p_rec.consultation_date
1733 ,p_next_consultation_date => p_rec.consultation_date);
1734 --
1735 hr_utility.set_location(l_proc, 80);
1736 --
1737 -- Check Consultation Type
1738 --
1739 per_mea_bus.chk_consultation_type
1740 (p_medical_assessment_id => p_rec.medical_assessment_id
1741 ,p_consultation_type => p_rec.consultation_type
1742 ,p_consultation_result => p_rec.consultation_result
1743 ,p_effective_date => p_effective_date);
1744 --
1745 hr_utility.set_location(l_proc, 90);
1746 --
1747 -- Check Consultation Result
1748 --
1749 per_mea_bus.chk_consultation_result
1750 (p_medical_assessment_id => p_rec.medical_assessment_id
1751 ,p_consultation_type => p_rec.consultation_type
1752 ,p_consultation_result => p_rec.consultation_result
1753 ,p_effective_date => p_effective_date);
1754 --
1755 hr_utility.set_location(l_proc, 100);
1756 --
1757 -- Check Incident ID
1758 --
1759 per_mea_bus.chk_incident_id
1760 (p_incident_id => p_rec.incident_id
1761 ,p_medical_assessment_id => p_rec.medical_assessment_id);
1762 --
1763 hr_utility.set_location(l_proc, 105);
1764 --
1765 -- Check the incident date is not after the consultation date
1766 --
1767 per_mea_bus.chk_inc_consul_date
1768 (p_consultation_date => p_rec.consultation_date
1769 ,p_incident_id => p_rec.incident_id);
1770 --
1771 hr_utility.set_location(l_proc, 110);
1772 --
1773 -- Check Disability ID
1774 --
1775 per_mea_bus.chk_disability_id
1776 (p_disability_id => p_rec.disability_id
1777 ,p_medical_assessment_id => p_rec.medical_assessment_id
1778 ,p_person_id => p_rec.person_id
1779 ,p_object_version_number => p_rec.object_version_number
1780 ,p_effective_date => p_effective_date);
1781 --
1782 hr_utility.set_location(l_proc, 120);
1783 --
1784 -- Check Next Consultation Date
1785 --
1789 --
1786 per_mea_bus.chk_next_consultation_date
1787 (p_next_consultation_date => p_rec.next_consultation_date
1788 ,p_consultation_date => p_rec.consultation_date );
1790 hr_utility.set_location(l_proc, 130);
1791 --
1792 -- Check that no other medical records exists with
1793 -- the same disability ID and Incident ID
1794 --
1795 per_mea_bus.chk_valid_id_combinations
1796 (p_medical_assessment_id => p_rec.medical_assessment_id
1797 ,p_disability_id => p_rec.disability_id
1798 ,p_incident_id => p_rec.incident_id
1799 ,p_person_id => p_rec.person_id);
1800 --
1801 hr_utility.set_location(l_proc, 140);
1802 --
1803 -- Check that the incident id belongs to the disability
1804 -- record, if the disability id is not null
1805 --
1806 per_mea_bus.chk_inc_against_dis
1807 (p_disability_id => p_rec.disability_id
1808 ,p_incident_id => p_rec.incident_id
1809 ,p_person_id => p_rec.person_id
1810 ,p_effective_date => p_effective_date);
1811 --
1812 -- Check developer flex field
1813 --
1814 per_mea_bus.chk_ddf(p_rec);
1815 --
1816 hr_utility.set_location(l_proc, 150);
1817 --
1818 -- Check flex field
1819 --
1820 per_mea_bus.chk_df(p_rec);
1821 --
1822 hr_utility.set_location(' Leaving:'||l_proc, 160);
1823 --
1824 END insert_validate;
1825 --
1826 -- ----------------------------------------------------------------------------
1827 -- |---------------------------< update_validate >----------------------------|
1828 -- ----------------------------------------------------------------------------
1829 --
1830 PROCEDURE update_validate
1831 (p_effective_date IN DATE
1832 ,p_rec IN per_mea_shd.g_rec_type
1833 ) IS
1834 --
1835 -- Declare cursors
1836 --
1837 CURSOR csr_business_group is
1838 SELECT business_group_id
1839 FROM per_all_people_f pap
1840 WHERE pap.person_id = p_rec.person_id
1841 AND p_effective_date BETWEEN pap.effective_start_date AND pap.effective_end_date;
1842 --
1843 -- Declare local variables
1844 --
1845 l_proc VARCHAR2(72) := g_package||'update_validate';
1846 l_business_group_id per_all_people_f.business_group_id%TYPE;
1847 --
1848 BEGIN
1849 --
1850 hr_utility.set_location('Entering:'||l_proc, 10);
1851 --
1852 -- Call parent person table's set_security_group_id function
1853 --
1854 per_per_bus.set_security_group_id(p_person_id => to_number(p_rec.person_id));
1855 --
1856 -- Check that all non updateble arguements have not been changed
1857 --
1858 chk_non_updateable_args
1859 (p_effective_date => p_effective_date
1860 ,p_rec => p_rec);
1861 --
1862 hr_utility.set_location(l_proc, 40);
1863 --
1864 -- Get Business Group ID for validating organization_id
1865 --
1866 OPEN csr_business_group;
1867 FETCH csr_business_group INTO l_business_group_id;
1868 --
1869 hr_utility.set_location(l_proc, 50);
1870 --
1871 IF csr_business_group%NOTFOUND THEN
1872 --
1873 CLOSE csr_business_group;
1874 --
1875 hr_utility.set_message(800, 'HR_52919_DIS_INV_ORG');
1876 hr_utility.raise_error;
1877 --
1878 END IF;
1879 --
1880 CLOSE csr_business_group;
1881 --
1882 hr_utility.set_location(l_proc, 60);
1883 --
1884 -- Validate Organization Id (Occupational Health Service Provider)
1885 --
1886 per_mea_bus.chk_organization_id
1887 (p_medical_assessment_id => p_rec.medical_assessment_id
1888 ,p_organization_id => p_rec.organization_id
1889 ,p_business_group_id => l_business_group_id
1890 ,p_effective_date => p_effective_date);
1891 --
1892 hr_utility.set_location(l_proc, 70);
1893 --
1894 -- Check Consultation Date
1895 --
1896 per_mea_bus.chk_consultation_date
1897 (p_consultation_date => p_rec.consultation_date
1898 ,p_next_consultation_date => p_rec.consultation_date);
1899 --
1900 hr_utility.set_location(l_proc, 80);
1901 --
1902 -- Check Consultation Type
1903 --
1904 per_mea_bus.chk_consultation_type
1905 (p_medical_assessment_id => p_rec.medical_assessment_id
1906 ,p_consultation_type => p_rec.consultation_type
1907 ,p_consultation_result => p_rec.consultation_result
1908 ,p_effective_date => p_effective_date);
1909 --
1910 hr_utility.set_location(l_proc, 90);
1911 --
1912 -- Check Consultation Result
1913 --
1914 per_mea_bus.chk_consultation_result
1915 (p_medical_assessment_id => p_rec.medical_assessment_id
1916 ,p_consultation_type => p_rec.consultation_type
1917 ,p_consultation_result => p_rec.consultation_result
1918 ,p_effective_date => p_effective_date);
1919 --
1920 hr_utility.set_location(l_proc, 100);
1921 --
1922 -- Check Incident ID
1923 --
1924 per_mea_bus.chk_incident_id
1925 (p_incident_id => p_rec.incident_id
1926 ,p_medical_assessment_id => p_rec.medical_assessment_id);
1927 --
1928 hr_utility.set_location(l_proc, 105);
1929 --
1933 (p_consultation_date => p_rec.consultation_date
1930 -- Check the incident date is not after the consultation date
1931 --
1932 per_mea_bus.chk_inc_consul_date
1934 ,p_incident_id => p_rec.incident_id);
1935 --
1936 hr_utility.set_location(l_proc, 110);
1937 --
1938 -- Check Disability ID
1939 --
1940 per_mea_bus.chk_disability_id
1941 (p_disability_id => p_rec.disability_id
1942 ,p_medical_assessment_id => p_rec.medical_assessment_id
1943 ,p_person_id => p_rec.person_id
1944 ,p_object_version_number => p_rec.object_version_number
1945 ,p_effective_date => p_effective_date);
1946 --
1947 hr_utility.set_location(l_proc, 120);
1948 --
1949 -- Check Next Consultation Date
1950 --
1951 per_mea_bus.chk_next_consultation_date
1952 (p_next_consultation_date => p_rec.next_consultation_date
1953 ,p_consultation_date => p_rec.consultation_date );
1954 --
1955 hr_utility.set_location(l_proc, 130);
1956 --
1957 -- Check that no other medical records exists with
1958 -- the same disability ID and Incident ID
1959 --
1960 per_mea_bus.chk_valid_id_combinations
1961 (p_medical_assessment_id => p_rec.medical_assessment_id
1962 ,p_disability_id => p_rec.disability_id
1963 ,p_incident_id => p_rec.incident_id
1964 ,p_person_id => p_rec.person_id);
1965 --
1966 hr_utility.set_location(l_proc, 140);
1967 --
1968 -- Check that the incident id belongs to the disability
1969 -- record, if the disability id is not null
1970 --
1971 per_mea_bus.chk_inc_against_dis
1972 (p_disability_id => p_rec.disability_id
1973 ,p_incident_id => p_rec.incident_id
1974 ,p_person_id => p_rec.person_id
1975 ,p_effective_date => p_effective_date);
1976 --
1977 hr_utility.set_location(l_proc, 150);
1978 --
1979 per_mea_bus.chk_ddf(p_rec);
1980 --
1981 hr_utility.set_location(l_proc, 160);
1982 --
1983 per_mea_bus.chk_df(p_rec);
1984 --
1985 hr_utility.set_location(' Leaving:'||l_proc, 130);
1986 --
1987 END update_validate;
1988 --
1989 -- ----------------------------------------------------------------------------
1990 -- |---------------------------< delete_validate >----------------------------|
1991 -- ----------------------------------------------------------------------------
1992 --
1993 PROCEDURE delete_validate
1994 (p_rec IN per_mea_shd.g_rec_type) IS
1995 --
1996 l_proc VARCHAR2(72) := g_package||'delete_validate';
1997 --
1998 BEGIN
1999 --
2000 hr_utility.set_location('Entering:'||l_proc, 5);
2001 --
2002 -- Call all supporting business operations
2003 --
2004 hr_utility.set_location(' Leaving:'||l_proc, 10);
2005 --
2006 END delete_validate;
2007 --
2008 END per_mea_bus;