DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_RTM_BUS

Source


1 Package Body irc_rtm_bus as
2 /* $Header: irrtmrhi.pkb 120.3 2008/01/22 10:17:45 mkjayara noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_rtm_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_rec_team_member_id          number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_rec_team_member_id                   in number
22   ,p_associated_column1                   in varchar2 default null
23   ,p_associated_column2                   in varchar2 default null
24   ) is
25 
26   -- Declare local variables
27   --
28   l_security_group_id number;
29   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
30   --
31 begin
32   --
33   hr_utility.set_location('Entering:'|| l_proc, 10);
34   --
35   -- Ensure that all the mandatory parameter are not null
36   --
37   hr_api.mandatory_arg_error
38     (p_api_name           => l_proc
39     ,p_argument           => 'rec_team_member_id'
40     ,p_argument_value     => p_rec_team_member_id
41     );
42   --
43   hr_utility.set_location(' Leaving:'|| l_proc, 20);
44   --
45 end set_security_group_id;
46 --
47 --  ---------------------------------------------------------------------------
48 --  |---------------------< return_legislation_code >-------------------------|
49 --  ---------------------------------------------------------------------------
50 --
51 Function return_legislation_code
52   (p_rec_team_member_id in     number
53   )
54   Return Varchar2 Is
55    --
56   -- Declare cursor
57   --
58   --
59   -- Declare local variables
60   --
61   l_legislation_code  varchar2(150);
62   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
63   --
64 Begin
65   --
66   hr_utility.set_location('Entering:'|| l_proc, 10);
67   --
68   -- Ensure that all the mandatory parameter are not null
69   --
70   hr_api.mandatory_arg_error
71     (p_api_name           => l_proc
72     ,p_argument           => 'rec_team_member_id'
73     ,p_argument_value     => p_rec_team_member_id
74     );
75   --
76 
77   hr_utility.set_location(' Leaving:'|| l_proc, 40);
78   return l_legislation_code;
79 end return_legislation_code;
80 --
81 -- ----------------------------------------------------------------------------
82 -- |-----------------------< chk_non_updateable_args >------------------------|
83 -- ----------------------------------------------------------------------------
84 -- {Start Of Comments}
85 --
86 -- Description:
87 --   This procedure is used to ensure that non updateable attributes have
88 --   not been updated. If an attribute has been updated an error is generated.
89 --
90 -- Pre Conditions:
91 --   g_old_rec has been populated with details of the values currently in
92 --   the database.
93 --
94 -- In Arguments:
95 --   p_rec has been populated with the updated values the user would like the
96 --   record set to.
97 --
98 -- Post Success:
99 --   Processing continues if all the non updateable attributes have not
100 --   changed.
101 --
102 -- Post Failure:
103 --   An application error is raised if any of the non updatable attributes
104 --   have been altered.
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure chk_non_updateable_args
109   (p_rec in irc_rtm_shd.g_rec_type
110   ) IS
111 --
112   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
113 --
114 Begin
115   hr_utility.set_location(' Entering:'||l_proc,10);
116   --
117   -- Only proceed with the validation if a row exists for the current
118   -- record in the HR Schema.
119   --
120   IF NOT irc_rtm_shd.api_updating
121       (p_rec_team_member_id                   => p_rec.rec_team_member_id
122       ,p_object_version_number                => p_rec.object_version_number
123       ) THEN
124      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
125      fnd_message.set_token('PROCEDURE ', l_proc);
126      fnd_message.set_token('STEP ', '5');
127      fnd_message.raise_error;
128   END IF;
129   --
130   --   Add checks to ensure non-updateable args have
131   --   not been updated.
132   --
133   if p_rec.rec_team_member_id <> irc_rtm_shd.g_old_rec.rec_team_member_id
134   then
135     hr_api.argument_changed_error
136     (p_api_name   => l_proc
137     ,p_argument   => 'REC_TEAM_MEMBER_ID'
138     ,p_base_table => irc_rtm_shd.g_tab_name
139     );
140   end if;
141   --
142   if p_rec.vacancy_id <> irc_rtm_shd.g_old_rec.vacancy_id
143   then
144     hr_api.argument_changed_error
145     (p_api_name   => l_proc
146     ,p_argument   => 'VACANCY_ID'
147     ,p_base_table => irc_rtm_shd.g_tab_name
148     );
149   end if;
150   --
151   hr_utility.set_location(' Leaving:'||l_proc,20);
152 --
153 End chk_non_updateable_args;
154 --
155 -- ----------------------------------------------------------------------------
156 -- |---------------------------< chk_person_id >-------------------------------|
157 -- ----------------------------------------------------------------------------
158 --
159 -- Description:
160 --   Validates if the person id exists in the PER_ALL_PEOPLE_F table
161 --
162 -- Prerequisites:
163 --   Must be called as the first step in insert_validate.
164 --
165 -- In Arguments:
166 --   p_person_id
167 --
168 -- Post Success:
169 --   If the person_id is existing in PER_ALL_PEOPLE_F
170 --   then continue.
171 --
172 -- Post Failure:
173 --   If the person_id is not present in PER_ALL_PEOPLE_F
174 --   then throw an error indicating the same.
175 --
176 -- Access Status:
177 --   Internal Row Handler Use Only.
178 --
179 -- ----------------------------------------------------------------------------
180 Procedure chk_person_id
181   (p_person_id           in irc_rec_team_members.person_id%type
182   ,p_party_id in out nocopy irc_rec_team_members.party_id%type
183   ,p_effective_date      in date
184   ) is
185 --
186   l_proc  varchar2(72) := g_package||'chk_person_id';
187   l_party_id irc_rec_team_members.party_id%type;
188   l_var varchar2(1);
189 --
190   cursor l_person is
191     select party_id
192       from per_all_people_f
193      where person_id = p_person_id
194        and p_effective_date between
195            effective_start_date and effective_end_date;
196 --
197 
198 
199 cursor csr_system_person_type is
200 SELECT NULL
201   FROM per_all_people_f paf
202  WHERE paf.person_id = p_person_id
203    AND p_effective_date BETWEEN paf.effective_start_date
204                             AND paf.effective_end_date
205    AND (   NVL (paf.current_employee_flag, 'N') = 'Y'
206         OR (    NVL (paf.current_npw_flag, 'N') = 'Y'
207             AND NVL (fnd_profile.VALUE ('HR_TREAT_CWK_AS_EMP'), 'N') = 'Y'
208            )
209        );
210 
211 --
212 --
213 --
214 Begin
215   --
216   hr_utility.set_location(' Entering:'||l_proc,10);
217   --
218   open l_person;
219   fetch l_person into l_party_id;
220   if l_person%notfound
221   then
222     close l_person;
223     fnd_message.set_name('PER','IRC_412157_PARTY_PERS_MISMTCH');
224     fnd_message.raise_error;
225   else
226     close l_person;
227     --check if the person is an employee
228     open csr_system_person_type;
229     fetch csr_system_person_type into l_var;
230     hr_utility.set_location(l_proc, 20);
231     if csr_system_person_type%notfound then
232       close csr_system_person_type;
233       hr_utility.set_location(l_proc, 30);
234       fnd_message.set_name('PER','IRC_412034_RTM_INV_EMP');
235       hr_multi_message.add
236           (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.PERSON_ID'
237           );
238      else
239        close csr_system_person_type;
240     end if;
241   end if;
242   --
243   if p_party_id is not null then
244     if p_party_id<>l_party_id then
245       fnd_message.set_name('PER','IRC_412033_RTM_INV_PARTY_ID');
246       fnd_message.raise_error;
247     end if;
248   else
249     p_party_id:=l_party_id;
250   end if;
251   --
252   --
253   hr_utility.set_location(' Leaving:'||l_proc,50);
254   --
255 exception
256   when app_exception.application_exception then
257     if hr_multi_message.exception_add
258       (p_associated_column1 => 'IRC_REC_TEAM_MEMBERS.PERSON_ID'
259       ) then
260       --
261       hr_utility.set_location(' Leaving:'||l_proc,60);
262       --
263       raise;
264     end if;
265     --
266     hr_utility.set_location(' Leaving:'||l_proc,70);
267     --
268 End chk_person_id;
269 --
270 --
271 --
272 --
273 -- ----------------------------------------------------------------------------
274 -- |-----------------------< chk_vacancy_id >---------------------------------|
275 -- ----------------------------------------------------------------------------
276 -- {Start Of Comments}
277 --
278 -- Description:
279 --   This procedure is used to ensure that mandatory parameters have been set.
280 --   If the vacancy id is not found in per_all_vacancies an error is generated.
281 --
282 -- Pre Conditions:
283 --   g_old_rec has been populated with details of the values currently in
284 --   the database.
285 --
286 -- In Arguments:
287 --   p_vacancy_id
288 --   p_start_date.
289 --
290 -- Post Success:
291 --   Processing continues if the mandatory parameters have been set and the
292 --   specified vacancy id exists.
293 --
294 -- Post Failure:
295 --   An application error is raised if the vacancy id does not exist.
296 --
297 -- {End Of Comments}
298 -- ----------------------------------------------------------------------------
299 Procedure chk_vacancy_id
300   (p_vacancy_id in irc_rec_team_members.vacancy_id%type
301   ,p_start_date in irc_rec_team_members.start_date%type
302   ) IS
303 --
304   l_proc     varchar2(72) := g_package || 'chk_vacancy_id';
305   l_vacancy_id  irc_rec_team_members.vacancy_id%type;
306 --
307 --
308 --   Cursor to check that the vacancy_id exists in PER_ALL_VACANCIES
309 --   and is current at the p_start_date.
310 --
311 cursor csr_vacancy_id is
312   select vacancy_id
313     from per_all_vacancies
314   where vacancy_id = p_vacancy_id;
315 --
316 Begin
317 --
318   hr_utility.set_location(' Entering:'||l_proc,10);
319   --
320   hr_api.mandatory_arg_error
321     (p_api_name           => l_proc
322     ,p_argument           => 'vacancy_id'
323     ,p_argument_value     => p_vacancy_id
324     );
325   --
326   -- Check if the vacancy_id exists in PER_ALL_VACANCIES
327   -- and is current at the p_start_date.
328   --
329   open csr_vacancy_id;
330   fetch csr_vacancy_id into l_vacancy_id;
331   hr_utility.set_location(l_proc, 30);
332   if csr_vacancy_id%notfound then
333     close csr_vacancy_id;
334     fnd_message.set_name('PER','IRC_412032_RTM_INV_VACANCY_ID');
335     fnd_message.raise_error;
336   end if;
337   close csr_vacancy_id;
338   hr_utility.set_location(' Leaving:'||l_proc,35);
339   --
340   exception
341     when app_exception.application_exception then
342       if hr_multi_message.exception_add
343            (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.VACANCY_ID'
344            ) then
345         hr_utility.set_location(' Leaving:'||l_proc, 40);
346         raise;
347       end if;
348   hr_utility.set_location(' Leaving:'||l_proc,50);
349 --
350 End chk_vacancy_id;
351 --
352 --
353 -- ----------------------------------------------------------------------------
354 -- |-----------------------< chk_job_id >------------------------------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 --   This procedure is used to ensure that mandatory parameters have been set.
360 --   If the job id is not found in per_jobs an error is generated.
361 --
362 -- Pre Conditions:
363 --   g_old_rec has been populated with details of the values currently in
364 --   the database.
365 --
366 -- In Arguments:
367 --   p_job_id
368 --   p_party_id
369 --   p_vacancy_id
370 --   p_object_version_number.
371 --
372 -- Post Success:
373 --   Processing continues if the mandatory parameters have been set and the
374 --   specified job id exists.
375 --
376 -- Post Failure:
377 --   An application error is raised if the job id does not exist.
378 --
379 -- {End Of Comments}
380 -- ----------------------------------------------------------------------------
381 Procedure chk_job_id
382   (p_job_id in irc_rec_team_members.job_id%type
383   ,p_rec_team_member_id in irc_rec_team_members.rec_team_member_id%type
384   ,p_vacancy_id in irc_rec_team_members.vacancy_id%type
385   ,p_object_version_number in irc_rec_team_members.object_version_number%type
386   ,p_start_date in irc_rec_team_members.start_date%type
387   ) IS
388 --
389   l_proc     varchar2(72) := g_package || 'chk_job_id';
390   l_job_id  varchar2(1);
391   l_api_updating boolean;
392 --
393 --
394 --   Cursor to check that the job_id exists in PER_JOBS
395 --
396 cursor csr_job_id is
397   select null from
398     per_jobs job, per_all_vacancies vac
399   where job.job_id = p_job_id
400   and vac.vacancy_id = p_vacancy_id
401   and vac.business_group_id = job.business_group_id
402   and p_start_date between job.date_from and nvl(job.date_to,hr_api.g_eot);
403 --
404 Begin
405 --
406   hr_utility.set_location(' Entering:'||l_proc,10);
407   --
408   l_api_updating := irc_rtm_shd.api_updating(p_rec_team_member_id
409     ,p_object_version_number);
410   --
411   hr_utility.set_location(l_proc, 30);
412   if(p_job_id IS NOT NULL) then
413     if ((l_api_updating
414       and (irc_rtm_shd.g_old_rec.job_id <> p_job_id))
415       or (NOT l_api_updating)) then
416       --
417       -- Check if the job_id exists in PER_JOBS
418       --
419       if hr_multi_message.no_exclusive_error
420          (p_check_column1      => 'IRC_REC_TEAM_MEMBERS.VACANCY_ID'
421          ) then
422         open csr_job_id;
423         fetch csr_job_id into l_job_id;
424         hr_utility.set_location(l_proc, 40);
425         if csr_job_id%notfound then
426           close csr_job_id;
427           fnd_message.set_name('PER','IRC_412037_RTM_INV_JOB_ID');
428           fnd_message.raise_error;
429         end if;
430         close csr_job_id;
431       end if;
432     end if;
433   end if;
434   hr_utility.set_location(' Leaving:'||l_proc,45);
435   --
436   exception
437     when app_exception.application_exception then
438       if hr_multi_message.exception_add
439            (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.JOB_ID'
440            ) then
444   hr_utility.set_location(' Leaving:'||l_proc,60);
441         hr_utility.set_location(' Leaving:'||l_proc, 50);
442         raise;
443     end if;
445 --
446 End chk_job_id;
447 --
448 -- ----------------------------------------------------------------------------
449 -- |-----------------------< chk_job_id_job_group_id >------------------------|
450 -- ----------------------------------------------------------------------------
451 -- {Start Of Comments}
452 --
453 -- Description:
454 --   This procedure is used to ensure that the job group of the job is valid.
455 --   If the job group id is not found in per_job_groups an error is generated.
456 --
457 -- Pre Conditions:
458 --   g_old_rec has been populated with details of the values currently in
459 --   the database.
460 --
461 -- In Arguments:
462 --   p_party_id
463 --   p_vacancy_id
464 --   p_job_id.
465 --   p_object_version_number.
466 --
467 -- Post Success:
468 --   Processing continues if the mandatory parameters have been set and the
469 --   specified job group id is valid.
470 --
471 -- Post Failure:
472 --   An application error is raised if the job group id does not exist.
473 --
474 -- {End Of Comments}
475 -- ----------------------------------------------------------------------------
476 Procedure chk_job_id_job_group_id
477   (p_rec_team_member_id irc_rec_team_members.rec_team_member_id%type
478   ,p_job_id in irc_rec_team_members.job_id%type
479   ,p_object_version_number irc_rec_team_members.object_version_number%type
480   ) IS
481 --
482   l_proc     varchar2(72) := g_package || 'chk_job_id_job_group_id';
483   l_job_id_job_group_id  varchar2(1);
484   l_api_updating boolean;
485 --
486 --
487 --   Cursor to check that the job_group_id exists in PER_JOB_GROUPS and
488 --   is valid.
489 --
490 cursor csr_job_id_job_group_id is
491   select null from
492     per_jobs job
493    ,per_job_groups jgr
494   where job.job_id = p_job_id
495   and job.job_group_id = jgr.job_group_id
496   and job.business_group_id = jgr.business_group_id
497   and jgr.internal_name <> 'HR_'||to_char(jgr.business_group_id);
498 --
499 Begin
500 --
501   hr_utility.set_location(' Entering:'||l_proc,10);
502   --
503   l_api_updating := irc_rtm_shd.api_updating(p_rec_team_member_id
504     ,p_object_version_number);
505   --
506   if(p_job_id IS NOT NULL) then
507     if ((l_api_updating
508       and (irc_rtm_shd.g_old_rec.job_id <> p_job_id))
509       or (NOT l_api_updating)) then
510       hr_utility.set_location(l_proc, 20);
511       --
512       -- Check if the job_group_id exists in PER_JOB_GROUPS and is valid.
513       --
514       if hr_multi_message.no_exclusive_error
515              (p_check_column1      => 'IRC_REC_TEAM_MEMBERS.JOB_ID'
516              ,p_check_column2      => 'IRC_REC_TEAM_MEMBERS.VACANCY_ID'
517              ) then
518         open csr_job_id_job_group_id;
519         fetch csr_job_id_job_group_id into l_job_id_job_group_id;
520         hr_utility.set_location(l_proc, 30);
521         if csr_job_id_job_group_id%notfound then
522           close csr_job_id_job_group_id;
523           fnd_message.set_name('PER','IRC_412041_RTM_INV_JOB_GRP_ID');
524           fnd_message.raise_error;
525         end if;
526         close csr_job_id_job_group_id;
527       end if;
528     end if;
529   end if;
530   hr_utility.set_location(' Leaving:'||l_proc,35);
531   --
532   exception
533     when app_exception.application_exception then
534       if hr_multi_message.exception_add
535              (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.JOB_ID'
536              ) then
537           hr_utility.set_location(' Leaving:'||l_proc, 40);
538           raise;
539       end if;
540   hr_utility.set_location(' Leaving:'||l_proc,50);
541 --
542 End chk_job_id_job_group_id;
543 --
544 -- ----------------------------------------------------------------------------
545 -- |-----------------------< chk_team_dates >---------------------------------|
546 -- ----------------------------------------------------------------------------
547 -- {Start Of Comments}
548 --
549 -- Description:
550 --   This procedure is used to ensure that valid dates have been entered.
551 --
552 -- Pre Conditions:
553 --   g_old_rec has been populated with details of the values currently in
554 --   the database.
555 --
556 -- In Arguments:
557 --   p_start_date
558 --   p_end_date
559 --   p_party_id
560 --   p_vacancy_id
561 --   p_object_version_number.
562 --
563 -- Post Success:
564 --   Processing continues if valid dates are entered.
565 --
566 -- Post Failure:
567 --   An application error is raised if valid dates are not entered.
568 --
569 -- {End Of Comments}
570 -- ----------------------------------------------------------------------------
571 Procedure chk_team_dates
572   (p_start_date in irc_rec_team_members.start_date%type
573   ,p_end_date in irc_rec_team_members.end_date%type
574   ,p_rec_team_member_id in irc_rec_team_members.rec_team_member_id%type
575   ,p_object_version_number in irc_rec_team_members.object_version_number%type
576   ) IS
577 --
578   l_proc     varchar2(72) := g_package || 'chk_team_dates';
579   l_api_updating boolean;
583   hr_utility.set_location(' Entering:'||l_proc,10);
580 --
581 Begin
582 --
584   if (p_start_date is not NULL or p_end_date is not NULL) then
585   --
586     l_api_updating := irc_rtm_shd.api_updating(p_rec_team_member_id
587       ,p_object_version_number);
588     --
589     --  Check to see if start_date or end_date values have changed.
590     --
591     hr_utility.set_location(l_proc, 30);
592     if ((l_api_updating
593       and ((nvl(irc_rtm_shd.g_old_rec.start_date,hr_api.g_sot)
594             <> p_start_date)
595       or (nvl(irc_rtm_shd.g_old_rec.end_date,hr_api.g_eot) <> p_end_date)))
596       or (NOT l_api_updating)) then
597       --
598       -- Check that the end date is not before the start date.
599       --
600       hr_utility.set_location(l_proc, 40);
601       if(nvl(p_start_date,hr_api.g_sot) > nvl(p_end_date,hr_api.g_eot)) then
602         fnd_message.set_name('PER','IRC_412038_RTM_INV_ST_END_DATE');
603         fnd_message.raise_error;
604       end if;
605       --
606     end if;
607   end if;
608   hr_utility.set_location(' Leaving:'||l_proc,45);
609   exception
610     when app_exception.application_exception then
611       if hr_multi_message.exception_add
612                (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.START_DATE'
613                ,p_associated_column2      => 'IRC_REC_TEAM_MEMBERS.END_DATE'
614                ) then
615             hr_utility.set_location(' Leaving:'||l_proc, 50);
616             raise;
617       end if;
618   hr_utility.set_location(' Leaving:'||l_proc,60);
619 --
620 End chk_team_dates;
621 --
622 -- ----------------------------------------------------------------------------
623 -- |-----------------------< chk_update_allowed >-----------------------------|
624 -- ----------------------------------------------------------------------------
625 -- {Start Of Comments}
626 --
627 -- Description:
628 --   This procedure is used to ensure a valid 'Update Allowed' value.
629 --
630 -- Pre Conditions:
631 --   g_old_rec has been populated with details of the values currently in
632 --   the database.
633 --
634 -- In Arguments:
635 --  p_update_allowed
636 --  p_start_date
637 --  p_party_id
638 --  p_vacancy_id
639 --  p_object_version_number.
640 --
641 -- Post Success:
642 --   Processing continues if a valid 'Update Allowed' value is entered.
643 --
644 -- Post Failure:
645 --   An application error is raised if a valid 'Update Allowed' value is not
646 --   entered.
647 --
648 -- {End Of Comments}
649 -- ----------------------------------------------------------------------------
650 Procedure chk_update_allowed
651   (p_update_allowed  in irc_rec_team_members.update_allowed%type
652   ,p_start_date in irc_rec_team_members.start_date%type
653   ,p_rec_team_member_id in irc_rec_team_members.rec_team_member_id%type
654   ,p_object_version_number in irc_rec_team_members.object_version_number%type
655   ) IS
656 --
657   l_proc     varchar2(72) := g_package || 'chk_update_allowed';
658   l_var      boolean;
659   l_api_updating boolean;
660 --
661 Begin
662 --
663   hr_utility.set_location(' Entering:'||l_proc,10);
664   if (p_update_allowed is not NULL) then
665   --
666     l_api_updating := irc_rtm_shd.api_updating(p_rec_team_member_id
667       ,p_object_version_number);
668     --
669     --  Check to see if the update_allowed value has changed.
670     --
671     hr_utility.set_location(l_proc, 30);
672     if ((l_api_updating
673       and (irc_rtm_shd.g_old_rec.update_allowed <> p_update_allowed))
674       or (NOT l_api_updating)) then
675       --
676       -- Check that a valid 'Update Allowed' value is entered.
677       --
678       l_var := hr_api.not_exists_in_hr_lookups
679                (p_start_date
680                ,'YES_NO'
681                ,p_update_allowed
682                );
683       hr_utility.set_location(l_proc, 40);
684       if (l_var = true) then
685         fnd_message.set_name('PER','IRC_412039_RTM_INV_UPD_ALLOWED');
686         fnd_message.raise_error;
687       end if;
688     end if;
689     --
690   end if;
691   hr_utility.set_location(' Leaving:'||l_proc,45);
692   exception
693     when app_exception.application_exception then
694       if hr_multi_message.exception_add
695                  (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.UPDATE_ALLOWED'
696                  ) then
697               hr_utility.set_location(' Leaving:'||l_proc, 50);
698               raise;
699       end if;
700   hr_utility.set_location(' Leaving:'||l_proc,60);
701 --
702 End chk_update_allowed;
703 --
704 -- ----------------------------------------------------------------------------
705 -- |-----------------------< chk_delete_allowed >-----------------------------|
706 -- ----------------------------------------------------------------------------
707 -- {Start Of Comments}
708 --
709 -- Description:
710 --   This procedure is used to ensure a valid 'Delete Allowed' value.
711 --
712 -- Pre Conditions:
713 --   g_old_rec has been populated with details of the values currently in
714 --   the database.
715 --
716 -- In Arguments:
717 --   p_delete_allowed
721 --   p_object_version_number.
718 --   p_start_date
719 --   p_party_id
720 --   p_vacancy_id
722 --
723 -- Post Success:
724 --   Processing continues if a valid 'Delete Allowed' value is entered.
725 --
726 -- Post Failure:
727 --   An application error is raised if a valid 'Delete Allowed' value is not
728 --   entered.
729 --
730 -- {End Of Comments}
731 -- ----------------------------------------------------------------------------
732 Procedure chk_delete_allowed
733   (p_delete_allowed  in irc_rec_team_members.delete_allowed%type
734   ,p_start_date in irc_rec_team_members.start_date%type
735   ,p_rec_team_member_id in irc_rec_team_members.rec_team_member_id%type
736   ,p_object_version_number in irc_rec_team_members.object_version_number%type
737   ) IS
738 --
739   l_proc     varchar2(72) := g_package || 'chk_delete_allowed';
740   l_var      boolean;
741   l_api_updating boolean;
742 --
743 Begin
744 --
745   hr_utility.set_location(' Entering:'||l_proc,10);
746   if (p_delete_allowed is not NULL) then
747   --
748     l_api_updating := irc_rtm_shd.api_updating(p_rec_team_member_id,p_object_version_number);
749     --
750     --  Check to see if the delete_allowed value has changed.
751     --
752     hr_utility.set_location(l_proc, 30);
753     if ((l_api_updating
754       and (irc_rtm_shd.g_old_rec.delete_allowed <> p_delete_allowed))
755       or (NOT l_api_updating)) then
756       --
757       -- Check that a valid 'Delete Allowed' value is entered.
758       --
759       l_var := hr_api.not_exists_in_hr_lookups
760                (p_start_date
761                ,'YES_NO'
762                ,p_delete_allowed
763                );
764       hr_utility.set_location(l_proc, 40);
765       if (l_var = true) then
766         fnd_message.set_name('PER','IRC_412040_RTM_INV_DEL_ALLOWED');
767         fnd_message.raise_error;
768       end if;
769     end if;
770   end if;
771   hr_utility.set_location(' Leaving:'||l_proc,45);
772   --
773   exception
774     when app_exception.application_exception then
775       if hr_multi_message.exception_add
776                    (p_associated_column1      => 'IRC_REC_TEAM_MEMBERS.DELETE_ALLOWED'
777                    ) then
778                 hr_utility.set_location(' Leaving:'||l_proc, 50);
779                 raise;
780       end if;
781   hr_utility.set_location(' Leaving:'||l_proc,60);
782 --
783 End chk_delete_allowed;
784 --
785 -- ----------------------------------------------------------------------------
786 -- |---------------------------< chk_rec_team_member >-------------------------|
787 -- ----------------------------------------------------------------------------
788 --
789 -- Description:
790 --   Validates if the person is already a recruting team member for this
791 --   Vacancy.
792 --
793 -- Prerequisites:
794 --   Must be called after the chk_person_id and chk_vacancy_id.
795 --
796 -- In Arguments:
797 --   p_person_id
798 --   p_vacancy_id
799 --
800 -- Post Success:
801 --   If the person_id ,vacancy_id is not existing in IRC_REC_TEAM_MEMBERS
802 --   then continue.
803 --
804 -- Post Failure:
805 --   If the person_id, vacancy_id is present in IRC_REC_TEAM_MEMBERS
806 --   then throw an error indicating the same.
807 --
808 -- Access Status:
809 --   Internal Row Handler Use Only.
810 --
811 -- ----------------------------------------------------------------------------
812 Procedure chk_rec_team_member
813   (p_person_id  in irc_rec_team_members.person_id%type
814   ,p_vacancy_id in irc_rec_team_members.vacancy_id%type
815   ) is
816 --
817   l_proc  varchar2(72) := g_package||'chk_rec_team_member';
818   l_var varchar2(1);
819 --
820   cursor csr_rec_team_member is
821     select null
822       from irc_rec_team_members
823      where person_id = p_person_id
824        and vacancy_id = p_vacancy_id;
825 --
826 Begin
827   --
828   hr_utility.set_location(' Entering:'||l_proc,10);
829   --
830 
831   if hr_multi_message.no_exclusive_error
832         (p_check_column1      => 'IRC_REC_TEAM_MEMBERS.PERSON_ID'
833         ,p_check_column2      => 'IRC_REC_TEAM_MEMBERS.VACANCY_ID'
834         ) then
835     open csr_rec_team_member;
836     fetch csr_rec_team_member into l_var;
837     hr_utility.set_location(l_proc, 20);
838     if csr_rec_team_member%found then
839       close csr_rec_team_member;
840       hr_utility.set_location(l_proc, 30);
841       fnd_message.set_name('PER','IRC_412120_DUP_REC_TEAM_MEMBER');
842       fnd_message.raise_error;
843     end if;
844     close csr_rec_team_member;
845   end if;
846   --
847   hr_utility.set_location(' Leaving:'||l_proc,40);
848   --
849 exception
850   when app_exception.application_exception then
851     if hr_multi_message.exception_add
852       (p_associated_column1  =>  'IRC_REC_TEAM_MEMBERS.PERSON_ID'
853       ,p_associated_column2  =>  'IRC_REC_TEAM_MEMBERS.VACANCY_ID'
854       ) then
855       --
856       hr_utility.set_location(' Leaving:'||l_proc,50);
857       --
858       raise;
859     end if;
860     --
864 --
861     hr_utility.set_location(' Leaving:'||l_proc,60);
862     --
863 End chk_rec_team_member;
865 --
866 -- ----------------------------------------------------------------------------
867 -- |---------------------------< insert_validate >----------------------------|
868 -- ----------------------------------------------------------------------------
869 Procedure insert_validate
870   (p_rec                          in out nocopy irc_rtm_shd.g_rec_type
871   ) is
872 --
873   l_proc  varchar2(72) := g_package||'insert_validate';
874 --
875 Begin
876   hr_utility.set_location('Entering:'||l_proc, 5);
877   --
878   -- Call all supporting business operations
879   --
880   -- Validate Dependent Attributes
881   hr_utility.set_location(l_proc, 10);
882   --
883   chk_person_id
884   (p_person_id =>p_rec.person_id
885   ,p_party_id => p_rec.party_id
886   ,p_effective_date=>p_rec.start_date
887   );
888   --
889   hr_utility.set_location(l_proc, 20);
890   chk_vacancy_id
891   (p_vacancy_id => p_rec.vacancy_id
892   ,p_start_date => p_rec.start_date
893   );
894   --
895   hr_utility.set_location(l_proc, 30);
896   chk_rec_team_member
897     (p_person_id =>p_rec.person_id
898     ,p_vacancy_id => p_rec.vacancy_id
899   );
900   --
901   hr_utility.set_location(l_proc, 40);
902   chk_job_id
903   (p_job_id => p_rec.job_id
904   ,p_rec_team_member_id => p_rec.rec_team_member_id
905   ,p_vacancy_id => p_rec.vacancy_id
906   ,p_object_version_number => p_rec.object_version_number
907   ,p_start_date => p_rec.start_date
908   );
909   --
910   hr_utility.set_location(l_proc, 50);
911   chk_job_id_job_group_id
912   (p_rec_team_member_id => p_rec.rec_team_member_id
913   ,p_job_id => p_rec.job_id
914   ,p_object_version_number => p_rec.object_version_number
915   );
916   --
917   hr_utility.set_location(l_proc, 60);
918   chk_team_dates
919   (p_start_date => p_rec.start_date
920   ,p_end_date => p_rec.end_date
921   ,p_rec_team_member_id => p_rec.rec_team_member_id
922   ,p_object_version_number => p_rec.object_version_number
923   );
924   --
925   hr_utility.set_location(l_proc, 70);
926   chk_update_allowed
927   (p_update_allowed => p_rec.update_allowed
928   ,p_start_date => p_rec.start_date
929   ,p_rec_team_member_id => p_rec.rec_team_member_id
930   ,p_object_version_number => p_rec.object_version_number
931   );
932   --
933   hr_utility.set_location(l_proc, 80);
934   chk_delete_allowed
935   (p_delete_allowed => p_rec.delete_allowed
936   ,p_start_date => p_rec.start_date
937   ,p_rec_team_member_id => p_rec.rec_team_member_id
938   ,p_object_version_number => p_rec.object_version_number
939   );
940   --
941   hr_utility.set_location(' Leaving:'||l_proc, 100);
942 End insert_validate;
943 --
944 -- ----------------------------------------------------------------------------
945 -- |---------------------------< update_validate >----------------------------|
946 -- ----------------------------------------------------------------------------
947 Procedure update_validate
948   (p_rec                          in out nocopy irc_rtm_shd.g_rec_type
949   ) is
950 --
951   l_proc  varchar2(72) := g_package||'update_validate';
952 --
953 Begin
954   hr_utility.set_location('Entering:'||l_proc, 5);
955   --
956   -- Call all supporting business operations
957   --
958   -- Validate Dependent Attributes
959   hr_utility.set_location(l_proc, 10);
960   --
961   chk_person_id
962   (p_person_id =>p_rec.person_id
963   ,p_party_id => p_rec.party_id
964   ,p_effective_date=>p_rec.start_date
965   );
966   --
967   hr_utility.set_location(l_proc, 15);
968   chk_job_id
969   (p_job_id => p_rec.job_id
970   ,p_rec_team_member_id => p_rec.rec_team_member_id
971   ,p_vacancy_id => p_rec.vacancy_id
972   ,p_object_version_number => p_rec.object_version_number
973   ,p_start_date => p_rec.start_date
974   );
975   --
976   hr_utility.set_location(l_proc, 20);
977   chk_job_id_job_group_id
978   (p_rec_team_member_id => p_rec.rec_team_member_id
979   ,p_job_id => p_rec.job_id
980   ,p_object_version_number => p_rec.object_version_number
981   );
982   --
983   hr_utility.set_location(l_proc, 30);
984   chk_team_dates
985   (p_start_date => p_rec.start_date
986   ,p_end_date => p_rec.end_date
987   ,p_rec_team_member_id => p_rec.rec_team_member_id
988   ,p_object_version_number => p_rec.object_version_number
989   );
990   --
991   hr_utility.set_location(l_proc, 40);
992   chk_update_allowed
993   (p_update_allowed => p_rec.update_allowed
994   ,p_start_date => p_rec.start_date
995   ,p_rec_team_member_id => p_rec.rec_team_member_id
996   ,p_object_version_number => p_rec.object_version_number
997   );
998   --
999   hr_utility.set_location(l_proc, 50);
1000   chk_delete_allowed
1001   (p_delete_allowed => p_rec.delete_allowed
1002   ,p_start_date => p_rec.start_date
1003   ,p_rec_team_member_id => p_rec.rec_team_member_id
1004   ,p_object_version_number => p_rec.object_version_number
1005   );
1006   --
1007   --
1008   hr_utility.set_location(l_proc, 70);
1009   chk_non_updateable_args
1010     (p_rec              => p_rec
1011     );
1012   --
1013   --
1014   hr_utility.set_location(' Leaving:'||l_proc, 80);
1015 End update_validate;
1016 --
1017 -- ----------------------------------------------------------------------------
1018 -- |---------------------------< delete_validate >----------------------------|
1019 -- ----------------------------------------------------------------------------
1020 Procedure delete_validate
1021   (p_rec                          in irc_rtm_shd.g_rec_type
1022   ) is
1023 --
1024   l_proc  varchar2(72) := g_package||'delete_validate';
1025 --
1026 Begin
1027   hr_utility.set_location('Entering:'||l_proc, 5);
1028   --
1029   -- Call all supporting business operations
1030   --
1031   hr_utility.set_location(' Leaving:'||l_proc, 10);
1032 End delete_validate;
1033 --
1034 end irc_rtm_bus;