DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IRF_BUS

Source


1 Package Body irc_irf_bus as
2 /* $Header: irirfrhi.pkb 120.1 2008/04/16 07:34:32 vmummidi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_irf_bus.';  -- Global package name
9 --
10 --  ---------------------------------------------------------------------------
11 --  |----------------------<     chk_delete        >--------------------------|
12 --  ---------------------------------------------------------------------------
13 --
14 --  {sTARt Of Comments}
15 --
16 -- Description:
17 --   check that 1. No attribute Usages exist
18 --              2. Attribute is not an existing Mandatory or Required attribute
19 --
20 -- Prerequisites:
21 --   None.
22 --
23 -- In Parameters:
24 --   p_referral_info_id
25 --   p_object_version_number
26 --   p_effective_date
27 --
28 -- Post Success:
29 --   Processing continues.
30 --
31 -- Post Failure:
32 --   Log the error message.
33 --
34 -- Developer Implementation Notes:
35 --   None.
36 --
37 -- Access Status:
38 --   Internal Row Handler Use Only.
39 --
40 -- {End Of Comments}
41 -- ----------------------------------------------------------------------------
42 procedure chk_delete
43   (p_referral_info_id      in number,
44    p_object_version_number in number,
45    p_effective_date        in date) is
46   l_proc              varchar2(72)  :=  g_package||'chk_delete';
47 begin
48    null;
49 exception
50    when app_exception.application_exception then
51      if hr_multi_message.exception_add
52        (p_associated_column1 => 'ATTRIBUTE_ID') then
53        hr_utility.set_location(' Leaving:'|| l_proc, 50);
54        raise;
55      end if;
56      hr_utility.set_location(' Leaving:'|| l_proc, 60);
57 end chk_delete;
58 --
59 -- ----------------------------------------------------------------------------
60 -- |------------------------------< chk_ddf >----------------------------------|
61 -- ----------------------------------------------------------------------------
62 --
63 -- Description:
64 --   Validates all the Descriptive Flexfield values.
65 --
66 -- Prerequisites:
67 --   All other columns have been validated.  Must be called as the
68 --   last step from insert_validate and update_validate.
69 --
70 -- In Arguments:
71 --   p_rec
72 --
73 -- Post Success:
74 --   If the Descriptive Flexfield structure column and data values are
75 --   all valid this procedure will end normally and processing will
76 --   continue.
77 --
78 -- Post Failure:
79 --   If the Descriptive Flexfield structure column value or any of
80 --   the data values are invalid then an application error is raised as
81 --   a PL/SQL exception.
82 --
83 -- Access Status:
84 --   Internal Row Handler Use Only.
85 --
86 -- ----------------------------------------------------------------------------
87 procedure chk_ddf
88   (p_rec in irc_irf_shd.g_rec_type
89   ) is
90 --
91   l_proc   varchar2(72) := g_package || 'chk_ddf';
92 --
93 begin
94   hr_utility.set_location('Entering:'||l_proc,10);
95   --
96   if ((p_rec.referral_info_id is not null)  and (
97     nvl(irc_irf_shd.g_old_rec.irf_information_category, hr_api.g_varchar2) <>
98     nvl(p_rec.irf_information_category, hr_api.g_varchar2)  or
99     nvl(irc_irf_shd.g_old_rec.irf_information1, hr_api.g_varchar2) <>
100     nvl(p_rec.irf_information1, hr_api.g_varchar2)  or
101     nvl(irc_irf_shd.g_old_rec.irf_information2, hr_api.g_varchar2) <>
102     nvl(p_rec.irf_information2, hr_api.g_varchar2)  or
103     nvl(irc_irf_shd.g_old_rec.irf_information3, hr_api.g_varchar2) <>
104     nvl(p_rec.irf_information3, hr_api.g_varchar2)  or
105     nvl(irc_irf_shd.g_old_rec.irf_information4, hr_api.g_varchar2) <>
106     nvl(p_rec.irf_information4, hr_api.g_varchar2)  or
107     nvl(irc_irf_shd.g_old_rec.irf_information5, hr_api.g_varchar2) <>
108     nvl(p_rec.irf_information5, hr_api.g_varchar2)  or
109     nvl(irc_irf_shd.g_old_rec.irf_information6, hr_api.g_varchar2) <>
110     nvl(p_rec.irf_information6, hr_api.g_varchar2)  or
111     nvl(irc_irf_shd.g_old_rec.irf_information7, hr_api.g_varchar2) <>
112     nvl(p_rec.irf_information7, hr_api.g_varchar2)  or
113     nvl(irc_irf_shd.g_old_rec.irf_information8, hr_api.g_varchar2) <>
114     nvl(p_rec.irf_information8, hr_api.g_varchar2)  or
115     nvl(irc_irf_shd.g_old_rec.irf_information9, hr_api.g_varchar2) <>
116     nvl(p_rec.irf_information9, hr_api.g_varchar2)  or
117     nvl(irc_irf_shd.g_old_rec.irf_information10, hr_api.g_varchar2) <>
118     nvl(p_rec.irf_information10, hr_api.g_varchar2) ))
119     or (p_rec.referral_info_id is null)  then
120     --
121     -- Only execute the validation if absolutely necessary:
122     -- a) During update, the structure column value or any
123     --    of the irf_information values have actually changed.
124     -- b) During insert.
125     --
126     hr_dflex_utility.ins_or_upd_descflex_attribs
127       (p_appl_short_name           => 'PER'
128       ,p_descflex_name             => 'PER_EVENTS'
129       ,p_attribute_category        => p_rec.irf_information_category
130       ,p_attribute1_name           => 'IRF_INFORMATION1'
131       ,p_attribute1_value          => p_rec.irf_information1
132       ,p_attribute2_name           => 'IRF_INFORMATION2'
133       ,p_attribute2_value          => p_rec.irf_information2
134       ,p_attribute3_name           => 'IRF_INFORMATION3'
135       ,p_attribute3_value          => p_rec.irf_information3
136       ,p_attribute4_name           => 'IRF_INFORMATION4'
137       ,p_attribute4_value          => p_rec.irf_information4
138       ,p_attribute5_name           => 'IRF_INFORMATION5'
139       ,p_attribute5_value          => p_rec.irf_information5
140       ,p_attribute6_name           => 'IRF_INFORMATION6'
141       ,p_attribute6_value          => p_rec.irf_information6
142       ,p_attribute7_name           => 'IRF_INFORMATION7'
143       ,p_attribute7_value          => p_rec.irf_information7
144       ,p_attribute8_name           => 'IRF_INFORMATION8'
145       ,p_attribute8_value          => p_rec.irf_information8
146       ,p_attribute9_name           => 'IRF_INFORMATION9'
147       ,p_attribute9_value          => p_rec.irf_information9
148       ,p_attribute10_name          => 'IRF_INFORMATION10'
149       ,p_attribute10_value         => p_rec.irf_information10
150       );
151   end if;
152   --
153   hr_utility.set_location(' Leaving:'||l_proc,20);
154 end chk_ddf;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< chk_df >----------------------------------|
158 -- ----------------------------------------------------------------------------
159 --
160 -- Description:
161 --   Validates all the Descriptive Flexfield values.
162 --
163 -- Prerequisites:
164 --   All other columns have been validated.  Must be called as the
165 --   last step from insert_validate and update_validate.
166 --
167 -- In Arguments:
168 --   p_rec
169 --
170 -- Post Success:
171 --   If the Descriptive Flexfield structure column and data values are
172 --   all valid this procedure will end normally and processing will
173 --   continue.
174 --
175 -- Post Failure:
176 --   If the Descriptive Flexfield structure column value or any of
177 --   the data values are invalid then an application error is raised as
178 --   a PL/SQL exception.
179 --
180 -- Access Status:
181 --   Internal Row Handler Use Only.
182 --
183 -- ----------------------------------------------------------------------------
184 procedure chk_df
185   (p_rec in irc_irf_shd.g_rec_type
186   ) is
187 --
188   l_proc   varchar2(72) := g_package || 'chk_df';
189 --
190 begin
191   hr_utility.set_location('Entering:'||l_proc,10);
192   --
193   if ((p_rec.referral_info_id is not null)  and (
194     nvl(irc_irf_shd.g_old_rec.irf_attribute_category, hr_api.g_varchar2) <>
195     nvl(p_rec.irf_attribute_category, hr_api.g_varchar2)  or
196     nvl(irc_irf_shd.g_old_rec.irf_attribute1, hr_api.g_varchar2) <>
197     nvl(p_rec.irf_attribute1, hr_api.g_varchar2)  or
198     nvl(irc_irf_shd.g_old_rec.irf_attribute2, hr_api.g_varchar2) <>
199     nvl(p_rec.irf_attribute2, hr_api.g_varchar2)  or
200     nvl(irc_irf_shd.g_old_rec.irf_attribute3, hr_api.g_varchar2) <>
201     nvl(p_rec.irf_attribute3, hr_api.g_varchar2)  or
202     nvl(irc_irf_shd.g_old_rec.irf_attribute4, hr_api.g_varchar2) <>
203     nvl(p_rec.irf_attribute4, hr_api.g_varchar2)  or
204     nvl(irc_irf_shd.g_old_rec.irf_attribute5, hr_api.g_varchar2) <>
205     nvl(p_rec.irf_attribute5, hr_api.g_varchar2)  or
206     nvl(irc_irf_shd.g_old_rec.irf_attribute6, hr_api.g_varchar2) <>
207     nvl(p_rec.irf_attribute6, hr_api.g_varchar2)  or
208     nvl(irc_irf_shd.g_old_rec.irf_attribute7, hr_api.g_varchar2) <>
209     nvl(p_rec.irf_attribute7, hr_api.g_varchar2)  or
210     nvl(irc_irf_shd.g_old_rec.irf_attribute8, hr_api.g_varchar2) <>
211     nvl(p_rec.irf_attribute8, hr_api.g_varchar2)  or
212     nvl(irc_irf_shd.g_old_rec.irf_attribute9, hr_api.g_varchar2) <>
213     nvl(p_rec.irf_attribute9, hr_api.g_varchar2)  or
214     nvl(irc_irf_shd.g_old_rec.irf_attribute10, hr_api.g_varchar2) <>
215     nvl(p_rec.irf_attribute10, hr_api.g_varchar2) ))
216     or (p_rec.referral_info_id is null)  then
217     --
218     -- Only execute the validation if absolutely necessary:
219     -- a) During update, the structure column value or any
220     --    of the irf_attribute values have actually changed.
221     -- b) During insert.
222     --
223     hr_dflex_utility.ins_or_upd_descflex_attribs
224       (p_appl_short_name                 => 'PER'
225       ,p_descflex_name                   => 'PER_EVENTS'
226       ,p_attribute_category              => p_rec.irf_attribute_category
227       ,p_attribute1_name                 => 'IRF_ATTRIBUTE1'
228       ,p_attribute1_value                => p_rec.irf_attribute1
229       ,p_attribute2_name                 => 'IRF_ATTRIBUTE2'
230       ,p_attribute2_value                => p_rec.irf_attribute2
231       ,p_attribute3_name                 => 'IRF_ATTRIBUTE3'
232       ,p_attribute3_value                => p_rec.irf_attribute3
233       ,p_attribute4_name                 => 'IRF_ATTRIBUTE4'
234       ,p_attribute4_value                => p_rec.irf_attribute4
235       ,p_attribute5_name                 => 'IRF_ATTRIBUTE5'
236       ,p_attribute5_value                => p_rec.irf_attribute5
237       ,p_attribute6_name                 => 'IRF_ATTRIBUTE6'
238       ,p_attribute6_value                => p_rec.irf_attribute6
239       ,p_attribute7_name                 => 'IRF_ATTRIBUTE7'
240       ,p_attribute7_value                => p_rec.irf_attribute7
241       ,p_attribute8_name                 => 'IRF_ATTRIBUTE8'
242       ,p_attribute8_value                => p_rec.irf_attribute8
243       ,p_attribute9_name                 => 'IRF_ATTRIBUTE9'
244       ,p_attribute9_value                => p_rec.irf_attribute9
245       ,p_attribute10_name                => 'IRF_ATTRIBUTE10'
246       ,p_attribute10_value               => p_rec.irf_attribute10
247       );
248   end if;
249   --
250   hr_utility.set_location(' Leaving:'||l_proc,20);
251 end chk_df;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |-----------------------< chk_non_updateable_args >------------------------|
255 -- ----------------------------------------------------------------------------
256 -- {Start Of Comments}
257 --
258 -- Description:
259 --   This procedure is used to ensure that non updateable attributes have
260 --   not been updated. If an attribute has been updated an error is generated.
261 --
262 -- Pre Conditions:
263 --   g_old_rec has been populated with details of the values currently in
264 --   the database.
265 --
266 -- In Arguments:
267 --   p_rec has been populated with the updated values the user would like the
268 --   record set to.
269 --
270 -- Post Success:
271 --   Processing continues if all the non updateable attributes have not
272 --   changed.
273 --
274 -- Post Failure:
275 --   An application error is raised if any of the non updatable attributes
276 --   have been altered.
277 --
278 -- {End Of Comments}
279 -- ----------------------------------------------------------------------------
280 Procedure chk_non_updateable_args
281   (p_effective_date               in date
282   ,p_rec in irc_irf_shd.g_rec_type
283   ) IS
284 --
285   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
286 --
287 Begin
288   --
289   hr_utility.set_location(' Leaving:'||l_proc,10);
290   --
291   -- Only proceed with the validation if a row exists for the current
292   -- record in the HR Schema.
293   --
294   IF NOT irc_irf_shd.api_updating
295       (p_effective_date                    => p_effective_date
296       ,p_referral_info_id                  => p_rec.referral_info_id
297       ,p_object_version_number             => p_rec.object_version_number
298       ) THEN
299      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
300      fnd_message.set_token('PROCEDURE ', l_proc);
301      fnd_message.set_token('STEP ', '5');
302      fnd_message.raise_error;
303   END IF;
304   --
305   --   Add checks to ensure non-updateable args have
306   --   not been updated.
307   --
308   if p_rec.object_id <> irc_irf_shd.g_old_rec.object_id  then
309       hr_api.argument_changed_error
310       ( p_api_name     => l_proc
311        ,p_argument     => 'OBJECT_ID'
312        ,p_base_table   => irc_irf_shd.g_tab_name
313       );
314   end if;
315   --
316   if p_rec.object_type <> irc_irf_shd.g_old_rec.object_type  then
317 	 hr_api.argument_changed_error
318       ( p_api_name     => l_proc
319        ,p_argument     => 'OBJECT_TYPE'
320        ,p_base_table   => irc_irf_shd.g_tab_name
321       );
322   end if;
323   --
324   if p_rec.object_created_by <> irc_irf_shd.g_old_rec.object_created_by  then
325 	 hr_api.argument_changed_error
326       ( p_api_name     => l_proc
327        ,p_argument     => 'OBJECT_CREATED_BY'
328        ,p_base_table   => irc_irf_shd.g_tab_name
329       );
330   end if;
331   --
335 -- ----------------------------------------------------------------------------
332   hr_utility.set_location(' Leaving:'||l_proc,20);
333 End chk_non_updateable_args;
334 --
336 -- |--------------------------< dt_update_validate >--------------------------|
337 -- ----------------------------------------------------------------------------
338 -- {Start Of Comments}
339 --
340 -- Description:
341 --   This procedure is used for referential integrity of datetracked
342 --   parent entities when a datetrack update operation is taking place
343 --   and where there is no cascading of update defined for this entity.
344 --
345 -- Prerequisites:
346 --   This procedure is called from the update_validate.
347 --
348 -- In Parameters:
349 --
350 -- Post Success:
351 --   Processing continues.
352 --
353 -- Post Failure:
354 --
355 -- Developer Implementation Notes:
356 --   This procedure should not need maintenance unless the HR Schema model
357 --   changes.
358 --
359 -- Access Status:
360 --   Internal Row Handler Use Only.
361 --
362 -- {End Of Comments}
363 -- ----------------------------------------------------------------------------
364 Procedure dt_update_validate
365   (p_datetrack_mode                in varchar2
366   ,p_validation_start_date         in date
367   ,p_validation_end_date           in date
368   ) Is
369 --
370   l_proc  varchar2(72) := g_package||'dt_update_validate';
371 --
372 Begin
373   --
374   -- Ensure that the p_datetrack_mode argument is not null
375   --
376   hr_api.mandatory_arg_error
377     (p_api_name       => l_proc
378     ,p_argument       => 'datetrack_mode'
379     ,p_argument_value => p_datetrack_mode
380     );
381   --
382   -- Mode will be valid, as this is checked at the start of the upd.
383   --
384   -- Ensure the arguments are not null
385   --
386   hr_api.mandatory_arg_error
387     (p_api_name       => l_proc
388     ,p_argument       => 'validation_start_date'
389     ,p_argument_value => p_validation_start_date
390     );
391   --
392   /*hr_api.mandatory_arg_error
393     (p_api_name       => l_proc
394     ,p_argument       => 'validation_end_date'
395     ,p_argument_value => p_validation_end_date
396     );*/
397   --
398 Exception
399   When Others Then
400     --
401     -- An unhandled or unexpected error has occurred which
402     -- we must report
403     --
404     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
405     fnd_message.set_token('PROCEDURE', l_proc);
406     fnd_message.set_token('STEP','15');
407     fnd_message.raise_error;
408 End dt_update_validate;
409 --
410 -- ----------------------------------------------------------------------------
411 -- |--------------------------< dt_delete_validate >--------------------------|
412 -- ----------------------------------------------------------------------------
413 -- {Start Of Comments}
414 --
415 -- Description:
416 --   This procedure is used for referential integrity of datetracked
417 --   child entities when either a datetrack DELETE or ZAP is in operation
418 --   and where there is no cascading of delete defined for this entity.
419 --   For the datetrack mode of DELETE or ZAP we must ensure that no
420 --   datetracked child rows exist between the validation start and end
421 --   dates.
422 --
423 -- Prerequisites:
424 --   This procedure is called from the delete_validate.
425 --
426 -- In Parameters:
427 --
428 -- Post Success:
429 --   Processing continues.
430 --
431 -- Post Failure:
432 --   If a row exists by determining the returning Boolean value from the
433 --   generic dt_api.rows_exist function then we must supply an error via
434 --   the use of the local exception handler l_rows_exist.
435 --
436 -- Developer Implementation Notes:
437 --   This procedure should not need maintenance unless the HR Schema model
438 --   changes.
439 --
440 -- Access Status:
441 --   Internal Row Handler Use Only.
442 --
443 -- {End Of Comments}
444 -- ----------------------------------------------------------------------------
445 Procedure dt_delete_validate
446   (p_referral_info_id                     in number
447   ,p_datetrack_mode                   in varchar2
448   ,p_validation_start_date            in date
449   ,p_validation_end_date              in date
450   ) Is
451 --
452   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
453 --
454 Begin
455   --
456   -- Ensure that the p_datetrack_mode argument is not null
457   --
458   hr_api.mandatory_arg_error
459     (p_api_name       => l_proc
460     ,p_argument       => 'datetrack_mode'
461     ,p_argument_value => p_datetrack_mode
462     );
463   --
464   -- Only perform the validation if the datetrack mode is either
465   -- DELETE or ZAP
466   --
467   If (p_datetrack_mode = hr_api.g_delete or
468       p_datetrack_mode = hr_api.g_zap) then
469     --
470     --
471     -- Ensure the arguments are not null
472     --
473     hr_api.mandatory_arg_error
474       (p_api_name       => l_proc
475       ,p_argument       => 'validation_start_date'
476       ,p_argument_value => p_validation_start_date
477       );
478     --
479     /*hr_api.mandatory_arg_error
480       (p_api_name       => l_proc
481       ,p_argument       => 'validation_end_date'
482       ,p_argument_value => p_validation_end_date
483       );*/
484     --
485     hr_api.mandatory_arg_error
486       (p_api_name       => l_proc
487       ,p_argument       => 'referral_info_id'
488       ,p_argument_value => p_referral_info_id
489       );
490     --
494   --
491 --
492     --
493   End If;
495 Exception
496   When Others Then
497     --
498     -- An unhandled or unexpected error has occurred which
499     -- we must report
500     --
501     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
502     fnd_message.set_token('PROCEDURE', l_proc);
503     fnd_message.set_token('STEP','15');
504     fnd_message.raise_error;
505   --
506 End dt_delete_validate;
507 --
508 --
509 -- ----------------------------------------------------------------------------
510 -- |---------------------------< chk_source_criteria >-----------------------|
511 -- ----------------------------------------------------------------------------
512 Procedure chk_source_criteria
513   (p_source_criteria       in   irc_referral_info.source_criteria1%TYPE
514   ,p_source_criteria_index in   number
515   ,p_effective_date        in   date
516   ) is
517 --
518   l_proc        varchar2(72)  := g_package||'chk_source_criteria';
519   l_not_exists  boolean;
520 Begin
521   hr_utility.set_location('Entering:'||l_proc, 5);
522   --
523   if p_source_criteria is not null then
524     l_not_exists := hr_api.not_exists_in_hr_lookups
525                     (p_effective_date
526                     ,'IRC_REFERRAL_CRITERIA'
527                     ,p_source_criteria
528                     );
529     hr_utility.set_location(l_proc, 10);
530       if (l_not_exists = true) then
531         -- RAISE ERROR SAYING THAT THE SOURCE CRITERIA IS INVALID
532         fnd_message.set_name('PER','IRC_412529_INV_SRC_CRITERIA');
533         fnd_message.set_token('CRIT_NUM',p_source_criteria_index);
534         fnd_message.raise_error;
535       end if;
536   end if;
537   hr_utility.set_location('leaving:'||l_proc, 15);
538 end chk_source_criteria;
539 --
540 --
541 -- ----------------------------------------------------------------------------
542 -- |---------------------------< chk_source_type >-----------------------|
543 -- ----------------------------------------------------------------------------
544 Procedure chk_source_type
545   (p_source_type       in   irc_referral_info.source_type%TYPE
546   ,p_effective_date        in   date
547   ) is
548 --
549   l_proc        varchar2(72)  := g_package||'chk_source_type';
550   l_not_exists  boolean;
551 Begin
552   hr_utility.set_location('Entering:'||l_proc, 5);
553   --
554   if p_source_type is not null then
555     l_not_exists := hr_api.not_exists_in_hr_lookups
556                     (p_effective_date
557                     ,'REC_TYPE'
558                     ,p_source_type
559                     );
560     hr_utility.set_location(l_proc, 10);
561       if (l_not_exists = true) then
562         -- RAISE ERROR SAYING THAT THE SOURCE CRITERIA IS INVALID
563         fnd_message.set_name('PER','HR_51162_ASG_INV_SOURCE_TYPE');
564         fnd_message.raise_error;
565       end if;
566   end if;
567   hr_utility.set_location('leaving:'||l_proc, 15);
568 end chk_source_type;
569 --
570 --
571 -- ----------------------------------------------------------------------------
572 -- |---------------------------< chk_object >----------------------------|
573 -- ----------------------------------------------------------------------------
574 Procedure chk_object
575   (p_rec                   in   irc_irf_shd.g_rec_type
576   ,p_effective_date        in   date
577   ) is
578 --
579   l_proc        varchar2(72)  := g_package||'chk_object';
580   l_not_exists  boolean;
581 Begin
582   hr_utility.set_location('Entering:'||l_proc, 5);
583   --
584     -- Check for the Object Type first.
585     if (p_rec.object_type<>'PERSON' and  p_rec.object_type<>'APPLICATION') then
586       -- RAISE ERROR SAYING THAT THE OBJECT TYPE IS INVALID
587       fnd_message.set_name('PER','IRC_412527_INV_OBJ_TYPE');
588       fnd_message.raise_error;
589     end if;
590 	--
591 	hr_utility.set_location(l_proc, 10);
592 	--
593 	-- Check for the Object Id
594 	if p_rec.object_type='PERSON' then
595 		chk_party_id(p_party_id => p_rec.object_id,
596 					 p_effective_date => p_effective_date);
597 	else
598 		chk_assignment_id(p_assignment_id => p_rec.object_id,
599 					 p_effective_date => p_effective_date);
600 	end if;
601   hr_utility.set_location('leaving:'||l_proc, 15);
602 end chk_object;
603 --
604 --
605 -- ----------------------------------------------------------------------------
606 -- |---------------------------< chk_object_created_by >----------------------|
607 -- ----------------------------------------------------------------------------
608 Procedure chk_object_created_by
609   (p_rec                   in   irc_irf_shd.g_rec_type
610   ,p_effective_date        in   date
611   ) is
612 --
613   l_proc        varchar2(72)  := g_package||'chk_object_created_by';
614   l_not_exists  boolean;
615 Begin
616   hr_utility.set_location('Entering:'||l_proc, 5);
617   --
618     if (p_rec.object_created_by<>'EMP'
619 	    and p_rec.object_created_by<>'CAND'
620 	    and p_rec.object_created_by<>'MGR'
621 		and p_rec.object_created_by<>'AGENCY') then
622       -- RAISE ERROR SAYING THAT THE OBJECT CRATED BY IS INVALID
623       fnd_message.set_name('PER','IRC_412528_INV_OBJ_CREATED_BY');
624       fnd_message.raise_error;
625     end if;
626   hr_utility.set_location('leaving:'||l_proc, 10);
627 end chk_object_created_by;
628 --
629 -- ----------------------------------------------------------------------------
630 -- |-----------------------------< chk_person_id >----------------------------|
631 -- ----------------------------------------------------------------------------
632 -- {Start Of Comments}
633 --
634 -- Description:
638 -- Pre Conditions:
635 --   This procedure is used to ensure that object_id exists in PER_ALL_PEOPLE_F
636 --   as 'PERSON' type when the object_type is 'PERSON'
637 --
639 --
640 -- In Arguments:
641 --  p_person_id
642 --
643 -- Post Success:
644 --  Processing continues if object_id is valid.
645 --
646 -- Post Failure:
647 --   An application error is raised if object_id is invalid.
648 --
649 -- {End Of Comments}
650 -- ----------------------------------------------------------------------------
651 Procedure chk_person_id
652   (p_person_id in irc_referral_info.object_id%TYPE
653   ,p_effective_date in Date
654   ) IS
655 --
656   l_proc     varchar2(72) := g_package || 'chk_person_id';
657   l_person_id varchar2(1);
658 --
659   cursor csr_person_id is
660     select null
661     from per_all_people_f ppf
662     where ppf.person_id = p_person_id
663     and trunc(p_effective_date) between ppf.effective_start_date
664     and ppf.effective_end_date;
665 --
666 begin
670   fetch csr_person_id into l_person_id;
667   hr_utility.set_location('Entering:'||l_proc,10);
668 -- Check that Person_ID(Object_id) exists in per_all_people_f
669   open csr_person_id;
671   hr_utility.set_location(l_proc,20);
672   if csr_person_id%NOTFOUND then
673     close csr_person_id;
674     fnd_message.set_name('PER','IRC_412008_BAD_PARTY_PERSON_ID');
675     fnd_message.raise_error;
676   end if;
677   close csr_person_id;
678   hr_utility.set_location(' Leaving:'||l_proc,30);
679   exception
680    when app_exception.application_exception then
681     if hr_multi_message.exception_add
682        (p_associated_column1 =>
683        'IRC_REFERRAL_INFO.OBJECT_ID'
684        ) then
685       hr_utility.set_location(' Leaving:'||l_proc,40);
686       raise;
687     end if;
688   hr_utility.set_location(' Leaving:'||l_proc,50);
689 end chk_person_id;
690 --
691 -- ----------------------------------------------------------------------------
692 -- |-----------------------------< chk_party_id >----------------------------|
693 -- ----------------------------------------------------------------------------
694 -- {Start Of Comments}
695 --
696 -- Description:
697 --   This procedure is used to ensure that object_id exists in PER_ALL_PEOPLE_F
698 --   as 'PERSON' type when the object_type is 'PERSON'
699 --
700 -- Pre Conditions:
701 --
702 -- In Arguments:
703 --  p_person_id
704 --
705 -- Post Success:
706 --  Processing continues if object_id is valid.
707 --
708 -- Post Failure:
709 --   An application error is raised if object_id is invalid.
710 --
711 -- {End Of Comments}
712 -- ----------------------------------------------------------------------------
713 Procedure chk_party_id
714   (p_party_id in irc_referral_info.object_id%TYPE
715   ,p_effective_date in Date
716   ) IS
717 --
718   l_proc     varchar2(72) := g_package || 'chk_party_id';
719   l_party_id varchar2(1);
720 --
721   cursor csr_party_id is
722     select null
723     from per_all_people_f ppf
724     where ppf.party_id = p_party_id
725     and trunc(p_effective_date) between ppf.effective_start_date
726     and ppf.effective_end_date;
727 --
728 begin
729   hr_utility.set_location('Entering:'||l_proc,10);
730 -- Check that Party_ID(Object_id) exists in per_all_people_f
731   open csr_party_id;
732   fetch csr_party_id into l_party_id;
733   hr_utility.set_location(l_proc,20);
734   if csr_party_id%NOTFOUND then
735     close csr_party_id;
736     fnd_message.set_name('PER','IRC_412008_BAD_PARTY_PERSON_ID');
737     fnd_message.raise_error;
738   end if;
739   close csr_party_id;
740   hr_utility.set_location(' Leaving:'||l_proc,30);
741   exception
742    when app_exception.application_exception then
743     if hr_multi_message.exception_add
744        (p_associated_column1 =>
745        'IRC_REFERRAL_INFO.OBJECT_ID'
746        ) then
747       hr_utility.set_location(' Leaving:'||l_proc,40);
748       raise;
749     end if;
750   hr_utility.set_location(' Leaving:'||l_proc,50);
751 end chk_party_id;
752 --
753 -- ----------------------------------------------------------------------------
754 -- |---------------------------< chk_assignment_id >--------------------------|
755 -- ----------------------------------------------------------------------------
756 -- {Start Of Comments}
757 --
758 -- Description:
759 --   This procedure is used to ensure that assignment Id exists in table
760 --   per_all_assignments_f.
761 --
762 -- Pre Conditions:
763 --   assignment Id should exist in the table.
764 --
765 -- In Arguments:
766 --   p_assignment_id is passed by the user.
770 --
767 --
768 -- Post Success:
769 --   Processing continues if assignment Id exists.
771 -- Post Failure:
772 --   An error is raised if assignment Id does not exist.
773 --
774 -- {End Of Comments}
775 -- ----------------------------------------------------------------------------
776 Procedure chk_assignment_id
777   (p_assignment_id    in  irc_referral_info.object_id%type
778   ,p_effective_date in Date
779   ) is
780 --
781   l_proc     varchar2(72) := g_package || 'chk_assignment_id';
782   --
783   l_assignment_id irc_referral_info.object_id%type ;
784   --
785   cursor csr_applicant_assignment is
786   select 1
787   from per_all_assignments_f
788   where assignment_id = p_assignment_id
789   and assignment_type = 'A'
790   and trunc(p_effective_date) between effective_start_date
791   and effective_end_date;
792 --
793 begin
794   --
795   hr_utility.set_location('Entering:'|| l_proc, 10);
796   --
797   open csr_applicant_assignment;
798   fetch csr_applicant_assignment Into l_assignment_id;
799   --
800   hr_utility.set_location(l_proc,20);
801   --
802   if csr_applicant_assignment%notfound then
803     close csr_applicant_assignment;
804     fnd_message.set_name ('PER', 'IRC_412006_ASG_NOT_APPL');
805     fnd_message.raise_error;
806   end if;
807   --
808   close csr_applicant_assignment;
809   --
810   hr_utility.set_location(' Leaving:'|| l_proc, 30);
811   --
812   exception
813   when app_exception.application_exception then
814     if hr_multi_message.exception_add
815          (p_associated_column1  => 'IRC_ASSIGNMENT_STATUSES.ASSIGNMENT_ID'
816          ) then
817       hr_utility.set_location(' Leaving:'|| l_proc, 40);
818       raise;
819     end if;
820     hr_utility.set_location(' Leaving:'|| l_proc, 50);
821   --
822 end chk_assignment_id;
823 --
824 -- ----------------------------------------------------------------------------
825 -- |---------------------------< insert_validate >----------------------------|
826 -- ----------------------------------------------------------------------------
827 Procedure insert_validate
828   (p_rec                   in irc_irf_shd.g_rec_type
829   ,p_effective_date        in date
830   ,p_datetrack_mode        in varchar2
831   ,p_validation_start_date in date
832   ,p_validation_end_date   in date
833   ) is
834 --
835   l_proc                  varchar2(72) := g_package||'insert_validate';
836 --
837 Begin
838   --
839   hr_utility.set_location('Entering:'||l_proc, 5);
840   --
841   irc_irf_bus.chk_object(p_rec             => p_rec
842                               ,p_effective_date  => p_effective_date
843                               );
844   --
845   hr_utility.set_location(l_proc, 15);
846   --
847   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria1
848 						,p_source_criteria_index => 1
852   --
849                         ,p_effective_date => p_effective_date);
850   --
851   hr_utility.set_location(l_proc, 20);
853   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria2
854                         ,p_source_criteria_index => 2
855 						,p_effective_date => p_effective_date);
856   --
857   hr_utility.set_location(l_proc, 25);
858   --
859   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria3
860                         ,p_source_criteria_index => 3
861 						,p_effective_date => p_effective_date);
862   --
863   hr_utility.set_location(l_proc, 30);
864   --
865   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria4
866                         ,p_source_criteria_index => 4
867 						,p_effective_date => p_effective_date);
868   --
869   hr_utility.set_location(l_proc, 35);
870   --
871   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria5
872                         ,p_source_criteria_index => 5
873 						,p_effective_date => p_effective_date);
874   --
875   hr_utility.set_location(l_proc, 40);
876   --
877   irc_irf_bus.chk_source_type(p_source_type  => p_rec.source_type
878                         ,p_effective_date => p_effective_date);
879   --
880   hr_utility.set_location(l_proc, 45);
881   --
882   irc_irf_bus.chk_object_created_by(p_rec             => p_rec
883                         ,p_effective_date => p_effective_date);
884   --
885   hr_utility.set_location(l_proc, 50);
886   --
887   if p_rec.source_person_id is not null then
888   irc_irf_bus.chk_person_id(p_person_id  => p_rec.source_person_id
889                         ,p_effective_date => p_effective_date);
890   end if;
891   --
892   hr_utility.set_location(l_proc, 55);
893   --
894   --irc_irf_bus.chk_ddf(p_rec);
895   --
896   hr_utility.set_location(l_proc, 60);
897   --
898   --irc_irf_bus.chk_df(p_rec);
899   --
900   hr_utility.set_location(' Leaving:'||l_proc, 65);
901 End insert_validate;
902 --
903 -- ----------------------------------------------------------------------------
904 -- |---------------------------< update_validate >----------------------------|
905 -- ----------------------------------------------------------------------------
906 Procedure update_validate
907   (p_rec                     in irc_irf_shd.g_rec_type
908   ,p_effective_date          in date
909   ,p_datetrack_mode          in varchar2
910   ,p_validation_start_date   in date
911   ,p_validation_end_date     in date
912   ) is
913 --
914   l_proc        varchar2(72) := g_package||'update_validate';
915 --
916 Begin
917   --
918   hr_utility.set_location(l_proc, 10);
919   --
920   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria1
921                         ,p_source_criteria_index => 1
922 						,p_effective_date => p_effective_date);
923   --
927                         ,p_source_criteria_index => 2
924   hr_utility.set_location(l_proc, 20);
925   --
926   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria2
928 						,p_effective_date => p_effective_date);
929   --
930   hr_utility.set_location(l_proc, 25);
931   --
932   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria3
933                         ,p_source_criteria_index => 3
934 						,p_effective_date => p_effective_date);
935   --
936   hr_utility.set_location(l_proc, 30);
937   --
938   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria4
939                         ,p_source_criteria_index => 4
940 						,p_effective_date => p_effective_date);
941   --
942   hr_utility.set_location(l_proc, 35);
943   --
944   irc_irf_bus.chk_source_criteria(p_source_criteria  => p_rec.source_criteria5
945                         ,p_source_criteria_index => 5
946 						,p_effective_date => p_effective_date);
947   --
948   hr_utility.set_location(l_proc, 40);
949   --
950   irc_irf_bus.chk_source_type(p_source_type  => p_rec.source_type
951                         ,p_effective_date => p_effective_date);
952   --
953   hr_utility.set_location(l_proc, 45);
954   --
955   irc_irf_bus.chk_object_created_by(p_rec             => p_rec
956                         ,p_effective_date => p_effective_date);
957   --
958   hr_utility.set_location(l_proc, 50);
959   --
960   if p_rec.source_person_id is not null then
961   irc_irf_bus.chk_person_id(p_person_id  => p_rec.source_person_id
962                         ,p_effective_date => p_effective_date);
963   end if;
964   --
965   hr_utility.set_location(l_proc, 55);
966   --
967   -- Call the datetrack update integrity operation
968   --
969   dt_update_validate
970     (p_datetrack_mode                 => p_datetrack_mode
971     ,p_validation_start_date          => p_validation_start_date
972     ,p_validation_end_date            => p_validation_end_date
973     );
974   --
975   hr_utility.set_location(l_proc, 60);
976   --
977   chk_non_updateable_args
978     (p_effective_date  => p_effective_date
979     ,p_rec             => p_rec
980     );
981   --
982   hr_utility.set_location(l_proc, 65);
983   --
984   --irc_irf_bus.chk_ddf(p_rec);
985   --
986   hr_utility.set_location(l_proc, 70);
987   --
988   --irc_irf_bus.chk_df(p_rec);
989   --
990   hr_utility.set_location(' Leaving:'||l_proc, 75);
991 End update_validate;
992 --
993 end irc_irf_bus;