DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_CMP_BUS

Source


1 Package Body irc_cmp_bus as
2 /* $Header: ircmprhi.pkb 120.0 2007/11/19 11:38:55 sethanga noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_cmp_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_communication_property_id   number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_communication_property_id            in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare cursor
26   --
27   -- EDIT_HERE  In the following cursor statement add join(s) between
28   -- irc_comm_properties and PER_BUSINESS_GROUPS_PERF
29   -- so that the security_group_id for
30   -- the current business group context can be derived.
31   -- Remove this comment when the edit has been completed.
32   cursor csr_sec_grp is
33     select pbg.security_group_id,
34            pbg.legislation_code
35       from per_business_groups_perf pbg
36          , irc_comm_properties cmp
37       --   , EDIT_HERE table_name(s) 333
38      where cmp.communication_property_id = p_communication_property_id;
39       -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
40   --
41   -- Declare local variables
42   --
43   l_security_group_id number;
44   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
45   l_legislation_code  varchar2(150);
46   --
47 begin
48   --
49   hr_utility.set_location('Entering:'|| l_proc, 10);
50   --
51   -- Ensure that all the mandatory parameter are not null
52   --
53   hr_api.mandatory_arg_error
54     (p_api_name           => l_proc
55     ,p_argument           => 'communication_property_id'
56     ,p_argument_value     => p_communication_property_id
57     );
58   --
59   open csr_sec_grp;
60   fetch csr_sec_grp into l_security_group_id
61                        , l_legislation_code;
62   --
63   if csr_sec_grp%notfound then
64      --
65      close csr_sec_grp;
66      --
67      -- The primary key is invalid therefore we must error
68      --
69      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
70      hr_multi_message.add
71        (p_associated_column1
72         => nvl(p_associated_column1,'COMMUNICATION_PROPERTY_ID')
73        );
74      --
75   else
76     close csr_sec_grp;
77     --
78     -- Set the security_group_id in CLIENT_INFO
79     --
80     hr_api.set_security_group_id
81       (p_security_group_id => l_security_group_id
82       );
83     --
84     -- Set the sessions legislation context in HR_SESSION_DATA
85     --
86     hr_api.set_legislation_context(l_legislation_code);
87   end if;
88   --
89   hr_utility.set_location(' Leaving:'|| l_proc, 20);
90   --
91 end set_security_group_id;
92 --
93 --  ---------------------------------------------------------------------------
94 --  |---------------------< return_legislation_code >-------------------------|
95 --  ---------------------------------------------------------------------------
96 --
97 Function return_legislation_code
98   (p_communication_property_id            in     number
99   )
100   Return Varchar2 Is
101   --
102   -- Declare cursor
103   --
104   -- EDIT_HERE  In the following cursor statement add join(s) between
105   -- irc_comm_properties and PER_BUSINESS_GROUPS_PERF
106   -- so that the legislation_code for
107   -- the current business group context can be derived.
108   -- Remove this comment when the edit has been completed.
109   cursor csr_leg_code is
110     select pbg.legislation_code
111       from per_business_groups_perf     pbg
112          , irc_comm_properties cmp
113       --   , EDIT_HERE table_name(s) 333
114      where cmp.communication_property_id = p_communication_property_id;
115       -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
116   --
117   -- Declare local variables
118   --
119   l_legislation_code  varchar2(150);
120   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
121   --
122 Begin
123   --
124   hr_utility.set_location('Entering:'|| l_proc, 10);
125   --
126   -- Ensure that all the mandatory parameter are not null
127   --
128   hr_api.mandatory_arg_error
129     (p_api_name           => l_proc
130     ,p_argument           => 'communication_property_id'
131     ,p_argument_value     => p_communication_property_id
132     );
133   --
134   if ( nvl(irc_cmp_bus.g_communication_property_id, hr_api.g_number)
135        = p_communication_property_id) then
136     --
137     -- The legislation code has already been found with a previous
138     -- call to this function. Just return the value in the global
139     -- variable.
140     --
141     l_legislation_code := irc_cmp_bus.g_legislation_code;
142     hr_utility.set_location(l_proc, 20);
143   else
144     --
145     -- The ID is different to the last call to this function
146     -- or this is the first call to this function.
147     --
148     open csr_leg_code;
149     fetch csr_leg_code into l_legislation_code;
150     --
151     if csr_leg_code%notfound then
152       --
153       -- The primary key is invalid therefore we must error
154       --
155       close csr_leg_code;
156       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
157       fnd_message.raise_error;
158     end if;
159     hr_utility.set_location(l_proc,30);
160     --
161     -- Set the global variables so the values are
162     -- available for the next call to this function.
163     --
164     close csr_leg_code;
165     irc_cmp_bus.g_communication_property_id   := p_communication_property_id;
166     irc_cmp_bus.g_legislation_code  := l_legislation_code;
167   end if;
168   hr_utility.set_location(' Leaving:'|| l_proc, 40);
169   return l_legislation_code;
170 end return_legislation_code;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |-----------------------------< chk_ddf >----------------------------------|
174 -- ----------------------------------------------------------------------------
175 --
176 -- Description:
177 --   Validates all the Developer Descriptive Flexfield values.
178 --
179 -- Prerequisites:
180 --   All other columns have been validated.  Must be called as the
181 --   last step from insert_validate and update_validate.
182 --
183 -- In Arguments:
184 --   p_rec
185 --
186 -- Post Success:
187 --   If the Developer Descriptive Flexfield structure column and data values
188 --   are all valid this procedure will end normally and processing will
189 --   continue.
190 --
191 -- Post Failure:
192 --   If the Developer Descriptive Flexfield structure column value or any of
193 --   the data values are invalid then an application error is raised as
194 --   a PL/SQL exception.
195 --
196 -- Access Status:
197 --   Internal Row Handler Use Only.
198 --
199 -- ----------------------------------------------------------------------------
200 procedure chk_ddf
201   (p_rec in irc_cmp_shd.g_rec_type
202   ) is
203 --
204   l_proc   varchar2(72) := g_package || 'chk_ddf';
205 --
206 begin
207   hr_utility.set_location('Entering:'||l_proc,10);
208   --
209   if ((p_rec.communication_property_id is not null)  and (
210     nvl(irc_cmp_shd.g_old_rec.information_category, hr_api.g_varchar2) <>
211     nvl(p_rec.information_category, hr_api.g_varchar2)  or
212     nvl(irc_cmp_shd.g_old_rec.information1, hr_api.g_varchar2) <>
213     nvl(p_rec.information1, hr_api.g_varchar2)  or
214     nvl(irc_cmp_shd.g_old_rec.information2, hr_api.g_varchar2) <>
215     nvl(p_rec.information2, hr_api.g_varchar2)  or
216     nvl(irc_cmp_shd.g_old_rec.information3, hr_api.g_varchar2) <>
217     nvl(p_rec.information3, hr_api.g_varchar2)  or
218     nvl(irc_cmp_shd.g_old_rec.information4, hr_api.g_varchar2) <>
219     nvl(p_rec.information4, hr_api.g_varchar2)  or
220     nvl(irc_cmp_shd.g_old_rec.information5, hr_api.g_varchar2) <>
221     nvl(p_rec.information5, hr_api.g_varchar2)  or
222     nvl(irc_cmp_shd.g_old_rec.information6, hr_api.g_varchar2) <>
223     nvl(p_rec.information6, hr_api.g_varchar2)  or
224     nvl(irc_cmp_shd.g_old_rec.information7, hr_api.g_varchar2) <>
225     nvl(p_rec.information7, hr_api.g_varchar2)  or
226     nvl(irc_cmp_shd.g_old_rec.information8, hr_api.g_varchar2) <>
227     nvl(p_rec.information8, hr_api.g_varchar2)  or
228     nvl(irc_cmp_shd.g_old_rec.information9, hr_api.g_varchar2) <>
229     nvl(p_rec.information9, hr_api.g_varchar2)  or
230     nvl(irc_cmp_shd.g_old_rec.information10, hr_api.g_varchar2) <>
231     nvl(p_rec.information10, hr_api.g_varchar2) ))
232     or (p_rec.communication_property_id is null)  then
233     --
234     -- Only execute the validation if absolutely necessary:
235     -- a) During update, the structure column value or any
236     --    of the attribute values have actually changed.
237     -- b) During insert.
238     --
239     hr_dflex_utility.ins_or_upd_descflex_attribs
240       (p_appl_short_name                 => 'IRC'
241       ,p_descflex_name                   => 'EDIT_HERE: Enter descflex name'
242       ,p_attribute_category              => p_rec.information_category
243       ,p_attribute1_name                 => 'INFORMATION1'
244       ,p_attribute1_value                => p_rec.information1
245       ,p_attribute2_name                 => 'INFORMATION2'
246       ,p_attribute2_value                => p_rec.information2
247       ,p_attribute3_name                 => 'INFORMATION3'
248       ,p_attribute3_value                => p_rec.information3
249       ,p_attribute4_name                 => 'INFORMATION4'
250       ,p_attribute4_value                => p_rec.information4
251       ,p_attribute5_name                 => 'INFORMATION5'
252       ,p_attribute5_value                => p_rec.information5
253       ,p_attribute6_name                 => 'INFORMATION6'
254       ,p_attribute6_value                => p_rec.information6
255       ,p_attribute7_name                 => 'INFORMATION7'
256       ,p_attribute7_value                => p_rec.information7
257       ,p_attribute8_name                 => 'INFORMATION8'
258       ,p_attribute8_value                => p_rec.information8
259       ,p_attribute9_name                 => 'INFORMATION9'
260       ,p_attribute9_value                => p_rec.information9
261       ,p_attribute10_name                => 'INFORMATION10'
262       ,p_attribute10_value               => p_rec.information10
263       );
264   end if;
265   --
266   hr_utility.set_location(' Leaving:'||l_proc,20);
267 end chk_ddf;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |------------------------------< chk_df >----------------------------------|
271 -- ----------------------------------------------------------------------------
272 --
273 -- Description:
274 --   Validates all the Descriptive Flexfield values.
275 --
276 -- Prerequisites:
277 --   All other columns have been validated.  Must be called as the
278 --   last step from insert_validate and update_validate.
279 --
280 -- In Arguments:
281 --   p_rec
282 --
283 -- Post Success:
284 --   If the Descriptive Flexfield structure column and data values are
285 --   all valid this procedure will end normally and processing will
286 --   continue.
287 --
288 -- Post Failure:
289 --   If the Descriptive Flexfield structure column value or any of
290 --   the data values are invalid then an application error is raised as
291 --   a PL/SQL exception.
292 --
293 -- Access Status:
294 --   Internal Row Handler Use Only.
295 --
296 -- ----------------------------------------------------------------------------
297 procedure chk_df
298   (p_rec in irc_cmp_shd.g_rec_type
299   ) is
300 --
301   l_proc   varchar2(72) := g_package || 'chk_df';
302 --
303 begin
304   hr_utility.set_location('Entering:'||l_proc,10);
305   --
306   if ((p_rec.communication_property_id is not null)  and (
307     nvl(irc_cmp_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
308     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
309     nvl(irc_cmp_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
310     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
311     nvl(irc_cmp_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
312     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
313     nvl(irc_cmp_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
314     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
315     nvl(irc_cmp_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
316     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
317     nvl(irc_cmp_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
318     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
319     nvl(irc_cmp_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
320     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
321     nvl(irc_cmp_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
322     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
323     nvl(irc_cmp_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
324     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
325     nvl(irc_cmp_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
326     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
327     nvl(irc_cmp_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
328     nvl(p_rec.attribute10, hr_api.g_varchar2) ))
329     or (p_rec.communication_property_id is null)  then
330     --
331     -- Only execute the validation if absolutely necessary:
332     -- a) During update, the structure column value or any
333     --    of the attribute values have actually changed.
334     -- b) During insert.
335     --
336     hr_dflex_utility.ins_or_upd_descflex_attribs
337       (p_appl_short_name                 => 'IRC'
338       ,p_descflex_name                   => 'EDIT_HERE: Enter descflex name'
339       ,p_attribute_category              => p_rec.attribute_category
340       ,p_attribute1_name                 => 'ATTRIBUTE1'
341       ,p_attribute1_value                => p_rec.attribute1
342       ,p_attribute2_name                 => 'ATTRIBUTE2'
343       ,p_attribute2_value                => p_rec.attribute2
344       ,p_attribute3_name                 => 'ATTRIBUTE3'
345       ,p_attribute3_value                => p_rec.attribute3
346       ,p_attribute4_name                 => 'ATTRIBUTE4'
347       ,p_attribute4_value                => p_rec.attribute4
348       ,p_attribute5_name                 => 'ATTRIBUTE5'
349       ,p_attribute5_value                => p_rec.attribute5
350       ,p_attribute6_name                 => 'ATTRIBUTE6'
351       ,p_attribute6_value                => p_rec.attribute6
352       ,p_attribute7_name                 => 'ATTRIBUTE7'
353       ,p_attribute7_value                => p_rec.attribute7
354       ,p_attribute8_name                 => 'ATTRIBUTE8'
355       ,p_attribute8_value                => p_rec.attribute8
356       ,p_attribute9_name                 => 'ATTRIBUTE9'
357       ,p_attribute9_value                => p_rec.attribute9
358       ,p_attribute10_name                => 'ATTRIBUTE10'
359       ,p_attribute10_value               => p_rec.attribute10
360       );
361   end if;
362   --
363   hr_utility.set_location(' Leaving:'||l_proc,20);
364 end chk_df;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |-----------------------< chk_non_updateable_args >------------------------|
368 -- ----------------------------------------------------------------------------
369 -- {Start Of Comments}
370 --
371 -- Description:
372 --   This procedure is used to ensure that non updateable attributes have
373 --   not been updated. If an attribute has been updated an error is generated.
374 --
375 -- Pre Conditions:
376 --   g_old_rec has been populated with details of the values currently in
377 --   the database.
378 --
379 -- In Arguments:
380 --   p_rec has been populated with the updated values the user would like the
381 --   record set to.
382 --
383 -- Post Success:
384 --   Processing continues if all the non updateable attributes have not
385 --   changed.
386 --
387 -- Post Failure:
388 --   An application error is raised if any of the non updatable attributes
389 --   have been altered.
390 --
391 -- {End Of Comments}
392 -- ----------------------------------------------------------------------------
393 Procedure chk_non_updateable_args
394   (p_effective_date               in date
395   ,p_rec in irc_cmp_shd.g_rec_type
396   ) IS
397 --
398   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
399 --
400 Begin
401   --
402   -- Only proceed with the validation if a row exists for the current
403   -- record in the HR Schema.
404   --
405   IF NOT irc_cmp_shd.api_updating
406       (p_communication_property_id         => p_rec.communication_property_id
407       ,p_object_version_number             => p_rec.object_version_number
408       ) THEN
409      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
410      fnd_message.set_token('PROCEDURE ', l_proc);
411      fnd_message.set_token('STEP ', '5');
412      fnd_message.raise_error;
413   END IF;
414   --
415   -- EDIT_HERE: Add checks to ensure non-updateable args have
416   --            not been updated.
417   --
418   IF p_rec.object_type <>
419        irc_cmp_shd.g_old_rec.object_type then
420      hr_api.argument_changed_error
421      (p_api_name   => l_proc
422      ,p_argument   => 'OBJECT_TYPE'
423      ,p_base_table => irc_cmp_shd.g_tab_nam
424      );
425   END IF;
426   --
427   IF p_rec.object_id <> irc_cmp_shd.g_old_rec.object_id  THEN
428     IF p_rec.object_type = 'VACANCY' THEN
429       hr_api.argument_changed_error
430       ( p_api_name     => l_proc
431        ,p_argument     => 'VACANCY_ID'
432        ,p_base_table   => irc_cmp_shd.g_tab_nam
433       );
434      END IF;
435   END IF;
436 --
437 End chk_non_updateable_args;
438 --
439 --  ---------------------------------------------------------------------------
440 --  |----------------------------< chk_default_comm_status >------------------|
441 --  ---------------------------------------------------------------------------
442 --
443 -- {Start Of Comments}
444 --
445 -- Description:
446 --   This process validates that 'status' exists in the lookup
447 --   IRC_COMM_DEFAULT_COMM_STATUS.
448 --
449 -- Pre Conditions:
450 --   None.
451 --
452 -- In Parameters:
453 --   status                     varchar2(50) default communication status
454 --   communication_property_id  number(15)   PK of irc_comm_properties
455 --   effective_date             date         date record effective
456 --   object_version_number      number(9)    version of row
457 --
458 -- Post Success:
459 --   Processing continues.
460 --
461 -- Post Failure:
462 --   An application error will be raised for the following faliure conditions:
463 --   1: p_status does not exist in lookup IRC_COMM_DEFAULT_COMM_STATUS
464 --
465 -- Access Status:
466 --   Internal Table Handler Use Only.
467 Procedure chk_default_comm_status(p_status in varchar2,
468                                   p_communication_property_id in number,
469                                   p_effective_date in date,
470                                   p_object_version_number in number) is
471 --
472   l_proc varchar2(72) := g_package||'chk_default_comm_status';
473   l_api_updating boolean;
474 --
475 begin
476     hr_utility.set_location('Entering: '|| l_proc, 10);
477     l_api_updating := irc_cmp_shd.api_updating
478            (p_communication_property_id   => p_communication_property_id,
479             p_object_version_number       => p_object_version_number);
480     --
481     if (l_api_updating
482       and nvl(p_status,hr_api.g_varchar2)
483           <> nvl(irc_cmp_shd.g_old_rec.default_comm_status,hr_api.g_varchar2)
484       or not l_api_updating) then
485       --
486       -- check if value of type falls within lookup.
487       --
488       if hr_api.not_exists_in_hr_lookups(p_lookup_type    => 'IRC_COMM_DEFAULT_COMM_STATUS',
489                                          p_lookup_code    => p_status,
490                                          p_effective_date => sysdate)
491                                         then
492         --
493         -- raise error as does not exist as lookup
494         --
495         hr_utility.set_location('Leaving: '|| l_proc, 20);
496         fnd_message.set_name('PER','IRC_412408_INVALID_COMM_STATUS');
497         fnd_message.raise_error;
498       end if;
499     end if;
500     hr_utility.set_location('Leaving: '|| l_proc, 30);
501 end chk_default_comm_status;
502 --
503 --  ---------------------------------------------------------------------------
504 --  |----------------------------< chk_allow_attachment_flag >------------------|
505 --  ---------------------------------------------------------------------------
506 --
507 -- {Start Of Comments}
508 --
509 -- Description:
510 --   This process validates that 'status' exists in the lookup
511 --   IRC_COMM_ALLOW_ATTACHMENT_FLAG.
512 --
513 -- Pre Conditions:
514 --   None.
515 --
516 -- In Parameters:
517 --   flag                       varchar2(50) allow attachement flag
518 --   communication_property_id  number(15)   PK of irc_comm_properties
519 --   effective_date             date         date record effective
520 --   object_version_number      number(9)    version of row
521 --
522 -- Post Success:
523 --   Processing continues.
524 --
525 -- Post Failure:
526 --   An application error will be raised for the following faliure conditions:
527 --   1: p_flag does not exist in lookup IRC_COMM_ALLOW_ATTACHMENT_FLAG.
528 --
529 -- Access Status:
530 --   Internal Table Handler Use Only.
531 Procedure chk_allow_attachment_flag(p_flag in varchar2,
532                                     p_communication_property_id in number,
533                                     p_effective_date in date,
534                                     p_object_version_number in number) is
535 --
536   l_proc varchar2(72) := g_package||'chk_allow_attachment_flag';
537   l_api_updating boolean;
538 --
539 begin
540     hr_utility.set_location('Entering: '|| l_proc, 10);
541     l_api_updating := irc_cmp_shd.api_updating
542            (p_communication_property_id   => p_communication_property_id,
543             p_object_version_number       => p_object_version_number);
544     --
545     if (l_api_updating
546       and nvl(p_flag,hr_api.g_varchar2)
547           <> nvl(irc_cmp_shd.g_old_rec.allow_attachment_flag,hr_api.g_varchar2)
548       or not l_api_updating) then
549       --
550       -- check if value of type falls within lookup.
551       --
552       if hr_api.not_exists_in_hr_lookups(p_lookup_type    => 'IRC_COMM_ALLOW_ATTACHMENT_FLAG',
553                                          p_lookup_code    => p_flag,
554                                          p_effective_date => sysdate)
555                                         then
556         --
557         -- raise error as does not exist as lookup
558         --
559         hr_utility.set_location('Leaving: '|| l_proc, 20);
560         fnd_message.set_name('PER','IRC_412409_INVALID_ATTACHMENT_FLAG');
561         fnd_message.raise_error;
562       end if;
563     end if;
564     hr_utility.set_location('Leaving: '|| l_proc, 30);
565 end chk_allow_attachment_flag;
566 --
567 --  ---------------------------------------------------------------------------
568 --  |----------------------------< chk_allow_add_recipients >-----------------|
569 --  ---------------------------------------------------------------------------
570 --
571 -- {Start Of Comments}
572 --
573 -- Description:
574 --   This process validates that 'allow_add_recipients' exists in the lookup
575 --   IRC_COMM_ALLOW_ADD_RECIPIENTS.
576 --
577 -- Pre Conditions:
578 --   None.
579 --
580 -- In Parameters:
581 --   allow_add_recipients       varchar2(50) allow add recipients
582 --   communication_property_id  number(15)   PK of irc_comm_properties
583 --   effective_date             date         date record effective
584 --   object_version_number      number(9)    version of row
585 --
586 -- Post Success:
587 --   Processing continues.
588 --
589 -- Post Failure:
590 --   An application error will be raised for the following faliure conditions:
591 --   1: p_allow_add_recipients does not exist in lookup IRC_COMM_ALLOW_ADD_RECIPIENTS.
592 --
593 -- Access Status:
594 --   Internal Table Handler Use Only.
595 Procedure chk_allow_add_recipients(p_allow_add_recipients in varchar2,
596                                    p_communication_property_id in number,
597                                    p_effective_date in date,
598                                    p_object_version_number in number) is
599 --
600   l_proc varchar2(72) := g_package||'chk_allow_add_recipients';
601   l_api_updating boolean;
602 --
603 begin
604     hr_utility.set_location('Entering: '|| l_proc, 10);
605     l_api_updating := irc_cmp_shd.api_updating
606            (p_communication_property_id   => p_communication_property_id,
607             p_object_version_number       => p_object_version_number);
608     --
609     if (l_api_updating
610       and nvl(p_allow_add_recipients,hr_api.g_varchar2)
611           <> nvl(irc_cmp_shd.g_old_rec.allow_add_recipients,hr_api.g_varchar2)
612       or not l_api_updating) then
613       --
614       -- check if value of type falls within lookup.
615       --
616       if hr_api.not_exists_in_hr_lookups(p_lookup_type    => 'IRC_COMM_ALLOW_ADD_RECIPIENTS',
617                                          p_lookup_code    => p_allow_add_recipients,
618                                          p_effective_date => sysdate)
619                                         then
620         --
621         -- raise error as does not exist as lookup
622         --
623         hr_utility.set_location('Leaving: '|| l_proc, 20);
624         fnd_message.set_name('PER','IRC_412410_INVALID_ALLOW_ADD_RECIPIENT');
625         fnd_message.raise_error;
626       end if;
627     end if;
628     hr_utility.set_location('Leaving: '|| l_proc, 30);
629 end chk_allow_add_recipients;
630 --
631 --  ---------------------------------------------------------------------------
632 --  |----------------------------< chk_auto_notification_flag  >--------------|
633 --  ---------------------------------------------------------------------------
634 --
635 -- {Start Of Comments}
636 --
637 -- Description:
638 --   This process validates that 'auto_notification_flag' exists in the lookup
639 --   YES_NO.
640 --
641 -- Pre Conditions:
642 --   None.
643 --
644 -- In Parameters:
645 --   auto_notification_flag     varchar2(1)  auto_notification_flag
646 --   communication_property_id  number(15)   PK of irc_comm_properties
647 --   effective_date             date         date record effective
648 --   object_version_number      number(9)    version of row
649 --
650 -- Post Success:
651 --   Processing continues.
652 --
653 -- Post Failure:
654 --   An application error will be raised for the following faliure conditions:
655 --   1: p_auto_notification_flag does not exist in lookup YES_NO
656 --
657 -- Access Status:
658 --   Internal Table Handler Use Only.
659 Procedure chk_auto_notification_flag(p_auto_notification_flag in varchar2,
660                                      p_communication_property_id in number,
661                                      p_effective_date in date,
662                                      p_object_version_number in number) is
663 --
664   l_proc varchar2(72) := g_package||'chk_auto_notification_flag';
665   l_api_updating boolean;
666 --
667 begin
668     hr_utility.set_location('Entering: '|| l_proc, 10);
669     l_api_updating := irc_cmp_shd.api_updating
670            (p_communication_property_id   => p_communication_property_id,
671             p_object_version_number       => p_object_version_number);
672     --
673     if (l_api_updating
674       and nvl(p_auto_notification_flag,hr_api.g_varchar2)
675           <> nvl(irc_cmp_shd.g_old_rec.auto_notification_flag,hr_api.g_varchar2)
676       or not l_api_updating) then
677       --
678       -- check if value of type falls within lookup.
679       --
680       if hr_api.not_exists_in_hr_lookups(p_lookup_type    => 'YES_NO',
681                                          p_lookup_code    => p_auto_notification_flag,
682                                          p_effective_date => sysdate)
683                                         then
684         --
685         -- raise error as does not exist as lookup
686         --
687         hr_utility.set_location('Leaving: '|| l_proc, 20);
688         fnd_message.set_name('PER','IRC_412411_INVALID_NOTIFICATION_FLAG');
689         fnd_message.raise_error;
690       end if;
691     end if;
692     hr_utility.set_location('Leaving: '|| l_proc, 30);
693 end chk_auto_notification_flag;
694 --
695 --  ---------------------------------------------------------------------------
696 --  |----------------------------< chk_default_moderator >-----------------|
697 --  ---------------------------------------------------------------------------
698 --
699 -- {Start Of Comments}
700 --
701 -- Description:
702 --   This process validates that 'default_moderator' exists in the lookup
703 --   IRC_COMM_DEFAULT_MODERATOR.
704 --
705 -- Pre Conditions:
706 --   None.
707 --
708 -- In Parameters:
709 --   default_moderator          varchar2(50) default_moderator
710 --   communication_property_id  number(15)   PK of irc_comm_properties
711 --   effective_date             date         date record effective
712 --   object_version_number      number(9)    version of row
713 --
714 -- Post Success:
715 --   Processing continues.
716 --
717 -- Post Failure:
718 --   An application error will be raised for the following faliure conditions:
719 --   1: p_default_moderator does not exist in lookup IRC_COMM_DEFAULT_MODERATOR.
720 --
721 -- Access Status:
722 --   Internal Table Handler Use Only.
723 Procedure chk_default_moderator(p_default_moderator in varchar2,
724                                 p_communication_property_id in number,
725                                 p_effective_date in date,
726                                 p_object_version_number in number) is
727 --
728   l_proc varchar2(72) := g_package||'chk_default_moderator';
729   l_api_updating boolean;
730 --
731 begin
732     hr_utility.set_location('Entering: '|| l_proc, 10);
733     l_api_updating := irc_cmp_shd.api_updating
734            (p_communication_property_id   => p_communication_property_id,
735             p_object_version_number       => p_object_version_number);
736     --
737     if (l_api_updating
738       and nvl(p_default_moderator,hr_api.g_varchar2)
739           <> nvl(irc_cmp_shd.g_old_rec.default_moderator,hr_api.g_varchar2)
740       or not l_api_updating) then
741       --
742       -- check if value of type falls within lookup.
743       --
744       if hr_api.not_exists_in_hr_lookups(p_lookup_type    => 'IRC_COMM_DEFAULT_MODERATOR',
745                                          p_lookup_code    => p_default_moderator,
746                                          p_effective_date => sysdate)
747                                         then
748         --
749         -- raise error as does not exist as lookup
750         --
751         hr_utility.set_location('Leaving: '|| l_proc, 20);
752         fnd_message.set_name('PER','IRC_412412_INVALID_DEFAULT_MODERATOR');
753         fnd_message.raise_error;
754       end if;
755     end if;
756     hr_utility.set_location('Leaving: '|| l_proc, 30);
757 end chk_default_moderator;
758 --
759 -- ----------------------------------------------------------------------------
760 -- |-----------------------------< chk_object_id >-----------------------------|
761 -- ----------------------------------------------------------------------------
762 --
763 -- {Start Of Comments}
764 --
765 -- Description:
766 --   This procedure is used to ensure-
767 --  1) that object_id exists in PER_ALL_VACANCIES
768 --     when the object_type is 'VACANCY'
769 --  2) that combination of (object_id,object_type) is
770 --     unique.
771 
772 -- Pre Conditions:
773 --
774 -- In Arguments:
775 --  p_object_id
776 --  p_object_type
777 -- Post Success:
778 --  Processing continues if object_id is valid.
779 --
780 -- Post Failure:
781 --   An application error is raised if object_id is invalid.
782 --
783 -- {End Of Comments}
784 -- ----------------------------------------------------------------------------
785 Procedure chk_object_id
786   (p_object_id in irc_comm_properties.object_id%TYPE,
787    p_object_type in irc_comm_properties.object_type%TYPE
788   ) IS
789 --
790   l_proc     varchar2(72) := g_package || 'chk_object_id';
791   l_object_id varchar2(1);
792   l_object_type varchar2(1);
793 --
794   cursor csr_object_id is
795     select null
796     from per_all_vacancies pav
797     where pav.vacancy_id = p_object_id ;
798 --
799   cursor csr_object_type is
800     select null
801     from irc_comm_properties icp
802     where icp.object_id = p_object_id
803      and  icp.object_type = p_object_type;
804 --
805 begin
806   hr_utility.set_location('Entering:'||l_proc,10);
807 -- Check that object_id is not null.
808   hr_api.mandatory_arg_error
809   (p_api_name           => l_proc
810   ,p_argument           => 'OBJECT_ID'
811   ,p_argument_value     => p_object_id
812   );
813 -- Check that object_id exists in per_all_vacancies
814   hr_utility.set_location(l_proc,20);
815   open csr_object_id;
816   fetch csr_object_id into l_object_id;
817   hr_utility.set_location(l_proc,30);
818   if csr_object_id%NOTFOUND then
819     close csr_object_id;
820     fnd_message.set_name('PER','IRC_412413_BAD_OBJECT_ID');
821     fnd_message.raise_error;
822   end if;
823   close csr_object_id;
824 
825   -- Check that combination of (object_id,object_type) is unique.
826   open csr_object_type;
827   fetch csr_object_type into l_object_type;
828   hr_utility.set_location(l_proc,40);
829   if csr_object_type%FOUND then
830     close csr_object_type;
831     fnd_message.set_name('PER','IRC_412414_OBJID_OBJTYP_NOT_UNQ');
832     fnd_message.raise_error;
833   end if;
834   close csr_object_type;
835 
836   hr_utility.set_location(' Leaving:'||l_proc,50);
837   exception
838    when app_exception.application_exception then
839     if hr_multi_message.exception_add
840        (p_associated_column1 =>
841        'IRC_COMM_PROPERTIES.OBJECT_ID'
842        ) then
843       hr_utility.set_location(' Leaving:'||l_proc,60);
844       raise;
845     end if;
846   hr_utility.set_location(' Leaving:'||l_proc,70);
847 end chk_object_id;
848 --
849 -- ----------------------------------------------------------------------------
850 -- |-----------------------------< chk_object_type >-----------------------------|
851 -- ----------------------------------------------------------------------------
852 --
853 -- {Start Of Comments}
854 --
855 -- Description:
856 --   This procedure is used to ensure that object_type has one of the following
857 --   values :
858 --   'VACANCY'
859 --
860 -- Pre Conditions:
861 --
862 -- In Arguments:
863 --  p_object_type
864 --
865 -- Post Success:
866 --  Processing continues if object_type is valid.
867 --
868 -- Post Failure:
869 --   An application error is raised if object_type is invalid.
870 --
871 -- {End Of Comments}
872 -- ----------------------------------------------------------------------------
873 Procedure chk_object_type
874   (p_object_type in irc_comm_properties.object_type%TYPE
875   ) IS
876 --
877   l_proc     varchar2(72) := g_package || 'chk_object_type';
878 --
879 begin
880   hr_utility.set_location('Entering:'||l_proc,10);
881 -- Check that object_type is not null.
882   hr_api.mandatory_arg_error
883   (p_api_name           => l_proc
884   ,p_argument           => 'OBJECT_TYPE'
885   ,p_argument_value     => p_object_type
886   );
887 
888    if p_object_type <> 'VACANCY' then
889     fnd_message.set_name('PER','IRC_412415_BAD_OBJECT_TYPE');
890     fnd_message.raise_error;
891   end if;
892   hr_utility.set_location(' Leaving:'||l_proc,20);
893   exception
894    when app_exception.application_exception then
895     if hr_multi_message.exception_add
896        (p_associated_column1 =>
897        'IRC_COMM_PROPERTIES.OBJECT_TYPE'
898        ) then
899       hr_utility.set_location(' Leaving:'||l_proc,30);
900       raise;
901     end if;
902   hr_utility.set_location(' Leaving:'||l_proc,40);
903 end chk_object_type;
904 --
905 -- ----------------------------------------------------------------------------
906 -- |---------------------------< insert_update_validate >----------------------|
907 -- ----------------------------------------------------------------------------
908 Procedure insert_update_validate
909   (p_effective_date               in date
910   ,p_rec                          in irc_cmp_shd.g_rec_type
911   ) is
912 --
913   l_proc  varchar2(72) := g_package||'insert_validate';
914 --
915 Begin
916       irc_cmp_bus.chk_default_comm_status
917       (
918        p_rec.default_comm_status,
919        p_rec.communication_property_id,
920        p_effective_date,
921        p_rec.object_version_number
922       );
923 
924       irc_cmp_bus.chk_allow_attachment_flag
925       (
926        p_rec.allow_attachment_flag,
927        p_rec.communication_property_id,
928        p_effective_date,
929        p_rec.object_version_number
930       );
931 
932       irc_cmp_bus.chk_allow_add_recipients
933       (
934        p_rec.allow_add_recipients,
935        p_rec.communication_property_id,
936        p_effective_date,
937        p_rec.object_version_number
938       );
939 
940       irc_cmp_bus.chk_auto_notification_flag
941       (
942        p_rec.auto_notification_flag,
943        p_rec.communication_property_id,
944        p_effective_date,
945        p_rec.object_version_number
946       );
947 
948       irc_cmp_bus.chk_default_moderator
949       (
950        p_rec.default_moderator,
951        p_rec.communication_property_id,
952        p_effective_date,
953        p_rec.object_version_number
954       );
955 --
956 End insert_update_validate;
957 --
958 -- ----------------------------------------------------------------------------
959 -- |---------------------------< insert_validate >----------------------------|
960 -- ----------------------------------------------------------------------------
961 Procedure insert_validate
962   (p_effective_date               in date
963   ,p_rec                          in irc_cmp_shd.g_rec_type
964   ) is
965 --
966   l_proc  varchar2(72) := g_package||'insert_validate';
967 --
968 Begin
969   hr_utility.set_location('Entering:'||l_proc, 5);
970   --
971   -- Call all supporting business operations
972   --
973   --
974   -- EDIT_HERE: As this table does not have a mandatory business_group_id
975   -- column, ensure client_info is populated by calling a suitable
976   -- ???_???_bus.set_security_group_id procedure, or add one of the following
977   -- comments:
978   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
979   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
980   --
981   -- Validate Dependent Attributes
982   --
983   --
984   --  irc_cmp_bus.chk_ddf(p_rec);
985   --
986   --  irc_cmp_bus.chk_df(p_rec);
987   --
988       irc_cmp_bus.insert_update_validate(p_effective_date, p_rec);
989       irc_cmp_bus.chk_object_type(p_rec.object_type);
990       irc_cmp_bus.chk_object_id(p_rec.object_id,p_rec.object_type);
991   --
992   hr_utility.set_location(' Leaving:'||l_proc, 10);
993 End insert_validate;
994 --
995 -- ----------------------------------------------------------------------------
996 -- |---------------------------< update_validate >----------------------------|
997 -- ----------------------------------------------------------------------------
998 Procedure update_validate
999   (p_effective_date               in date
1000   ,p_rec                          in irc_cmp_shd.g_rec_type
1001   ) is
1002 --
1003   l_proc  varchar2(72) := g_package||'update_validate';
1004 --
1005 Begin
1006   hr_utility.set_location('Entering:'||l_proc, 5);
1007   --
1008   -- Call all supporting business operations
1009   --
1010   --
1011   -- EDIT_HERE: As this table does not have a mandatory business_group_id
1012   -- column, ensure client_info is populated by calling a suitable
1013   -- ???_???_bus.set_security_group_id procedure, or add one of the following
1014   -- comments:
1015   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
1016   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
1017   --
1018   -- Validate Dependent Attributes
1019   --
1020   chk_non_updateable_args
1021     (p_effective_date              => p_effective_date
1022       ,p_rec              => p_rec
1023     );
1024   --
1025   --
1026   -- irc_cmp_bus.chk_ddf(p_rec);
1027   --
1028   -- irc_cmp_bus.chk_df(p_rec);
1029   --
1030   irc_cmp_bus.insert_update_validate(p_effective_date, p_rec);
1031 
1032   hr_utility.set_location(' Leaving:'||l_proc, 10);
1033 End update_validate;
1034 --
1035 -- ----------------------------------------------------------------------------
1036 -- |---------------------------< delete_validate >----------------------------|
1037 -- ----------------------------------------------------------------------------
1038 Procedure delete_validate
1039   (p_rec                          in irc_cmp_shd.g_rec_type
1040   ) is
1041 --
1042   l_proc  varchar2(72) := g_package||'delete_validate';
1043 --
1044 Begin
1045   hr_utility.set_location('Entering:'||l_proc, 5);
1046   --
1047   -- Call all supporting business operations
1048   --
1049   hr_utility.set_location(' Leaving:'||l_proc, 10);
1050 End delete_validate;
1051 --
1052 end irc_cmp_bus;