DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RFE_BUS

Source


1 Package Body pqh_rfe_bus as
2 /* $Header: pqrferhi.pkb 120.0 2005/10/06 14:54 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_rfe_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_rate_factor_on_elmnt_id     number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_rate_factor_on_elmnt_id              in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare cursor
26   --
27   cursor csr_sec_grp is
28     select pbg.security_group_id,
29            pbg.legislation_code
30       from per_business_groups_perf pbg
31          , pqh_rate_factor_on_elmnts rfe
32      where rfe.rate_factor_on_elmnt_id = p_rate_factor_on_elmnt_id
33        and pbg.business_group_id (+) = rfe.business_group_id;
34   --
35   -- Declare local variables
36   --
37   l_security_group_id number;
38   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
39   l_legislation_code  varchar2(150);
40   --
41 begin
42   --
43   hr_utility.set_location('Entering:'|| l_proc, 10);
44   --
45   -- Ensure that all the mandatory parameter are not null
46   --
47   hr_api.mandatory_arg_error
48     (p_api_name           => l_proc
49     ,p_argument           => 'rate_factor_on_elmnt_id'
50     ,p_argument_value     => p_rate_factor_on_elmnt_id
51     );
52   --
53   open csr_sec_grp;
54   fetch csr_sec_grp into l_security_group_id
55                        , l_legislation_code;
56   --
57   if csr_sec_grp%notfound then
58      --
59      close csr_sec_grp;
60      --
61      -- The primary key is invalid therefore we must error
62      --
63      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
64      hr_multi_message.add
65        (p_associated_column1
66         => nvl(p_associated_column1,'RATE_FACTOR_ON_ELMNT_ID')
67        );
68      --
69   else
70     close csr_sec_grp;
71     --
72     -- Set the security_group_id in CLIENT_INFO
73     --
74     hr_api.set_security_group_id
75       (p_security_group_id => l_security_group_id
76       );
77     --
78     -- Set the sessions legislation context in HR_SESSION_DATA
79     --
80     hr_api.set_legislation_context(l_legislation_code);
81   end if;
82   --
83   hr_utility.set_location(' Leaving:'|| l_proc, 20);
84   --
85 end set_security_group_id;
86 --
87 --  ---------------------------------------------------------------------------
88 --  |---------------------< return_legislation_code >-------------------------|
89 --  ---------------------------------------------------------------------------
90 --
91 Function return_legislation_code
92   (p_rate_factor_on_elmnt_id              in     number
93   )
94   Return Varchar2 Is
95   --
96   -- Declare cursor
97   --
98   cursor csr_leg_code is
99     select pbg.legislation_code
100       from per_business_groups_perf pbg
101          , pqh_rate_factor_on_elmnts rfe
102      where rfe.rate_factor_on_elmnt_id = p_rate_factor_on_elmnt_id
103        and pbg.business_group_id (+) = rfe.business_group_id;
104   --
105   -- Declare local variables
106   --
107   l_legislation_code  varchar2(150);
108   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
109   --
110 Begin
111   --
112   hr_utility.set_location('Entering:'|| l_proc, 10);
113   --
114   -- Ensure that all the mandatory parameter are not null
115   --
116   hr_api.mandatory_arg_error
117     (p_api_name           => l_proc
118     ,p_argument           => 'rate_factor_on_elmnt_id'
119     ,p_argument_value     => p_rate_factor_on_elmnt_id
120     );
121   --
122   if ( nvl(pqh_rfe_bus.g_rate_factor_on_elmnt_id, hr_api.g_number)
123        = p_rate_factor_on_elmnt_id) then
124     --
125     -- The legislation code has already been found with a previous
126     -- call to this function. Just return the value in the global
127     -- variable.
128     --
129     l_legislation_code := pqh_rfe_bus.g_legislation_code;
130     hr_utility.set_location(l_proc, 20);
131   else
132     --
133     -- The ID is different to the last call to this function
134     -- or this is the first call to this function.
135     --
136     open csr_leg_code;
137     fetch csr_leg_code into l_legislation_code;
138     --
139     if csr_leg_code%notfound then
140       --
141       -- The primary key is invalid therefore we must error
142       --
143       close csr_leg_code;
144       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
145       fnd_message.raise_error;
146     end if;
147     hr_utility.set_location(l_proc,30);
148     --
149     -- Set the global variables so the values are
150     -- available for the next call to this function.
151     --
152     close csr_leg_code;
153     pqh_rfe_bus.g_rate_factor_on_elmnt_id     := p_rate_factor_on_elmnt_id;
154     pqh_rfe_bus.g_legislation_code  := l_legislation_code;
155   end if;
156   hr_utility.set_location(' Leaving:'|| l_proc, 40);
157   return l_legislation_code;
158 end return_legislation_code;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |-----------------------< chk_non_updateable_args >------------------------|
162 -- ----------------------------------------------------------------------------
163 -- {Start Of Comments}
164 --
165 -- Description:
166 --   This procedure is used to ensure that non updateable attributes have
167 --   not been updated. If an attribute has been updated an error is generated.
168 --
169 -- Pre Conditions:
170 --   g_old_rec has been populated with details of the values currently in
171 --   the database.
172 --
173 -- In Arguments:
174 --   p_rec has been populated with the updated values the user would like the
175 --   record set to.
176 --
177 -- Post Success:
178 --   Processing continues if all the non updateable attributes have not
179 --   changed.
180 --
181 -- Post Failure:
182 --   An application error is raised if any of the non updatable attributes
183 --   have been altered.
184 --
185 -- {End Of Comments}
186 -- ----------------------------------------------------------------------------
187 Procedure chk_non_updateable_args
188   (p_effective_date               in date
189   ,p_rec in pqh_rfe_shd.g_rec_type
190   ) IS
191 --
192   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
193 --
194 Begin
195   --
196   -- Only proceed with the validation if a row exists for the current
197   -- record in the HR Schema.
198   --
199   IF NOT pqh_rfe_shd.api_updating
200       (p_rate_factor_on_elmnt_id           => p_rec.rate_factor_on_elmnt_id
201       ,p_object_version_number             => p_rec.object_version_number
202       ) THEN
203      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
204      fnd_message.set_token('PROCEDURE ', l_proc);
205      fnd_message.set_token('STEP ', '5');
206      fnd_message.raise_error;
207   END IF;
208   --
209   -- EDIT_HERE: Add checks to ensure non-updateable args have
210   --            not been updated.
211   --
212   --
213   if nvl(p_rec.business_group_id, hr_api.g_number) <>
214 	     nvl(pqh_rfe_shd.g_old_rec.business_group_id
215 	        ,hr_api.g_number
216 	        ) then
217 	    hr_api.argument_changed_error
218 	      (p_api_name   => l_proc
219 	      ,p_argument   => 'BUSINESS_GROUP_ID'
220 	      ,p_base_table => pqh_rfe_shd.g_tab_nam
221 	      );
222   end if;
223   --
224 End chk_non_updateable_args;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |----------------------< chk_startup_action >------------------------------|
228 -- ----------------------------------------------------------------------------
229 --
230 -- Description:
231 --  This procedure will check that the current action is allowed according
232 --  to the current startup mode.
233 --
234 -- ----------------------------------------------------------------------------
235 PROCEDURE chk_startup_action
236   (p_insert               IN boolean
237   ,p_business_group_id    IN number
238   ,p_legislation_code     IN varchar2
239   ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
240 --
241 BEGIN
242   --
243   -- Call the supporting procedure to check startup mode
244   -- EDIT_HERE: The following call should be edited if certain types of rows
245   -- are not permitted.
246   IF (p_insert) THEN
247     hr_startup_data_api_support.chk_startup_action
248       (p_generic_allowed   => TRUE
249       ,p_startup_allowed   => TRUE
250       ,p_user_allowed      => TRUE
251       ,p_business_group_id => p_business_group_id
252       ,p_legislation_code  => p_legislation_code
253       ,p_legislation_subgroup => p_legislation_subgroup
254       );
255   ELSE
256     hr_startup_data_api_support.chk_upd_del_startup_action
257       (p_generic_allowed   => TRUE
258       ,p_startup_allowed   => TRUE
259       ,p_user_allowed      => TRUE
260       ,p_business_group_id => p_business_group_id
261       ,p_legislation_code  => p_legislation_code
262       ,p_legislation_subgroup => p_legislation_subgroup
263       );
264   END IF;
265   --
266 END chk_startup_action;
267 --
268 
269 
270 
271 -- ----------------------------------------------------------------------------
272 -- |-------------------< chk_rate_factor_val_record_tbl >----------------------------|
273 -- ----------------------------------------------------------------------------
274 Procedure chk_rate_factor_val_record_tbl
275                            (p_rate_factor_on_elmnt_id       in number,
276                             p_rate_factor_val_record_tbl         in varchar2,
277                             p_effective_date              in date,
278                             p_object_version_number       in number) is
279   --
280   l_proc         varchar2(72) := g_package||'chk_rate_factor_val_record_tbl';
281   l_api_updating boolean;
282   --
283 Begin
284   --
285   hr_utility.set_location('Entering:'||l_proc, 10);
286   --
287   l_api_updating := pqh_rfe_shd.api_updating
288     (p_rate_factor_on_elmnt_id       => p_rate_factor_on_elmnt_id,
289      p_object_version_number       => p_object_version_number);
290   --
291   if (l_api_updating
292       and p_rate_factor_val_record_tbl
293       <> nvl(pqh_rfe_shd.g_old_rec.rate_factor_val_record_tbl,hr_api.g_varchar2)
294       or not l_api_updating)
295       and p_rate_factor_val_record_tbl is not null then
296     --
297     -- check if value of lookup falls within lookup type.
298     --
299     if hr_api.not_exists_in_hr_lookups
300           (p_lookup_type    => 'PQH_RBC_RT_FACTOR_ELMNT_TBL',
301            p_lookup_code    => p_rate_factor_val_record_tbl,
302            p_effective_date => p_effective_date) then
303       --
304       -- raise error as does not exist as lookup
305       --
306       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
307       hr_utility.raise_error;
308       --
309     end if;
310     --
311   end if;
312   --
313   hr_utility.set_location('Leaving:'||l_proc,90);
314   --
315 end chk_rate_factor_val_record_tbl;
316 
317 -- ----------------------------------------------------------------------------
318 -- |------< chk_criteria_rate_element_id>------|
319 -- ----------------------------------------------------------------------------
320 
321 -- Description
322 --   This procedure checks that a referenced foreign key actually exists
323 --   in the referenced table.
324 --
325 -- Pre-Conditions
326 --   None.
327 --
328 -- In Parameters
329 --   p_rate_factor_on_elmnt_id PK
330 --   p_criteria_rate_element_id ID of FK column
331 --   p_object_version_number object version number
332 --
333 -- Post Success
334 --   Processing continues
335 --
336 -- Post Failure
337 --   Error raised.
338 --
339 -- Access Status
340 --   Internal table handler use only.
341 --
342 Procedure chk_criteria_rate_element_id (p_rate_factor_on_elmnt_id          in number,
343                             p_criteria_rate_element_id          in number,
344                             p_object_version_number in number) is
345   --
346   l_proc         varchar2(72) := g_package||'chk_criteria_rate_element_id';
347   l_api_updating boolean;
348   l_dummy        varchar2(1);
349   --
350 
351  cursor c1 is
352     select null from   pqh_criteria_rate_elements a
353     where  a.criteria_rate_element_id = p_criteria_rate_element_id;
354 
355   --
356 Begin
357   --
358   hr_utility.set_location('Entering:'||l_proc,10);
359   --
360 
361   l_api_updating := pqh_rfe_shd.api_updating
362      (p_rate_factor_on_elmnt_id            => p_rate_factor_on_elmnt_id,
363       p_object_version_number   => p_object_version_number);
364   --
365   if (l_api_updating
366      and nvl(p_criteria_rate_element_id,hr_api.g_number)
367      <> nvl(pqh_rfe_shd.g_old_rec.criteria_rate_element_id,hr_api.g_number)
368      or not l_api_updating) then
369     --
370     -- check if criteria_rate_element_id value exists in
371     -- pqh_criteria_rate_elements table
372     --
373     open c1;
374       --
375 
376        fetch c1 into l_dummy;
377 
378       if c1%notfound then
379         --
380         close c1;
381         --
382         -- raise error as FK does not relate to PK in pqh_criteria_rate_elements
383         -- table.
384         --
385         pqh_rfe_shd.constraint_error('PQH_RATE_FACTOR_ON_ELMNTS_FK1');
386         --
387       end if;
388       --
389     close c1;
390 
391     --
392     --
393   end if;
394   --
395   hr_utility.set_location('Leaving:'||l_proc,90);
396   --
397 End chk_criteria_rate_element_id;
398 --
399 
400 
401 -- ----------------------------------------------------------------------------
402 -- |------< chk_criteria_rate_factor_id >------|
403 -- ----------------------------------------------------------------------------
404 
405 -- Description
406 --   This procedure checks that a referenced foreign key actually exists
407 --   in the referenced table.
408 --
409 -- Pre-Conditions
410 --   None.
411 --
412 -- In Parameters
413 --   p_rate_factor_on_elmnt_id PK
414 --   p_criteria_rate_factor_id ID of FK column
415 --   p_object_version_number object version number
416 --
417 -- Post Success
418 --   Processing continues
419 --
420 -- Post Failure
421 --   Error raised.
422 --
423 -- Access Status
424 --   Internal table handler use only.
425 --
426 Procedure chk_criteria_rate_factor_id (p_rate_factor_on_elmnt_id          in number,
427                             p_criteria_rate_factor_id          in number,
428                             p_object_version_number in number) is
429   --
430   l_proc         varchar2(72) := g_package||'chk_criteria_rate_factor_id';
431   l_api_updating boolean;
432   l_dummy        varchar2(1);
433   --
434  cursor c1 is
435     select null from   pqh_criteria_rate_factors a
436     where  a.criteria_rate_factor_id = p_criteria_rate_factor_id;
437 
438   --
439 Begin
440   --
441   hr_utility.set_location('Entering:'||l_proc,10);
442   --
443 
444   l_api_updating := pqh_rfe_shd.api_updating
445      (p_rate_factor_on_elmnt_id            => p_rate_factor_on_elmnt_id,
446       p_object_version_number   => p_object_version_number);
447   --
448   if (l_api_updating
449      and nvl(p_criteria_rate_factor_id,hr_api.g_number)
450      <> nvl(pqh_rfe_shd.g_old_rec.criteria_rate_factor_id,hr_api.g_number)
451      or not l_api_updating) then
452     --
453     -- check if criteria_rate_factor_id value exists in
454     -- pqh_criteria_rate_factors table
455     --
456     open c1;
457       --
458 
459        fetch c1 into l_dummy;
460 
461       if c1%notfound then
462         --
463         close c1;
464         --
465         -- raise error as FK does not relate to PK in pqh_criteria_rate_factors
466         -- table.
467         --
468         pqh_rfe_shd.constraint_error('PQH_RATE_FACTOR_ON_ELMNTS_FK2');
469         --
470       end if;
471       --
472     close c1;
473 
474     --
475     --
476   end if;
477   --
478   hr_utility.set_location('Leaving:'||l_proc,90);
479   --
480 End chk_criteria_rate_factor_id;
481 --
482 
483 /*call
484 
485 chk_rate_factor_val_record_col
486   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
487    p_rate_factor_val_record_tbl          => p_rec.rate_factor_val_record_tbl,
488    p_rate_factor_val_record_col          => p_rec.rate_factor_val_record_col,
489         p_criteria_rate_element_id			             =>   p_criteria_rate_element_id,
490    p_object_version_number => p_rec.object_version_number);
491 
492 */
493 -- ----------------------------------------------------------------------------
494 -- |------< chk_rate_factor_val_record_col >------|
495 -- ----------------------------------------------------------------------------
496 
497 -- Description
498 --   This procedure checks that a referenced foreign key actually exists
499 --   in the referenced table.
500 --
501 -- Pre-Conditions
502 --   None.
503 --
504 -- In Parameters
505 --   p_rate_factor_on_elmnt_id PK
506 --   p_object_version_number object version number
507 --
508 -- Post Success
509 --   Processing continues
510 --
511 -- Post Failure
512 --   Error raised.
513 --
514 -- Access Status
515 --   Internal table handler use only.
516 --
517 Procedure chk_rate_factor_val_record_col(p_rate_factor_on_elmnt_id   in number,
518  						     p_rate_factor_val_record_tbl in varchar,
519 						     p_rate_factor_val_record_col in varchar,
520 						     p_criteria_rate_element_id in number,
521 						     p_object_version_number in number) is
522   --
523   l_proc         varchar2(72) := g_package||'chk_rate_factor_val_record_col';
524   l_api_updating boolean;
525   l_success boolean := false;
526   l_dummy        varchar2(200);
527 
528   --
529 /*
530  cursor c1 is
531     select input_value_id from pqh_criteria_rate_elements a
532     where  a.criteria_rate_element_id = p_criteria_rate_element_id;
533 */
534 
535 
536 cursor c1 is
537     select piv.input_value_id input_value_id from pay_input_values_f piv,pqh_criteria_rate_elements cre
538     where cre.criteria_rate_element_id = p_criteria_rate_element_id and piv.element_type_id = cre.element_type_id;
539 
540   --
541 Begin
542   --
543   hr_utility.set_location('Entering:'||l_proc,10);
544   --
545 
546  l_api_updating := pqh_rfe_shd.api_updating
547     (p_rate_factor_on_elmnt_id       => p_rate_factor_on_elmnt_id,
548      p_object_version_number       => p_object_version_number);
549   --
550   if (l_api_updating
551       and p_rate_factor_val_record_col
552       <> nvl(pqh_rfe_shd.g_old_rec.rate_factor_val_record_col,hr_api.g_varchar2)
553       or not l_api_updating)
554       and p_rate_factor_val_record_col is not null then
555 
556 
557     /*Should be a column from the above tables.
558       If the table selected in the previous column is pay_element_entry_values_f,
559       then an input_value_id for the Criteria_rate_element must be stored in this column.
560       If the table was selected as pay_element_entries_f , it should ensure that the column selected
561       to store the rate factors is attribute to attribute30*/
562 
563     if  LOWER(p_rate_factor_val_record_tbl) =   'pay_element_entries_f'   then
564      if(LOWER(substr(p_rate_factor_val_record_col,1,9)) = 'attribute') then
565        if TO_NUMBER(substr(p_rate_factor_val_record_col,10)) >0 AND TO_NUMBER(substr(p_rate_factor_val_record_col,10)) < 31 then
566         l_success := true;
567 	  else
568 	    l_success := false;
569         end if;
570       else
571 	   l_success := false;
572      end if;
573     elsif  LOWER(p_rate_factor_val_record_tbl) =   'pay_element_entry_values_f'  then
574 	  open c1;
575         loop
576    	   fetch c1 into l_dummy;
577   	   if l_dummy = p_rate_factor_val_record_col then
578 	     l_success := true;
579          end if;
580         exit when l_success = true OR c1%NOTFOUND;
581         end loop;
582 	  close c1;
583      end if;
584    if l_success = false then
585    	  hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
586 	  hr_utility.raise_error;
587    end if;
588 
589 
590  end if;
591   --
592   hr_utility.set_location('Leaving:'||l_proc,90);
593   --
594  EXCEPTION
595  WHEN VALUE_ERROR then
596      hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
597     hr_utility.raise_error;
598 
599 
600 End chk_rate_factor_val_record_col;
601 --
602 
603 
604 -- ----------------------------------------------------------------------------
605 -- |------< chk_business_group_id------|
606 -- ----------------------------------------------------------------------------
607 
608 -- Description
609 --   This procedure checks that a referenced foreign key actually exists
610 --   in the referenced table.
611 --
612 -- Pre-Conditions
613 --   None.
614 --
615 -- In Parameters
616 --   p_rate_factor_on_elmnt_id PK
617 --   p_business_group_id ID of FK column
618 --   p_object_version_number object version number
619 --
620 -- Post Success
621 --   Processing continues
622 --
623 -- Post Failure
624 --   Error raised.
625 --
626 -- Access Status
627 --   Internal table handler use only.
628 --
629 Procedure chk_business_group_id (p_rate_factor_on_elmnt_id          in number,
630                             p_business_group_id          in number,
631                             p_object_version_number in number) is
632   --
633   l_proc         varchar2(72) := g_package||'chk_business_group_id';
634   l_api_updating boolean;
635   l_dummy        varchar2(1);
636   --
637  cursor c1 is
638     select null from   HR_ALL_ORGANIZATION_UNITS a
639     where  a.business_group_id = p_business_group_id;
640 
641   --
642 Begin
643   --
644   hr_utility.set_location('Entering:'||l_proc,10);
645   --
646 
647   l_api_updating := pqh_rfe_shd.api_updating
648      (p_rate_factor_on_elmnt_id            => p_rate_factor_on_elmnt_id,
649       p_object_version_number   => p_object_version_number);
650   --
651   if (l_api_updating
652      and nvl(p_business_group_id,hr_api.g_number)
653      <> nvl(pqh_rfe_shd.g_old_rec.business_group_id,hr_api.g_number)
654      or not l_api_updating) then
655     --
656     -- check if business_group_id value exists in
657     -- HR_ALL_ORGANIZATION_UNITS table
658     --
659     open c1;
660       --
661 
662        fetch c1 into l_dummy;
663 
664       if c1%notfound then
665         --
666         close c1;
667         --
668         -- raise error as FK does not relate to PK in HR_ALL_ORGANIZATION_UNITS
669         -- table.
670         --
671         pqh_rfe_shd.constraint_error('PQH_RATE_FACTOR_ON_ELMNTS_FK3');
672         --
673       end if;
674       --
675     close c1;
676 
677     --
678     --
679   end if;
680   --
681   hr_utility.set_location('Leaving:'||l_proc,90);
682   --
683 End chk_business_group_id;
684 --
685 
686 
687 -- ----------------------------------------------------------------------------
688 -- |---------------------------< insert_validate >----------------------------|
689 -- ----------------------------------------------------------------------------
690 Procedure insert_validate
691   (p_effective_date               in date
692   ,p_rec                          in pqh_rfe_shd.g_rec_type
693   ) is
694 --
695   l_proc  varchar2(72) := g_package||'insert_validate';
696 --
697 Begin
698   hr_utility.set_location('Entering:'||l_proc, 5);
699   --
700   -- Call all supporting business operations
701   --
702   --
703   chk_startup_action(true
704                     ,p_rec.business_group_id
705                     ,p_rec.legislation_code
706                     );
707   IF hr_startup_data_api_support.g_startup_mode
708                      NOT IN ('GENERIC','STARTUP') THEN
709      --
710      -- Validate Important Attributes
711      --
712      hr_api.validate_bus_grp_id
713        (p_business_group_id => p_rec.business_group_id
714        ,p_associated_column1 => pqh_rfe_shd.g_tab_nam
715                                 || '.BUSINESS_GROUP_ID');
716      --
717      -- after validating the set of important attributes,
718      -- if Multiple Message Detection is enabled and at least
719      -- one error has been found then abort further validation.
720      --
721      hr_multi_message.end_validation_set;
722   END IF;
723   --
724   --
725   -- Validate Dependent Attributes
726   --
727   --
728  chk_rate_factor_val_record_tbl
729   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
730    p_rate_factor_val_record_tbl          => p_rec.rate_factor_val_record_tbl,
731    p_effective_date	   => p_effective_date,
732    p_object_version_number => p_rec.object_version_number);
733 
734   chk_rate_factor_val_record_col
735   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
736    p_rate_factor_val_record_tbl          => p_rec.rate_factor_val_record_tbl,
737    p_rate_factor_val_record_col          => p_rec.rate_factor_val_record_col,
738    p_criteria_rate_element_id			             =>   p_rec.criteria_rate_element_id,
739    p_object_version_number => p_rec.object_version_number);
740 
741    chk_criteria_rate_element_id
742   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
743    p_criteria_rate_element_id          => p_rec.criteria_rate_element_id,
744    p_object_version_number => p_rec.object_version_number);
745 
746   chk_criteria_rate_factor_id
747   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
748    p_criteria_rate_factor_id          => p_rec.criteria_rate_factor_id,
749    p_object_version_number => p_rec.object_version_number);
750 
751    IF p_rec.business_group_id IS NOT NULL THEN
752 
753    chk_business_group_id
754   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
755    p_business_group_id          => p_rec.business_group_id,
756    p_object_version_number => p_rec.object_version_number);
757 
758    END IF;
759 
760 
761 
762   hr_utility.set_location(' Leaving:'||l_proc, 10);
763 End insert_validate;
764 --
765 -- ----------------------------------------------------------------------------
766 -- |---------------------------< update_validate >----------------------------|
767 -- ----------------------------------------------------------------------------
768 Procedure update_validate
769   (p_effective_date               in date
770   ,p_rec                          in pqh_rfe_shd.g_rec_type
771   ) is
772 --
773   l_proc  varchar2(72) := g_package||'update_validate';
774 --
775 Begin
776   hr_utility.set_location('Entering:'||l_proc, 5);
777   --
778   -- Call all supporting business operations
779   --
780   --
781   chk_startup_action(false
782                     ,p_rec.business_group_id
783                     ,p_rec.legislation_code
784                     );
785   IF hr_startup_data_api_support.g_startup_mode
786                      NOT IN ('GENERIC','STARTUP') THEN
787      --
788      -- Validate Important Attributes
789      --
790      hr_api.validate_bus_grp_id
791        (p_business_group_id => p_rec.business_group_id
792        ,p_associated_column1 => pqh_rfe_shd.g_tab_nam
793                                 || '.BUSINESS_GROUP_ID');
794      --
795      -- After validating the set of important attributes,
796      -- if Multiple Message Detection is enabled and at least
797      -- one error has been found then abort further validation.
798      --
799      hr_multi_message.end_validation_set;
800   END IF;
801   --
802   --
803   -- Validate Dependent Attributes
804   --
805  chk_rate_factor_val_record_tbl
806   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
807    p_rate_factor_val_record_tbl          => p_rec.rate_factor_val_record_tbl,
808    p_effective_date	   => p_effective_date,
809    p_object_version_number => p_rec.object_version_number);
810 
811   chk_rate_factor_val_record_col
812   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
813    p_rate_factor_val_record_tbl          => p_rec.rate_factor_val_record_tbl,
814    p_rate_factor_val_record_col          => p_rec.rate_factor_val_record_col,
815    p_criteria_rate_element_id			             =>   p_rec.criteria_rate_element_id,
816    p_object_version_number => p_rec.object_version_number);
817 
818    chk_criteria_rate_element_id
819   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
820    p_criteria_rate_element_id          => p_rec.criteria_rate_element_id,
821    p_object_version_number => p_rec.object_version_number);
822 
823   chk_criteria_rate_factor_id
824   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
825    p_criteria_rate_factor_id          => p_rec.criteria_rate_factor_id,
826    p_object_version_number => p_rec.object_version_number);
827 
828    IF p_rec.business_group_id IS NOT NULL THEN
829 
830    chk_business_group_id
831   (p_rate_factor_on_elmnt_id          => p_rec.rate_factor_on_elmnt_id,
832    p_business_group_id          => p_rec.business_group_id,
833    p_object_version_number => p_rec.object_version_number);
834 
835    END IF;
836 
837 
838   chk_non_updateable_args
839     (p_effective_date              => p_effective_date
840       ,p_rec              => p_rec
841     );
842   --
843   --
844   hr_utility.set_location(' Leaving:'||l_proc, 10);
845 End update_validate;
846 --
847 -- ----------------------------------------------------------------------------
848 -- |---------------------------< delete_validate >----------------------------|
849 -- ----------------------------------------------------------------------------
850 Procedure delete_validate
851   (p_rec                          in pqh_rfe_shd.g_rec_type
852   ) is
853 --
854   l_proc  varchar2(72) := g_package||'delete_validate';
855 --
856 Begin
857   hr_utility.set_location('Entering:'||l_proc, 5);
858   --
859     --
860   chk_startup_action(false
861                     ,pqh_rfe_shd.g_old_rec.business_group_id
862                     ,pqh_rfe_shd.g_old_rec.legislation_code
863                     );
864   IF hr_startup_data_api_support.g_startup_mode
865                      NOT IN ('GENERIC','STARTUP') THEN
866      --
867      -- Validate Important Attributes
868      --
869      --
870      -- After validating the set of important attributes,
871      -- if Multiple Message Detection is enabled and at least
872      -- one error has been found then abort further validation.
873      --
874      hr_multi_message.end_validation_set;
875   END IF;
876   --
877   -- Call all supporting business operations
878   --
879   hr_utility.set_location(' Leaving:'||l_proc, 10);
880 End delete_validate;
881 --
882 end pqh_rfe_bus;