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