DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PUM_BUS

Source


1 Package Body ben_pum_bus as
2 /* $Header: bepumrhi.pkb 120.0 2005/05/28 11:26:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pum_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_pop_up_messages_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 --   This procedure is used to check that the primary key for the table
16 --   is created properly. It should be null on insert and
17 --   should not be able to be updated.
18 --
19 -- Pre Conditions
20 --   None.
21 --
22 -- In Parameters
23 --   pop_up_messages_id PK of record being inserted or updated.
24 --   object_version_number Object version number of record being
25 --                         inserted or updated.
26 --
27 -- Post Success
28 --   Processing continues
29 --
30 -- Post Failure
31 --   Errors handled by the procedure
32 --
33 -- Access Status
34 --   Internal table handler use only.
35 --
36 Procedure chk_pop_up_messages_id(p_pop_up_messages_id                in number,
37                            p_object_version_number       in number) is
38   --
39   l_proc         varchar2(72) := g_package||'chk_pop_up_messages_id';
40   l_api_updating boolean;
41   --
42 Begin
43   --
44   hr_utility.set_location('Entering:'||l_proc, 5);
45   --
46   l_api_updating := ben_pum_shd.api_updating
47     (p_pop_up_messages_id                => p_pop_up_messages_id,
48      p_object_version_number       => p_object_version_number);
49   --
50   if (l_api_updating
51      and nvl(p_pop_up_messages_id,hr_api.g_number)
52      <>  ben_pum_shd.g_old_rec.pop_up_messages_id) then
53     --
54     -- raise error as PK has changed
55     --
56     ben_pum_shd.constraint_error('BEN_POP_UP_MESSAGES_PK');
57     --
58   elsif not l_api_updating then
59     --
60     -- check if PK is null
61     --
62     if p_pop_up_messages_id is not null then
63       --
64       -- raise error as PK is not null
65       --
66       ben_pum_shd.constraint_error('BEN_POP_UP_MESSAGES_PK');
67       --
68     end if;
69     --
70   end if;
71   --
72   hr_utility.set_location('Leaving:'||l_proc, 10);
73   --
74 End chk_pop_up_messages_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_no_formula_flag >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 --   This procedure is used to check that the lookup value is valid.
82 --
83 -- Pre Conditions
84 --   None.
85 --
86 -- In Parameters
87 --   pop_up_messages_id PK of record being inserted or updated.
88 --   no_formula_flag Value of lookup code.
89 --   effective_date effective date
90 --   object_version_number Object version number of record being
91 --                         inserted or updated.
92 --
93 -- Post Success
94 --   Processing continues
95 --
96 -- Post Failure
97 --   Error handled by procedure
98 --
99 -- Access Status
100 --   Internal table handler use only.
101 --
102 Procedure chk_no_formula_flag(p_pop_up_messages_id                in number,
103                             p_no_formula_flag               in varchar2,
104                             p_effective_date              in date,
105                             p_object_version_number       in number) is
106   --
107   l_proc         varchar2(72) := g_package||'chk_no_formula_flag';
108   l_api_updating boolean;
109   --
110 Begin
111   --
112   hr_utility.set_location('Entering:'||l_proc, 5);
113   --
114   l_api_updating := ben_pum_shd.api_updating
115     (p_pop_up_messages_id                => p_pop_up_messages_id,
116      p_object_version_number       => p_object_version_number);
117   --
118   if (l_api_updating
119       and p_no_formula_flag
120       <> nvl(ben_pum_shd.g_old_rec.no_formula_flag,hr_api.g_varchar2)
121       or not l_api_updating)
122       and p_no_formula_flag is not null then
123     --
124     -- check if value of lookup falls within lookup type.
125     --
126     if hr_api.not_exists_in_hr_lookups
127           (p_lookup_type    => 'YES_NO',
128            p_lookup_code    => p_no_formula_flag,
129            p_effective_date => p_effective_date) then
130       --
131       -- raise error as does not exist as lookup
132       --
133       fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
134       fnd_message.set_token('FIELD','p_no_formula_flag');
135       fnd_message.set_token('TYPE','YES_NO');
136       fnd_message.raise_error;
137       --
138     end if;
139     --
140   end if;
141   --
142   hr_utility.set_location('Leaving:'||l_proc,10);
143   --
144 end chk_no_formula_flag;
145 --
146 -- ----------------------------------------------------------------------------
147 -- |------< chk_formula_id >------|
148 -- ----------------------------------------------------------------------------
149 --
150 -- Description
151 --   This procedure is used to check that the Formula Id is valid.
152 --
153 -- Pre Conditions
154 --   None.
155 --
156 -- In Parameters
157 --   pop_up_messages_id PK of record being inserted or updated.
158 --   formula_id Value of formula rule id.
159 --   effective_date effective date
160 --   object_version_number Object version number of record being
161 --                                      inserted or updated.
162 --
163 -- Post Success
164 --   Processing continues
165 --
166 -- Post Failure
167 --   Error handled by procedure
168 --
169 -- Access Status
170 --   Internal table handler use only.
171 --
172 Procedure chk_formula_id(p_pop_up_messages_id              in number,
173                              p_formula_id                  in number,
174                              p_business_group_id           in number,
175                              p_effective_date              in date,
176                              p_object_version_number       in number) is
177   --
178   l_proc         varchar2(72) := g_package||'chk_formula_id';
179   l_api_updating boolean;
180   l_dummy        varchar2(1);
181   --
182   cursor c1 is
183     select null
184     from   ff_formulas_f ff
185            ,per_business_groups pbg
186     where  ff.formula_id = p_formula_id
187     and    ff.formula_type_id in ( -508, -520, -521,-522,-523,-524,-525)
188     and    pbg.business_group_id = p_business_group_id
189     and    nvl(ff.business_group_id, p_business_group_id) =
190                p_business_group_id
191     and    nvl(ff.legislation_code, pbg.legislation_code) =
192                pbg.legislation_code
193     and    p_effective_date
194            between ff.effective_start_date
195            and     ff.effective_end_date;
196   --
197 Begin
198   --
199   hr_utility.set_location('Entering:'||l_proc, 5);
200   --
201   l_api_updating := ben_pum_shd.api_updating
202     (p_pop_up_messages_id          => p_pop_up_messages_id,
203      p_object_version_number       => p_object_version_number);
204   --
205   if (l_api_updating
206       and nvl(p_formula_id,hr_api.g_number)
207       <> ben_pum_shd.g_old_rec.formula_id
208       or not l_api_updating)
209       and p_formula_id is not null then
210     --
211     -- check if value of formula id is valid.
212     --
213     open c1;
214       --
215       -- fetch value from cursor if it returns a record then the
216       -- formula is valid otherwise its invalid
217       --
218       fetch c1 into l_dummy;
219       if c1%notfound then
220         --
221         close c1;
222         --
223         -- raise error
224         --
225         fnd_message.set_name('BEN','BEN_91471_FORMULA_NOT_FOUND');
226         fnd_message.set_token('ID',p_formula_id);
227         fnd_message.set_token('TYPE_ID',-508);
228         fnd_message.raise_error;
229         --
230       end if;
231       --
232     close c1;
233     --
234   end if;
235   --
236   hr_utility.set_location('Leaving:'||l_proc,10);
237   --
238 end chk_formula_id;
239 --
240 --
241 -- ----------------------------------------------------------------------------
242 -- |------< chk_function_name >------|
243 -- ----------------------------------------------------------------------------
244 Procedure chk_function_name(p_pop_up_messages_id         in number,
245                              p_function_name              in varchar2,
246                              p_effective_date             in date,
247                              p_object_version_number      in number) is
248   --
249   l_proc         varchar2(72) := g_package||'chk_function_name';
250   l_api_updating boolean;
251   l_dummy        varchar2(1);
252   --
253   cursor c1 is
254     select null
255     from   fnd_form_functions_vl ff
256     where  ff.function_name = p_function_name;
257     /*     ff.application_id = 810 */
258   --
259 Begin
260   --
261   hr_utility.set_location('Entering:'||l_proc, 5);
262   --
263   l_api_updating := ben_pum_shd.api_updating
264     (p_pop_up_messages_id         => p_pop_up_messages_id,
265      p_object_version_number      => p_object_version_number);
266   --
267   if (l_api_updating
268       and nvl(p_function_name,hr_api.g_varchar2)
269       <> ben_pum_shd.g_old_rec.function_name
270       or not l_api_updating)
271       and p_function_name is not null then
272     --
273     -- check if value of function name is valid.
274     --
275     open c1;
276       --
277       -- fetch value from cursor if it returns a record then the
278       -- formula is valid otherwise its invalid
279       --
280       fetch c1 into l_dummy;
281       if c1%notfound then
282         --
283         close c1;
284         --
285         -- raise error
286         --
287         hr_utility.set_message(801,'FUNCTION_DOES_NOT_EXIST');
288         hr_utility.raise_error;
289         --
290       end if;
291       --
292     close c1;
293     --
294   end if;
295   --
296   hr_utility.set_location('Leaving:'||l_proc,10);
297   --
298 end chk_function_name;
299 --
300 
301 -- ----------------------------------------------------------------------------
302 -- |------< chk_message >------|
303 -- ----------------------------------------------------------------------------
304 Procedure chk_message(p_pop_up_messages_id         in number,
305                              p_message              in varchar2,
306                              p_effective_date             in date,
307                              p_object_version_number      in number) is
308   --
309   l_proc         varchar2(72) := g_package||'chk_message';
310   l_api_updating boolean;
311   l_dummy        varchar2(1);
312   --
313   cursor c1 is
314     select null
315     from   fnd_new_messages mes
316     where  mes.message_name = p_message;
317     /*     ff.application_id = 810 */
318   --
319 Begin
320   --
321   hr_utility.set_location('Entering:'||l_proc, 5);
322   --
323   l_api_updating := ben_pum_shd.api_updating
324     (p_pop_up_messages_id         => p_pop_up_messages_id,
325      p_object_version_number      => p_object_version_number);
326   --
327   if (l_api_updating
328       and nvl(p_message,hr_api.g_varchar2)
329       <> ben_pum_shd.g_old_rec.message
330       or not l_api_updating)
331       and p_message is not null then
332     --
333     -- check if value of function name is valid.
334     --
335     open c1;
336       --
337       -- fetch value from cursor if it returns a record then the
338       -- formula is valid otherwise its invalid
339       --
340       fetch c1 into l_dummy;
341       if c1%notfound then
342         --
343         close c1;
344         --
345         -- raise error
346         --
347         hr_utility.set_message(801,'MESSAGE_DOES_NOT_EXIST');
348         hr_utility.raise_error;
349         --
350       end if;
351       --
352     close c1;
353     --
354   end if;
355   --
356   hr_utility.set_location('Leaving:'||l_proc,10);
357   --
358 end chk_message;
359 
360 -- ----------------------------------------------------------------------------
361 -- |------< chk_block_name >------|
362 -- ----------------------------------------------------------------------------
363 --
364 -- Description
365 --   This procedure is used to check that the lookup value is valid.
366 --
367 Procedure chk_block_name(p_pop_up_messages_id                in number,
368                             p_block_name               in varchar2,
369                             p_effective_date              in date,
370                             p_object_version_number       in number) is
371   --
372   l_proc         varchar2(72) := g_package||'chk_block_name';
373   l_api_updating boolean;
374   --
375 Begin
376   --
377   hr_utility.set_location('Entering:'||l_proc, 5);
378   --
379   l_api_updating := ben_pum_shd.api_updating
380     (p_pop_up_messages_id                => p_pop_up_messages_id,
381      p_object_version_number       => p_object_version_number);
382   --
383   if (l_api_updating
384       and p_block_name
385       <> nvl(ben_pum_shd.g_old_rec.block_name,hr_api.g_varchar2)
386       or not l_api_updating)
387       and p_block_name is not null then
388     --
389     -- check if value of lookup falls within lookup type.
390     --
391     if hr_api.not_exists_in_hr_lookups
392           (p_lookup_type    => 'BEN_BLOCK',
393            p_lookup_code    => p_block_name,
394            p_effective_date => p_effective_date) then
395       --
396       -- raise error as does not exist as lookup
397       --
398       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
399       hr_utility.raise_error;
400       --
401     end if;
402     --
403   end if;
404   --
405   hr_utility.set_location('Leaving:'||l_proc,10);
406   --
407 end chk_block_name;
408 --
409 -- ----------------------------------------------------------------------------
410 -- |------< chk_field_name >------|
411 -- ----------------------------------------------------------------------------
412 --
413 -- Description
414 --   This procedure is used to check that the lookup value is valid.
415 --
416 Procedure chk_field_name(p_pop_up_messages_id                in number,
417                             p_field_name               in varchar2,
418                             p_effective_date              in date,
419                             p_object_version_number       in number) is
420   --
421   l_proc         varchar2(72) := g_package||'chk_field_name';
422   l_api_updating boolean;
423   --
424 Begin
425   --
426   hr_utility.set_location('Entering:'||l_proc, 5);
427   --
428   l_api_updating := ben_pum_shd.api_updating
429     (p_pop_up_messages_id                => p_pop_up_messages_id,
430      p_object_version_number       => p_object_version_number);
431   --
435       or not l_api_updating)
432   if (l_api_updating
433       and p_field_name
434       <> nvl(ben_pum_shd.g_old_rec.field_name,hr_api.g_varchar2)
436       and p_field_name is not null then
437     --
438     -- check if value of lookup falls within lookup type.
439     --
440     if hr_api.not_exists_in_hr_lookups
441           (p_lookup_type    => 'BEN_FIELD',
442            p_lookup_code    => p_field_name,
443            p_effective_date => p_effective_date) then
444       --
445       -- raise error as does not exist as lookup
446       --
447       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
448       hr_utility.raise_error;
449       --
450     end if;
451     --
452   end if;
453   --
454   hr_utility.set_location('Leaving:'||l_proc,10);
455   --
456 end chk_field_name;
457 --
458 -- ----------------------------------------------------------------------------
459 -- |------< chk_event_name >------|
460 -- ----------------------------------------------------------------------------
461 --
462 -- Description
463 --   This procedure is used to check that the lookup value is valid.
464 --
465 Procedure chk_event_name(p_pop_up_messages_id                in number,
466                             p_event_name               in varchar2,
467                             p_effective_date              in date,
468                             p_object_version_number       in number) is
469   --
470   l_proc         varchar2(72) := g_package||'chk_event_name';
471   l_api_updating boolean;
472   --
473 Begin
474   --
475   hr_utility.set_location('Entering:'||l_proc, 5);
476   --
477   l_api_updating := ben_pum_shd.api_updating
478     (p_pop_up_messages_id                => p_pop_up_messages_id,
479      p_object_version_number       => p_object_version_number);
480   --
481   if (l_api_updating
482       and p_event_name
483       <> nvl(ben_pum_shd.g_old_rec.event_name,hr_api.g_varchar2)
484       or not l_api_updating)
485       and p_event_name is not null then
486     --
487     -- check if value of lookup falls within lookup type.
488     --
489     if hr_api.not_exists_in_hr_lookups
490           (p_lookup_type    => 'BEN_EVENT',
491            p_lookup_code    => p_event_name,
492            p_effective_date => p_effective_date) then
493       --
494       -- raise error as does not exist as lookup
495       --
496       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
497       hr_utility.raise_error;
498       --
499     end if;
500     --
501   end if;
502   --
503   hr_utility.set_location('Leaving:'||l_proc,10);
504   --
505 end chk_event_name;
506 --
507 -- ----------------------------------------------------------------------------
508 -- |------< chk_message_type >------|
509 -- ----------------------------------------------------------------------------
510 --
511 -- Description
512 --   This procedure is used to check that the lookup value is valid.
513 --
514 Procedure chk_message_type(p_pop_up_messages_id                in number,
515                             p_message_type               in varchar2,
516                             p_effective_date              in date,
517                             p_object_version_number       in number) is
518   --
519   l_proc         varchar2(72) := g_package||'chk_message_type';
520   l_api_updating boolean;
521   --
522 Begin
523   --
524   hr_utility.set_location('Entering:'||l_proc, 5);
525   --
526   l_api_updating := ben_pum_shd.api_updating
527     (p_pop_up_messages_id                => p_pop_up_messages_id,
528      p_object_version_number       => p_object_version_number);
529   --
530   if (l_api_updating
531       and p_message_type
532       <> nvl(ben_pum_shd.g_old_rec.message_type,hr_api.g_varchar2)
533       or not l_api_updating)
534       and p_message_type is not null then
535     --
536     -- check if value of lookup falls within lookup type.
537     --
538     if hr_api.not_exists_in_hr_lookups
539           (p_lookup_type    => 'BEN_MESSAGE_TYP',
540            p_lookup_code    => p_message_type,
541            p_effective_date => p_effective_date) then
542       --
543       -- raise error as does not exist as lookup
544       --
545       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
546       hr_utility.raise_error;
547       --
548     end if;
549     --
550   end if;
551   --
552   hr_utility.set_location('Leaving:'||l_proc,10);
553   --
554 end chk_message_type;
555 --
556 -- ----------------------------------------------------------------------------
557 -- |------< chk_start_end_date >------|
558 -- ----------------------------------------------------------------------------
559 --
560 --
561 Procedure chk_start_end_date(p_pop_up_messages_id          in number,
562                            p_start_date                  in date,
563                            p_end_date                    in date,
564                            p_object_version_number       in number) is
565   --
566   l_proc         varchar2(72) := g_package||'chk_start_end_date';
567   l_api_updating boolean;
568   --
569 Begin
570   --
574     (p_pop_up_messages_id                => p_pop_up_messages_id,
571   hr_utility.set_location('Entering:'||l_proc, 5);
572   --
573   l_api_updating := ben_pum_shd.api_updating
575      p_object_version_number       => p_object_version_number);
576   --
577   if p_start_date > p_end_date
578   then
579       --
580       -- raise error as does not exist as lookup
581       --
582       -- hr_utility.set_message(801,'BEN_9?????_START_END_DATE');
583       -- changed the Message Name -- by -- ssarkar
584 
585       hr_utility.set_message(801,'BEN_92503_END_DT_GRTR_STRT_DT');
586       hr_utility.raise_error;
587       --
588   end if;
589   --
590   hr_utility.set_location('Leaving:'||l_proc,10);
591   --
592 end chk_start_end_date;
593 
594 -- ---------------------------< Bug 3881942 >---------------------------------
595 -- |-----------< chk_blk_fld_evnt >----------|
596 -- ---------------------------------------------------------------------------
597 --
598 -- Description
599 -- This Procedure is to check that
600 --  1. If p_event_name is any of 'on-commit','key-exit','when-new-form-instance'
601 --     then
602 --     p_block_name is null and p_field_name is null.
603 --  2.If p_event_name is 'post-query'
604 --    then
605 --    p_field_name  is null.
606 --
607 Procedure chk_blk_fld_evnt(p_block_name in varchar2,
608                            p_field_name in varchar2,
609                            p_event_name in varchar2) is
610 
611 --
612 l_proc  varchar2(72) := g_package||'chk_blk_fld_evnt';
613 --
614 Begin
615 --
616   hr_utility.set_location('Entering:'||l_proc,5);
617 
618   --
619   if ( p_event_name in ('ON-COMMIT','KEY-EXIT','WHEN-NEW-FORM-INSTANCE') )
620      and (p_block_name is not null or p_field_name is not null)
621      then
622      fnd_message.set_name('BEN','BEN_94071_BLK_FLD_EVNT');
623      fnd_message.set_token('EVENT',hr_general.decode_lookup('BEN_EVENT',p_event_name));
624      fnd_message.raise_error;
625   end if;
626 --
627   if (p_event_name = 'POST-QUERY') and (p_field_name is not null)
628    then
629    fnd_message.set_name('BEN','BEN_94072_FLD_EVNT');
630    fnd_message.set_token('EVENT',hr_general.decode_lookup('BEN_EVENT',p_event_name));
631    fnd_message.raise_error;
632    end if;
633 --
634    hr_utility.set_location('Leaving'||l_proc,10);
635 end chk_blk_fld_evnt ;
636 --
637 --
638 
639 --
640 -- Bug No: 3942628
641 --
642 -- ----------------------------------------------------------------------------
643 -- |------< chk_pop_name >------|
644 -- ----------------------------------------------------------------------------
645 Procedure chk_pop_name(p_pop_up_messages_id         in number,
646                        p_pop_name                   in varchar2,
647                        p_effective_date             in date,
648                        p_business_group_id          in number,
649                        p_object_version_number      in number) is
650   --
651   l_proc         varchar2(72) := g_package||'chk_pop_name';
652   l_api_updating boolean;
653   l_dummy        varchar2(1);
654   --
655 cursor c1 is
656   select null
657    from   ben_pop_up_messages pum
658    where  pum.business_group_id +0 = p_business_group_id
659    and    pum.pop_up_messages_id <> nvl(p_pop_up_messages_id,-1)
660    and    lower(pum.pop_name) = lower(p_pop_name);
661   --
662 Begin
663   --
664   hr_utility.set_location('Entering:'||l_proc, 5);
665   --
666   l_api_updating := ben_pum_shd.api_updating
667     (p_pop_up_messages_id         => p_pop_up_messages_id,
668      p_object_version_number      => p_object_version_number);
669   --
670   if (l_api_updating
671       and nvl(p_pop_name,hr_api.g_varchar2)
672       <> ben_pum_shd.g_old_rec.pop_name
673       or not l_api_updating) then
674     --
675     -- Check if pop name is unique.
676     --
677     open c1;
678       --
679       fetch c1 into l_dummy;
680       if c1%found then
681         --
682         close c1;
683         --
684         -- raise an error as this pop-up name has already been used
685         --
686         fnd_message.set_name('BEN','BEN_94089_POP_NAME_UNIQ');
687         fnd_message.raise_error;
688         --
689       end if;
690       --
691     close c1;
692     --
693   end if;
694   --
695   hr_utility.set_location('Leaving:'||l_proc,10);
696   --
697 end chk_pop_name;
698 --
699 --
700 -- ----------------------------------------------------------------------------
701 -- |---------------------------< insert_validate >----------------------------|
702 -- ----------------------------------------------------------------------------
703 Procedure insert_validate(p_rec in ben_pum_shd.g_rec_type
704                          ,p_effective_date in date) is
705 --
706   l_proc  varchar2(72) := g_package||'insert_validate';
707 --
708 Begin
709   hr_utility.set_location('Entering:'||l_proc, 5);
710   --
711   -- Call all supporting business operations
712   --
713   --
714   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
715   --
719   --
716   chk_pop_up_messages_id
717   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
718    p_object_version_number => p_rec.object_version_number);
720   chk_no_formula_flag
721   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
722    p_no_formula_flag         => p_rec.no_formula_flag,
723    p_effective_date        => p_effective_date,
724    p_object_version_number => p_rec.object_version_number);
725   --
726   chk_formula_id
727   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
728    p_formula_id                  => p_rec.formula_id,
729    p_business_group_id           => p_rec.business_group_id,
730    p_effective_date              => p_effective_date,
731    p_object_version_number       => p_rec.object_version_number);
732   --
733   chk_function_name
734   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
735    p_function_name               => p_rec.function_name,
736    p_effective_date              => p_effective_date,
737    p_object_version_number       => p_rec.object_version_number);
738   --
739   chk_message
740   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
741    p_message                     => p_rec.message,
742    p_effective_date              => p_effective_date,
743    p_object_version_number       => p_rec.object_version_number);
744   --
745   chk_block_name
746   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
747    p_block_name                  => p_rec.block_name,
748    p_effective_date              => p_effective_date,
749    p_object_version_number       => p_rec.object_version_number);
750   --
751   chk_field_name
752   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
753    p_field_name                  => p_rec.field_name,
754    p_effective_date              => p_effective_date,
755    p_object_version_number       => p_rec.object_version_number);
756   --
757   chk_event_name
758   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
759    p_event_name                  => p_rec.event_name,
760    p_effective_date              => p_effective_date,
761    p_object_version_number       => p_rec.object_version_number);
762 
763   --3881942
764   chk_blk_fld_evnt
765   (p_block_name                  => p_rec.block_name,
766    p_field_name                  => p_rec.field_name,
767    p_event_name                  => p_rec.event_name);
768 
769   --
770   chk_message_type
771   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
772    p_message_type                => p_rec.message_type,
773    p_effective_date              => p_effective_date,
774    p_object_version_number       => p_rec.object_version_number);
775   --
776   chk_start_end_date
777   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
778    p_start_date                  => p_rec.start_date,
779    p_end_date                    => p_rec.end_date,
780    p_object_version_number       => p_rec.object_version_number);
781   --
782   -- Bug No: 3942628
783   --
784   chk_pop_name
785   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
786    p_pop_name                    => p_rec.pop_name,
787    p_effective_date              => p_effective_date,
788    p_business_group_id           => p_rec.business_group_id,
789    p_object_version_number       => p_rec.object_version_number);
790   -- Validate Bus Grp
791   hr_utility.set_location(' Leaving:'||l_proc, 10);
792 End insert_validate;
793 --
794 -- ----------------------------------------------------------------------------
795 -- |---------------------------< update_validate >----------------------------|
796 -- ----------------------------------------------------------------------------
797 Procedure update_validate(p_rec in ben_pum_shd.g_rec_type
798                          ,p_effective_date in date) is
799 --
800   l_proc  varchar2(72) := g_package||'update_validate';
801 --
802 Begin
803   hr_utility.set_location('Entering:'||l_proc, 5);
804   --
805   -- Call all supporting business operations
806   --
807   --
808   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
809   --
810   chk_pop_up_messages_id
811   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
812    p_object_version_number => p_rec.object_version_number);
813   --
814   chk_no_formula_flag
815   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
816    p_no_formula_flag         => p_rec.no_formula_flag,
817    p_effective_date        => p_effective_date,
818    p_object_version_number => p_rec.object_version_number);
819   --
820   chk_formula_id
821   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
822    p_formula_id                  => p_rec.formula_id,
823    p_business_group_id           => p_rec.business_group_id,
824    p_effective_date              => p_effective_date,
825    p_object_version_number       => p_rec.object_version_number);
826   --
827   chk_function_name
828   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
829    p_function_name               => p_rec.function_name,
830    p_effective_date              => p_effective_date,
831    p_object_version_number       => p_rec.object_version_number);
832   --
833   chk_message
834   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
835    p_message                     => p_rec.message,
836    p_effective_date              => p_effective_date,
837    p_object_version_number       => p_rec.object_version_number);
838   --
839   chk_block_name
840   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
841    p_block_name                  => p_rec.block_name,
842    p_effective_date              => p_effective_date,
843    p_object_version_number       => p_rec.object_version_number);
844   --
845   chk_field_name
846   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
847    p_field_name                  => p_rec.field_name,
848    p_effective_date              => p_effective_date,
849    p_object_version_number       => p_rec.object_version_number);
850   --
851   chk_event_name
852   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
853    p_event_name                  => p_rec.event_name,
854    p_effective_date              => p_effective_date,
855    p_object_version_number       => p_rec.object_version_number);
856 
857  -- 3881942
858   chk_blk_fld_evnt
859   (p_block_name                  => p_rec.block_name,
860    p_field_name                  => p_rec.field_name,
861    p_event_name                  => p_rec.event_name);
862 
863 --
864   chk_message_type
865   (p_pop_up_messages_id         => p_rec.pop_up_messages_id,
866    p_message_type                => p_rec.message_type,
867    p_effective_date              => p_effective_date,
868    p_object_version_number       => p_rec.object_version_number);
869   --
870   chk_start_end_date
871   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
872    p_start_date                  => p_rec.start_date,
873    p_end_date                    => p_rec.end_date,
874    p_object_version_number       => p_rec.object_version_number);
875   --
876   -- Bug No: 3942628
877   --
878   chk_pop_name
879   (p_pop_up_messages_id          => p_rec.pop_up_messages_id,
880    p_pop_name                    => p_rec.pop_name,
881    p_effective_date              => p_effective_date,
882    p_business_group_id           => p_rec.business_group_id,
883    p_object_version_number       => p_rec.object_version_number);
884   --
885   hr_utility.set_location(' Leaving:'||l_proc, 10);
886 End update_validate;
887 --
888 -- ----------------------------------------------------------------------------
889 -- |---------------------------< delete_validate >----------------------------|
890 -- ----------------------------------------------------------------------------
891 Procedure delete_validate(p_rec in ben_pum_shd.g_rec_type
892                          ,p_effective_date in date) is
893 --
894   l_proc  varchar2(72) := g_package||'delete_validate';
895 --
896 Begin
897   hr_utility.set_location('Entering:'||l_proc, 5);
898   --
899   -- Call all supporting business operations
900   --
901   hr_utility.set_location(' Leaving:'||l_proc, 10);
902 End delete_validate;
903 --
904 --
905 --  ---------------------------------------------------------------------------
906 --  |---------------------< return_legislation_code >-------------------------|
907 --  ---------------------------------------------------------------------------
908 --
909 function return_legislation_code
910   (p_pop_up_messages_id in number) return varchar2 is
911   --
912   -- Declare cursor
913   --
914   cursor csr_leg_code is
915     select a.legislation_code
916     from   per_business_groups a,
917            ben_pop_up_messages b
918     where b.pop_up_messages_id      = p_pop_up_messages_id
919     and   a.business_group_id = b.business_group_id;
920   --
921   -- Declare local variables
922   --
923   l_legislation_code  varchar2(150);
924   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
925   --
926 begin
927   --
928   hr_utility.set_location('Entering:'|| l_proc, 10);
929   --
930   -- Ensure that all the mandatory parameter are not null
931   --
932   hr_api.mandatory_arg_error(p_api_name       => l_proc,
933                              p_argument       => 'pop_up_messages_id',
934                              p_argument_value => p_pop_up_messages_id);
935   --
936   open csr_leg_code;
937     --
938     fetch csr_leg_code into l_legislation_code;
939     --
940     if csr_leg_code%notfound then
941       --
942       close csr_leg_code;
943       --
944       -- The primary key is invalid therefore we must error
945       --
946       hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
947       hr_utility.raise_error;
948       --
949     end if;
950     --
951   close csr_leg_code;
952   --
953   hr_utility.set_location(' Leaving:'|| l_proc, 20);
954   --
955   return l_legislation_code;
956   --
957 end return_legislation_code;
958 --
959 end ben_pum_bus;