[Home] [Help]
PACKAGE BODY: APPS.PAY_TDF_BUS
Source
1 Package Body pay_tdf_bus as
2 /* $Header: pytdfrhi.pkb 120.4 2005/09/20 06:56 adkumar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_tdf_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_time_definition_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_time_definition_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 , pay_time_definitions tdf
32 where tdf.time_definition_id = p_time_definition_id
33 and pbg.business_group_id (+) = tdf.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 => 'time_definition_id'
50 ,p_argument_value => p_time_definition_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,'TIME_DEFINITION_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_time_definition_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 , pay_time_definitions tdf
102 where tdf.time_definition_id = p_time_definition_id
103 and pbg.business_group_id (+) = tdf.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 => 'time_definition_id'
119 ,p_argument_value => p_time_definition_id
120 );
121 --
122 if ( nvl(pay_tdf_bus.g_time_definition_id, hr_api.g_number)
123 = p_time_definition_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 := pay_tdf_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 pay_tdf_bus.g_time_definition_id := p_time_definition_id;
154 pay_tdf_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 pay_tdf_shd.g_rec_type
190 ,p_time_def_used in boolean
191 ,p_regenerate_periods out nocopy boolean
192 ,p_delete_periods out nocopy boolean
193 ) IS
194 --
195 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
196 --
197 Begin
198 --
199 -- Only proceed with the validation if a row exists for the current
200 -- record in the HR Schema.
201 --
202 IF NOT pay_tdf_shd.api_updating
203 (p_time_definition_id => p_rec.time_definition_id
204 ,p_object_version_number => p_rec.object_version_number
205 ) THEN
206 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
207 fnd_message.set_token('PROCEDURE ', l_proc);
208 fnd_message.set_token('STEP ', '5');
209 fnd_message.raise_error;
210 END IF;
211 --
212 if nvl(p_rec.business_group_id, hr_api.g_number) <>
213 nvl(pay_tdf_shd.g_old_rec.business_group_id, hr_api.g_number) then
214 hr_api.argument_changed_error
215 (p_api_name => l_proc
216 ,p_argument => 'BUSINESS_GROUP_ID'
217 ,p_base_table => pay_tdf_shd.g_tab_nam
218 );
219 end if;
220 --
221 if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
222 nvl(pay_tdf_shd.g_old_rec.legislation_code, hr_api.g_varchar2) then
223 hr_api.argument_changed_error
224 (p_api_name => l_proc
225 ,p_argument => 'LEGISLATION_CODE'
226 ,p_base_table => pay_tdf_shd.g_tab_nam
227 );
228 end if;
229 --
230 if nvl(p_rec.short_name, hr_api.g_varchar2) <>
231 pay_tdf_shd.g_old_rec.short_name then
232 hr_api.argument_changed_error
233 (p_api_name => l_proc
234 ,p_argument => 'SHORT_NAME'
235 ,p_base_table => pay_tdf_shd.g_tab_nam
236 );
237 end if;
238 --
239 if nvl(p_rec.definition_type, hr_api.g_varchar2) <>
240 nvl(pay_tdf_shd.g_old_rec.definition_type, hr_api.g_varchar2) then
241 hr_api.argument_changed_error
242 (p_api_name => l_proc
243 ,p_argument => 'DEFINITION_TYPE'
244 ,p_base_table => pay_tdf_shd.g_tab_nam
245 );
246 end if;
247 --
248 if nvl(p_rec.period_type, hr_api.g_varchar2) <>
249 nvl(pay_tdf_shd.g_old_rec.period_type, hr_api.g_varchar2) OR
250 nvl(p_rec.period_unit, hr_api.g_varchar2) <>
251 nvl(pay_tdf_shd.g_old_rec.period_unit, hr_api.g_varchar2) OR
252 nvl(p_rec.day_adjustment, hr_api.g_varchar2) <>
253 nvl(pay_tdf_shd.g_old_rec.day_adjustment, hr_api.g_varchar2) OR
254 nvl(p_rec.dynamic_code, hr_api.g_varchar2) <>
255 nvl(pay_tdf_shd.g_old_rec.dynamic_code, hr_api.g_varchar2) OR
256 nvl(p_rec.start_date, hr_api.g_date) <>
257 nvl(pay_tdf_shd.g_old_rec.start_date, hr_api.g_date) OR
258 nvl(p_rec.period_time_definition_id, hr_api.g_number) <>
259 nvl(pay_tdf_shd.g_old_rec.period_time_definition_id, hr_api.g_number) then
260
261 if p_time_def_used then
262
263 p_regenerate_periods := false;
264 p_delete_periods := false;
265
266 fnd_message.set_name('PAY', 'PAY_34057_FLSA_CROSS_VAL1');
267 fnd_message.raise_error;
268
269 else
270
271 p_regenerate_periods := true;
272 p_delete_periods := true;
273
274 end if;
275
276 elsif nvl(p_rec.number_of_years, hr_api.g_number) <>
277 nvl(pay_tdf_shd.g_old_rec.time_definition_id, hr_api.g_number) then
278
279 p_regenerate_periods := true;
280 p_delete_periods := false;
281
282 end if;
283 --
284 End chk_non_updateable_args;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |----------------------< chk_startup_action >------------------------------|
288 -- ----------------------------------------------------------------------------
289 --
290 -- Description:
291 -- This procedure will check that the current action is allowed according
292 -- to the current startup mode.
293 --
294 -- ----------------------------------------------------------------------------
295 PROCEDURE chk_startup_action
296 (p_insert IN boolean
297 ,p_business_group_id IN number
298 ,p_legislation_code IN varchar2
299 ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
300 --
301 BEGIN
302 --
303 -- Call the supporting procedure to check startup mode
304
305 IF (p_insert) THEN
306
307 if p_business_group_id is not null and p_legislation_code is not null then
308
309 fnd_message.set_name('PAY', 'PAY_34057_FLSA_CROSS_VAL1');
310 fnd_message.set_token('ARGUMENT1', 'Business Group');
311 fnd_message.set_token('ARGUMENT2', 'Legislation Code');
312 fnd_message.raise_error;
313
314 end if;
315
316 hr_startup_data_api_support.chk_startup_action
317 (p_generic_allowed => TRUE
318 ,p_startup_allowed => TRUE
319 ,p_user_allowed => TRUE
320 ,p_business_group_id => p_business_group_id
321 ,p_legislation_code => p_legislation_code
322 ,p_legislation_subgroup => p_legislation_subgroup
323 );
324 ELSE
325 hr_startup_data_api_support.chk_upd_del_startup_action
326 (p_generic_allowed => TRUE
327 ,p_startup_allowed => TRUE
328 ,p_user_allowed => TRUE
329 ,p_business_group_id => p_business_group_id
330 ,p_legislation_code => p_legislation_code
331 ,p_legislation_subgroup => p_legislation_subgroup
332 );
333 END IF;
334 --
335 END chk_startup_action;
336 --
337 -- ----------------------------------------------------------------------------
338 -- |-------------------------< is_startup_data >------------------------------|
339 -- ----------------------------------------------------------------------------
340 Function is_startup_data
341 ( p_time_definition_id IN number
342 ,p_business_group_id IN number
343 ,p_legislation_code IN varchar2 )
344 Return number is
345 --
346 l_proc varchar2(72) := g_package||'is_startup_data';
347 --
348 BEGIN
349 hr_utility.set_location('Entering:'||l_proc,5);
350 --
351 BEGIN
352 hr_startup_data_api_support.chk_upd_del_startup_action
353 (p_generic_allowed => TRUE
354 ,p_startup_allowed => TRUE
355 ,p_user_allowed => TRUE
356 ,p_business_group_id => p_business_group_id
357 ,p_legislation_code => p_legislation_code
358 ,p_legislation_subgroup => null
359 );
360 EXCEPTION
361 When Others then
362 return 0;
363 END;
364
365 return 1;
366 --
367 hr_utility.set_location('Leaving:'||l_proc,10);
368 END is_startup_data;
369 --
370 -- ----------------------------------------------------------------------------
371 -- |-------------------------< chk_time_def_usage >---------------------------|
372 -- ----------------------------------------------------------------------------
373 Function chk_time_def_usage
374 ( p_time_definition_id IN number
375 ,p_definition_type IN varchar2
376 )
377 Return boolean is
378 --
379 l_proc varchar2(72) := g_package||'chk_time_def_usage';
380 l_exists varchar2(1);
381 --
382 -- Cursor csr_time_def_comb is
383 -- select null
384 -- from pay_time_def_combinations
385 -- where child_time_definition_id = p_time_definition_id;
386
387
391 where period_time_definition_id = p_time_definition_id;
388 Cursor csr_time_def_static is
389 select null
390 from pay_time_definitions
392
393 Cursor csr_time_def_element is
394 select null
395 from pay_element_types_f
396 where time_definition_id = p_time_definition_id
397 and time_definition_type = 'S';
398
399 Cursor csr_time_def_run_results is
400 select null
401 from pay_run_results
402 where time_definition_id = p_time_definition_id;
403
404 Cursor csr_time_def_process_details is
405 select null
406 from pay_entry_process_details
407 where time_definition_id = p_time_definition_id;
408 --
409 BEGIN
410 hr_utility.set_location('Entering:'||l_proc,5);
411 --
412 if p_definition_type = 'P' then
413
414 open csr_time_def_static;
415 fetch csr_time_def_static into l_exists;
416
417 if csr_time_def_static%found then
418 close csr_time_def_static;
419 return true;
420 end if;
421
422 close csr_time_def_static;
423
424 else
425
426 -- Following validation will be put in place
427 -- when combination time definitions will be implemented.
428
429 -- if p_definition_type = 'S' then
430 --
431 -- open csr_time_def_comb;
432 -- fetch csr_time_def_comb into l_exists;
433 -- if csr_time_def_comb%found then
434 -- close csr_time_def_comb;
435 -- return true;
436 -- end if;
437 -- close csr_time_def_comb;
438 --
439 -- end if;
440
441 open csr_time_def_element;
442 fetch csr_time_def_element into l_exists;
443 if csr_time_def_element%found then
444 close csr_time_def_element;
445 return true;
446 end if;
447 close csr_time_def_element;
448
449 open csr_time_def_run_results;
450 fetch csr_time_def_run_results into l_exists;
451 if csr_time_def_run_results%found then
452 close csr_time_def_run_results;
453 return true;
454 end if;
455 close csr_time_def_run_results;
456
457 open csr_time_def_process_details;
458 fetch csr_time_def_process_details into l_exists;
459 if csr_time_def_process_details%found then
460 close csr_time_def_process_details;
461 return true;
462 end if;
463 close csr_time_def_process_details;
464
465 end if;
466
467 return false;
468 --
469 hr_utility.set_location('Leaving:'||l_proc,10);
470
471 Exception
472
473 when others then
474 -- if csr_time_def_comb%isopen then
475 -- close csr_time_def_comb;
476 -- end if;
477
478 if csr_time_def_static%isopen then
479 close csr_time_def_static;
480 end if;
481
482 if csr_time_def_element%isopen then
483 close csr_time_def_element;
484 end if;
485
486 if csr_time_def_run_results%isopen then
487 close csr_time_def_run_results;
488 end if;
489
490 if csr_time_def_process_details%isopen then
491 close csr_time_def_process_details;
492 end if;
493
494 raise;
495 END chk_time_def_usage;
496 --
497 -- ----------------------------------------------------------------------------
498 -- |-------------------------< chk_number_of_years >--------------------------|
499 -- ----------------------------------------------------------------------------
500 -- {Start Of Comments}
501 --
502 -- Description:
503 -- Validates the Number of Years column
504 --
505 -- Prerequisites:
506 -- Definition type is valid.
507 --
508 -- In Arguments:
509 -- p_time_definition_id
510 -- p_object_version_number
511 -- p_definition_type
512 -- p_number_of_years
513 --
514 -- Post Success:
515 -- Processing continues.
516 --
517 -- Post Failure:
518 -- An error is raised if the validation fails.
519 --
520 -- Access Status:
521 -- Internal Development Use Only.
522 --
523 -- {End Of Comments}
524 -- ---------------------------------------------------------------------------
525 Procedure chk_number_of_years
526 (p_time_definition_id in number,
527 p_object_version_number in number,
528 p_definition_type in varchar2,
529 p_number_of_years in number
530 ) is
531 --
532 l_proc varchar2(72) := g_package||'chk_number_of_years';
533 l_api_updating boolean;
534 --
535 Begin
536 hr_utility.set_location('Entering:'||l_proc, 5);
537 --
538 l_api_updating := pay_tdf_shd.api_updating
539 (p_time_definition_id => p_time_definition_id
540 ,p_object_version_number => p_object_version_number);
541
542 if hr_multi_message.no_exclusive_error
543 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
544 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.NUMBER_OF_YEARS'
545 ) and (
546 not l_api_updating or
547 ( l_api_updating and nvl(p_number_of_years, hr_api.g_number) <>
548 nvl(pay_tdf_shd.g_old_rec.number_of_years, hr_api.g_number) )
549 ) then
550
551 if p_definition_type in ('P','E','C')
552 and p_number_of_years is not null then
553
554 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
555 fnd_message.set_token('ARGUMENT', 'Years');
556 fnd_message.raise_error;
557
561
558 end if;
559
560 if p_definition_type = 'S' and p_number_of_years is null then
562 fnd_message.set_name('PAY', 'PAY_34053_FLSA_ARG_NULL');
563 fnd_message.set_token('ARGUMENT', 'Years');
564 fnd_message.raise_error;
565
566 end if;
567
568 if p_definition_type = 'S' and p_number_of_years <= 0 then
569
570 fnd_message.set_name('PAY', 'PAY_34054_FLSA_ARG_ZERO');
571 fnd_message.set_token('ARGUMENT', 'Years');
572 fnd_message.raise_error;
573
574 end if;
575
576 if l_api_updating and p_definition_type = 'S' and
577 p_number_of_years < nvl(pay_tdf_shd.g_old_rec.number_of_years,0) then
578
579 fnd_message.set_name('PAY', 'PAY_34055_FLSA_YEARS_INV_UPD');
580 fnd_message.raise_error;
581
582 end if;
583
584 end if;
585 --
586 hr_utility.set_location(' Leaving:'||l_proc, 10);
587
588 exception
589
590 when app_exception.application_exception then
591 if hr_multi_message.exception_add
592 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.NUMBER_OF_YEARS') then
593 raise;
594 end if;
595
596 when others then
597 raise;
598
599 End chk_number_of_years;
600 --
601 -- ----------------------------------------------------------------------------
602 -- |----------------------------< chk_cross_validations >---------------------|
603 -- ----------------------------------------------------------------------------
604 -- {Start Of Comments}
605 --
606 -- Description:
607 -- Performs the cross validations on a number of columns.
608 --
609 -- Prerequisites:
610 -- Definition type is valid.
611 --
612 -- In Arguments:
613 -- p_time_definition_id
614 -- p_object_version_number
615 -- p_definition_type
616 -- p_period_type
617 -- p_period_time_definition_id
618 -- p_day_adjustment
619 -- p_period_unit
620 --
621 -- Post Success:
622 -- Processing continues.
623 --
624 -- Post Failure:
625 -- An error is raised if the validation fails.
626 --
627 -- Access Status:
628 -- Internal Development Use Only.
629 --
630 -- {End Of Comments}
631 -- ---------------------------------------------------------------------------
632 Procedure chk_cross_validations
633 (p_time_definition_id in number,
634 p_object_version_number in number,
635 p_definition_type in varchar2,
636 p_period_type in varchar2,
637 p_period_time_definition_id in number,
638 p_day_adjustment in varchar2,
639 p_period_unit in varchar2
640 ) is
641 --
642 l_proc varchar2(72) := g_package||'chk_cross_validations';
643 l_api_updating boolean;
644 l_exists varchar2(1);
645
646 cursor csr_pit_period_type is
647 select null
648 from hr_lookups
649 where lookup_type like 'PAY_PIT_OFFSET_PERIOD_TYPE'
650 and enabled_flag='Y'
651 and lookup_code = p_period_type;
652 --
653 Begin
654 hr_utility.set_location('Entering:'||l_proc, 5);
655 hr_utility.trace('Definition Type - ' || nvl(p_definition_type,'null'));
656 hr_utility.trace('Period Type - ' || nvl(p_period_type,'null'));
657 hr_utility.trace('Day Adjustment - ' || nvl(p_day_adjustment,'null'));
658 hr_utility.trace('Period Unit - ' || nvl(p_period_unit,'null'));
659 --
660 if hr_multi_message.no_exclusive_error
661 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
662 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.CROSS_VALIDATIONS'
663 ) then
664
665 if p_definition_type = 'S' then
666
667 if p_period_type is not null and p_period_time_definition_id is not null then
668
669 fnd_message.set_name('PAY', 'PAY_34057_FLSA_CROSS_VAL1');
670 fnd_message.set_token('ARGUMENT1', 'Period Type');
671 fnd_message.set_token('ARGUMENT2', 'Definition for Next Start Date');
672 fnd_message.raise_error;
673
674 elsif p_period_type is null and p_period_time_definition_id is null then
675
676 fnd_message.set_name('PAY', 'PAY_34058_FLSA_CROSS_VAL2');
677 fnd_message.set_token('ARGUMENT1', 'Period Type');
678 fnd_message.set_token('ARGUMENT2', 'Definition for Next Start Date');
679 fnd_message.raise_error;
680
681 end if;
682
683 end if;
684
685 if p_definition_type = 'P' then
686 if p_period_type is null and p_period_unit is null
687 and p_day_adjustment is null then
688
689 fnd_message.set_name('PAY', 'PAY_34060_FLSA_CROSS_VAL3');
690 fnd_message.raise_error;
691
692 elsif p_period_type is null and p_period_unit is not null then
693
694 fnd_message.set_name('PAY', 'PAY_34053_FLSA_ARG_NULL');
695 fnd_message.set_token('ARGUMENT', 'Period Type');
696 fnd_message.raise_error;
697
698 elsif p_period_type is not null and p_period_unit is null then
699 open csr_pit_period_type;
700 fetch csr_pit_period_type into l_exists;
701 if csr_pit_period_type%found then
702 fnd_message.set_name('PAY', 'PAY_34053_FLSA_ARG_NULL');
703 fnd_message.set_token('ARGUMENT', 'Period Unit');
704 fnd_message.raise_error;
705 end if;
706 close csr_pit_period_type;
707 end if;
708
709 end if;
710
711 end if;
712 --
713 hr_utility.set_location(' Leaving:'||l_proc, 10);
714
715 exception
716
720 raise;
717 when app_exception.application_exception then
718 if hr_multi_message.exception_add
719 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.CROSS_VALIDATIONS') then
721 end if;
722
723 when others then
724 raise;
725
726 End chk_cross_validations;
727 --
728 -- ----------------------------------------------------------------------------
729 -- |----------------------------< chk_period_type >---------------------------|
730 -- ----------------------------------------------------------------------------
731 -- {Start Of Comments}
732 --
733 -- Description:
734 -- Validates the Period type column
735 --
736 -- Prerequisites:
737 -- Definition type is valid.
738 --
739 -- In Arguments:
740 -- p_time_definition_id
741 -- p_object_version_number
742 -- p_definition_type
743 -- p_period_type
744 --
745 -- Post Success:
746 -- Processing continues.
747 --
748 -- Post Failure:
749 -- An error is raised if the validation fails.
750 --
751 -- Access Status:
752 -- Internal Development Use Only.
753 --
754 -- {End Of Comments}
755 -- ---------------------------------------------------------------------------
756 Procedure chk_period_type
757 (p_time_definition_id in number,
758 p_object_version_number in number,
759 p_definition_type in varchar2,
760 p_period_type in varchar2
761 ) is
762 --
763 l_proc varchar2(72) := g_package||'chk_period_type';
764 l_api_updating boolean;
765 l_exists varchar2(1);
766
767 cursor csr_period_type is
768 select null
769 from per_time_period_types
770 where period_type = p_period_type;
771
772 cursor csr_pit_period_type is
773 select null
774 from hr_lookups
775 where lookup_type like 'PAY_PIT_PERIOD_TYPE'
776 and enabled_flag='Y'
777 and lookup_code = p_period_type;
778
779 --
780 Begin
781 hr_utility.set_location('Entering:'||l_proc, 5);
782 --
783 l_api_updating := pay_tdf_shd.api_updating
784 (p_time_definition_id => p_time_definition_id
785 ,p_object_version_number => p_object_version_number);
786
787 if hr_multi_message.no_exclusive_error
788 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
789 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_TYPE'
790 ) and (
791 not l_api_updating or
792 ( l_api_updating and nvl(p_period_type, hr_api.g_varchar2) <>
793 nvl(pay_tdf_shd.g_old_rec.period_type, hr_api.g_varchar2 ) )
794 ) then
795
796 if p_definition_type in ('E','C')
797 and p_period_type is not null then
798
799 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
800 fnd_message.set_token('ARGUMENT', 'Period Type');
801 fnd_message.raise_error;
802
803 end if;
804
805 if p_period_type is not null then
806 if p_definition_type = 'P' then
807 open csr_pit_period_type;
808 fetch csr_pit_period_type into l_exists;
809 if csr_pit_period_type%notfound then
810 close csr_pit_period_type;
811 fnd_message.set_name('PAY', 'PAY_34059_FLSA_ARG_INVALID');
812 fnd_message.set_token('ARGUMENT', 'Period Type');
813 fnd_message.raise_error;
814 end if;
815 close csr_pit_period_type;
816 else
817 open csr_period_type;
818 fetch csr_period_type into l_exists;
819
820 if csr_period_type%notfound then
821 close csr_period_type;
822 fnd_message.set_name('PAY', 'PAY_34059_FLSA_ARG_INVALID');
823 fnd_message.set_token('ARGUMENT', 'Period Type');
824 fnd_message.raise_error;
825 end if;
826 close csr_period_type;
827 end if;
828 end if;
829 end if;
830 --
831 hr_utility.set_location(' Leaving:'||l_proc, 10);
832
833 exception
834
835 when app_exception.application_exception then
836 if hr_multi_message.exception_add
837 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_TYPE') then
838 raise;
839 end if;
840
841 when others then
842 if csr_period_type%isopen then
843 close csr_period_type;
844 end if;
845 raise;
846
847 End chk_period_type;
848 --
849 -- ----------------------------------------------------------------------------
850 -- |---------------------------< chk_period_unit >----------------------------|
851 -- ----------------------------------------------------------------------------
852 -- {Start Of Comments}
853 --
854 -- Description:
855 -- Validates the Period unit column
856 --
857 -- Prerequisites:
858 -- Definition type is valid.
859 --
860 -- In Arguments:
861 -- p_time_definition_id
862 -- p_object_version_number
863 -- p_definition_type
864 -- p_period_unit
865 --
866 -- Post Success:
867 -- Processing continues.
868 --
869 -- Post Failure:
870 -- An error is raised if the validation fails.
871 --
872 -- Access Status:
873 -- Internal Development Use Only.
874 --
875 -- {End Of Comments}
876 -- ---------------------------------------------------------------------------
877 Procedure chk_period_unit
878 (p_time_definition_id in number,
879 p_object_version_number in number,
883 --
880 p_definition_type in varchar2,
881 p_period_unit in varchar2
882 ) is
884 l_proc varchar2(72) := g_package||'chk_period_unit';
885 l_api_updating boolean;
886 --
887 Begin
888 hr_utility.set_location('Entering:'||l_proc, 5);
889 --
890 l_api_updating := pay_tdf_shd.api_updating
891 (p_time_definition_id => p_time_definition_id
892 ,p_object_version_number => p_object_version_number);
893
894 if hr_multi_message.no_exclusive_error
895 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
896 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_UNIT'
897 ) and (
898 not l_api_updating or
899 ( l_api_updating and nvl(p_period_unit, hr_api.g_varchar2) <>
900 nvl(pay_tdf_shd.g_old_rec.period_unit, hr_api.g_varchar2) )
901 ) then
902
903 if p_definition_type in ('S','E','C')
904 and p_period_unit is not null then
905
906 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
907 fnd_message.set_token('ARGUMENT', 'Period Unit');
908 fnd_message.raise_error;
909
910 end if;
911
912 end if;
913 --
914 hr_utility.set_location(' Leaving:'||l_proc, 10);
915
916 exception
917
918 when app_exception.application_exception then
919 if hr_multi_message.exception_add
920 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_UNIT') then
921 raise;
922 end if;
923
924 when others then
925 raise;
926
927 End chk_period_unit;
928 --
929 -- ----------------------------------------------------------------------------
930 -- |---------------------------< chk_day_adjustment >-------------------------|
931 -- ----------------------------------------------------------------------------
932 -- {Start Of Comments}
933 --
934 -- Description:
935 -- Validates the Day adjustment column
936 --
937 -- Prerequisites:
938 -- Definition type is valid.
939 --
940 -- In Arguments:
941 -- p_time_definition_id
942 -- p_object_version_number
943 -- p_definition_type
944 -- p_day_adjustment
945 --
946 -- Post Success:
947 -- Processing continues.
948 --
949 -- Post Failure:
950 -- An error is raised if the validation fails.
951 --
952 -- Access Status:
953 -- Internal Development Use Only.
954 --
955 -- {End Of Comments}
956 -- ---------------------------------------------------------------------------
957 Procedure chk_day_adjustment
958 (p_time_definition_id in number,
959 p_object_version_number in number,
960 p_definition_type in varchar2,
961 p_day_adjustment in varchar2
962 ) is
963 --
964 l_proc varchar2(72) := g_package||'chk_day_adjustment';
965 l_api_updating boolean;
966 --
967 Begin
968 hr_utility.set_location('Entering:'||l_proc, 5);
969 --
970 l_api_updating := pay_tdf_shd.api_updating
971 (p_time_definition_id => p_time_definition_id
972 ,p_object_version_number => p_object_version_number);
973
974 if hr_multi_message.no_exclusive_error
975 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
976 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.DAY_ADUSTMENT'
977 ) and (
978 not l_api_updating or
979 ( l_api_updating and nvl(p_day_adjustment, hr_api.g_varchar2) <>
980 nvl(pay_tdf_shd.g_old_rec.day_adjustment, hr_api.g_varchar2) )
981 ) then
982
983 if p_definition_type in ('S','E','C')
984 and p_day_adjustment is not null then
985
986 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
987 fnd_message.set_token('ARGUMENT', 'Day Adjustment');
988 fnd_message.raise_error;
989
990 end if;
991 end if;
992 --
993 hr_utility.set_location(' Leaving:'||l_proc, 10);
994
995 exception
996
997 when app_exception.application_exception then
998 if hr_multi_message.exception_add
999 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.DAY_ADJUSTMENT') then
1000 raise;
1001 end if;
1002
1003 when others then
1004 raise;
1005
1006 End chk_day_adjustment;
1007 --
1008 -- ----------------------------------------------------------------------------
1009 -- |------------------------------< chk_start_date >--------------------------|
1010 -- ----------------------------------------------------------------------------
1011 -- {Start Of Comments}
1012 --
1013 -- Description:
1014 -- Validates the Start date column
1015 --
1016 -- Prerequisites:
1017 -- Definition type is valid.
1018 --
1019 -- In Arguments:
1020 -- p_time_definition_id
1021 -- p_object_version_number
1022 -- p_definition_type
1023 -- p_start_date
1024 --
1025 -- Post Success:
1026 -- Processing continues.
1027 --
1028 -- Post Failure:
1029 -- An error is raised if the validation fails.
1030 --
1031 -- Access Status:
1032 -- Internal Development Use Only.
1033 --
1034 -- {End Of Comments}
1035 -- ---------------------------------------------------------------------------
1036 Procedure chk_start_date
1037 (p_time_definition_id in number,
1038 p_object_version_number in number,
1039 p_definition_type in varchar2,
1040 p_start_date in varchar2
1041 ) is
1042 --
1043 l_proc varchar2(72) := g_package||'chk_start_date';
1044 l_api_updating boolean;
1045 --
1049 l_api_updating := pay_tdf_shd.api_updating
1046 Begin
1047 hr_utility.set_location('Entering:'||l_proc, 5);
1048 --
1050 (p_time_definition_id => p_time_definition_id
1051 ,p_object_version_number => p_object_version_number);
1052
1053 if hr_multi_message.no_exclusive_error
1054 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
1055 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.START_DATE'
1056 ) and (
1057 not l_api_updating or
1058 ( l_api_updating and nvl(p_start_date, hr_api.g_date) <>
1059 nvl(pay_tdf_shd.g_old_rec.start_date, hr_api.g_date) )
1060 ) then
1061
1062 if p_definition_type in ('P','E','C')
1063 and p_start_date is not null then
1064
1065 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
1066 fnd_message.set_token('ARGUMENT', 'Start Date');
1067 fnd_message.raise_error;
1068
1069 end if;
1070
1071 if p_definition_type = 'S' and p_start_date is null then
1072
1073 fnd_message.set_name('PAY', 'PAY_34053_FLSA_ARG_NULL');
1074 fnd_message.set_token('ARGUMENT', 'Start Date');
1075 fnd_message.raise_error;
1076
1077 end if;
1078
1079 end if;
1080 --
1081 hr_utility.set_location(' Leaving:'||l_proc, 10);
1082
1083 exception
1084
1085 when app_exception.application_exception then
1086 if hr_multi_message.exception_add
1087 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.START_DATE') then
1088 raise;
1089 end if;
1090
1091 when others then
1092 raise;
1093
1094 End chk_start_date;
1095 --
1096 -- ----------------------------------------------------------------------------
1097 -- |----------------------< chk_period_time_definition_id >-------------------|
1098 -- ----------------------------------------------------------------------------
1099 -- {Start Of Comments}
1100 --
1101 -- Description:
1102 -- Validates the Period Time definition column
1103 --
1104 -- Prerequisites:
1105 -- Definition type is valid.
1106 --
1107 -- In Arguments:
1108 -- p_time_definition_id
1109 -- p_object_version_number
1110 -- p_definition_type
1111 -- p_period_time_definition_id
1112 -- p_business_group_id
1113 -- p_legislation_code
1114 --
1115 -- Post Success:
1116 -- Processing continues.
1117 --
1118 -- Post Failure:
1119 -- An error is raised if the validation fails.
1120 --
1121 -- Access Status:
1122 -- Internal Development Use Only.
1123 --
1124 -- {End Of Comments}
1125 -- ---------------------------------------------------------------------------
1126 Procedure chk_period_time_definition_id
1127 (p_time_definition_id in number,
1128 p_object_version_number in number,
1129 p_definition_type in varchar2,
1130 p_period_time_definition_id in number,
1131 p_business_group_id in number,
1132 p_legislation_code in varchar2
1133 ) is
1134 --
1135 l_proc varchar2(72) := g_package||'chk_period_time_definition_id';
1136 l_api_updating boolean;
1137 l_exists varchar2(1);
1138
1139 cursor csr_period_time_definition_id is
1140 select null
1141 from pay_time_definitions ptd
1142 where ptd.time_definition_id = p_period_time_definition_id
1143 and nvl(ptd.definition_type, 'P') = 'P'
1144 and (
1145 ( p_business_group_id is null and
1146 p_legislation_code is null and
1147 ptd.business_group_id is null and
1148 ptd.legislation_code is null
1149 ) OR
1150 ( p_business_group_id is null and
1151 p_legislation_code is not null and
1152 ( (ptd.business_group_id is null and ptd.legislation_code is null)
1153 OR ( ptd.business_group_id is null and ptd.legislation_code = p_legislation_code) )
1154 ) OR
1155 (
1156 p_business_group_id is not null and
1157 p_legislation_code is null and
1158 ( ( ptd.business_group_id is null and ptd.legislation_code is null)
1159 OR (ptd.business_group_id is null and ptd.legislation_code = hr_api.return_legislation_code(p_business_group_id))
1160 OR (ptd.business_group_id = p_business_group_id and ptd.legislation_code is null) )
1161 )
1162 );
1163
1164 --
1165 Begin
1166 hr_utility.set_location('Entering:'||l_proc, 5);
1167 --
1168 l_api_updating := pay_tdf_shd.api_updating
1169 (p_time_definition_id => p_time_definition_id
1170 ,p_object_version_number => p_object_version_number);
1171
1172 if hr_multi_message.no_exclusive_error
1173 (p_check_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE'
1174 ,p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_TIME_DEFINITION_ID'
1175 ) and (
1176 not l_api_updating or
1177 ( l_api_updating and nvl(p_period_time_definition_id, hr_api.g_number) <>
1178 nvl(pay_tdf_shd.g_old_rec.period_time_definition_id, hr_api.g_number ) )
1179 ) then
1180
1181 if p_definition_type in ('P','E','C')
1182 and p_period_time_definition_id is not null then
1183
1184 fnd_message.set_name('PAY', 'PAY_34052_FLSA_ARG_NOT_NULL');
1185 fnd_message.set_token('ARGUMENT', 'Period Time Definition Id');
1186 fnd_message.raise_error;
1187
1188 end if;
1189
1190 if p_period_time_definition_id is not null then
1191
1192 open csr_period_time_definition_id;
1193 fetch csr_period_time_definition_id into l_exists;
1194
1195 if csr_period_time_definition_id%notfound then
1196
1200 fnd_message.raise_error;
1197 close csr_period_time_definition_id;
1198 fnd_message.set_name('PAY', 'PAY_34059_FLSA_ARG_INVALID');
1199 fnd_message.set_token('ARGUMENT', 'Period Time Definition');
1201
1202 end if;
1203
1204 close csr_period_time_definition_id;
1205
1206 end if;
1207
1208 end if;
1209 --
1210 hr_utility.set_location(' Leaving:'||l_proc, 10);
1211
1212 exception
1213
1214 when app_exception.application_exception then
1215 if hr_multi_message.exception_add
1216 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.PERIOD_TIME_DEFINITION_ID') then
1217 raise;
1218 end if;
1219
1220 when others then
1221 if csr_period_time_definition_id%isopen then
1222 close csr_period_time_definition_id;
1223 end if;
1224 raise;
1225
1226 End chk_period_time_definition_id;
1227 --
1228 -- ----------------------------------------------------------------------------
1229 -- |---------------------------< chk_definition_name >------------------------|
1230 -- ----------------------------------------------------------------------------
1231 -- {Start Of Comments}
1232 --
1233 -- Description:
1234 -- Validates the Definition Name column
1235 --
1236 -- Prerequisites:
1237 -- None
1238 --
1239 -- In Arguments:
1240 -- p_time_definition_id
1241 -- p_object_version_number
1242 -- p_definition_name
1243 -- p_business_group_id
1244 -- p_legislation_code
1245 --
1246 -- Post Success:
1247 -- Processing continues.
1248 --
1249 -- Post Failure:
1250 -- An error is raised if the validation fails.
1251 --
1252 -- Access Status:
1253 -- Internal Development Use Only.
1254 --
1255 -- {End Of Comments}
1256 -- ---------------------------------------------------------------------------
1257 Procedure chk_definition_name
1258 (p_time_definition_id in number,
1259 p_object_version_number in number,
1260 p_definition_name in varchar2,
1261 p_business_group_id in number,
1262 p_legislation_code in varchar2
1263 ) is
1264 --
1265 l_proc varchar2(72) := g_package||'chk_definition_name';
1266 l_api_updating boolean;
1267 l_exists varchar2(1);
1268
1269 cursor csr_definition_name is
1270 select null
1271 from pay_time_definitions ptd
1272 where ptd.definition_name = p_definition_name
1273 and (
1274 ( p_business_group_id is null and
1275 p_legislation_code is null and
1276 ptd.business_group_id is null and
1277 ptd.legislation_code is null
1278 ) OR
1279 ( p_business_group_id is null and
1280 p_legislation_code is not null and
1281 ( (ptd.business_group_id is null and ptd.legislation_code is null)
1282 OR ( ptd.business_group_id is null and ptd.legislation_code = p_legislation_code) )
1283 ) OR
1284 (
1285 p_business_group_id is not null and
1286 p_legislation_code is null and
1287 ( ( ptd.business_group_id is null and ptd.legislation_code is null)
1288 OR (ptd.business_group_id is null and ptd.legislation_code = hr_api.return_legislation_code(p_business_group_id))
1289 OR (ptd.business_group_id = p_business_group_id and ptd.legislation_code is null) )
1290 )
1291 );
1292
1293 --
1294 Begin
1295 hr_utility.set_location('Entering:'||l_proc, 5);
1296 --
1297 l_api_updating := pay_tdf_shd.api_updating
1298 (p_time_definition_id => p_time_definition_id
1299 ,p_object_version_number => p_object_version_number);
1300
1301 if not l_api_updating or
1302 ( l_api_updating and nvl(p_definition_name, hr_api.g_varchar2) <>
1303 nvl(pay_tdf_shd.g_old_rec.definition_name, hr_api.g_varchar2 )
1304 ) then
1305
1306 hr_api.mandatory_arg_error
1307 (p_api_name => l_proc
1308 ,p_argument => 'DEFINITION_NAME'
1309 ,p_argument_value => p_definition_name
1310 );
1311
1312 open csr_definition_name;
1313 fetch csr_definition_name into l_exists;
1314
1315 if csr_definition_name%found then
1316
1317 close csr_definition_name;
1318
1319 fnd_message.set_name('PAY','PAY_34061_FLSA_DUP_NAME');
1320 fnd_message.raise_error;
1321
1322 end if;
1323
1324 close csr_definition_name;
1325
1326 end if;
1327 --
1328 hr_utility.set_location(' Leaving:'||l_proc, 10);
1329
1330 exception
1331
1332 when app_exception.application_exception then
1333 if hr_multi_message.exception_add
1334 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_NAME') then
1335 raise;
1336 end if;
1337
1338 when others then
1339 if csr_definition_name%isopen then
1340 close csr_definition_name;
1341 end if;
1342 raise;
1343
1344 End chk_definition_name;
1345 --
1346 -- ----------------------------------------------------------------------------
1347 -- |-----------------------------< chk_short_name >---------------------------|
1348 -- ----------------------------------------------------------------------------
1349 -- {Start Of Comments}
1350 --
1351 -- Description:
1352 -- Validates the Short Name column
1353 --
1354 -- Prerequisites:
1355 -- None
1356 --
1357 -- In Arguments:
1358 -- p_time_definition_id
1359 -- p_object_version_number
1360 -- p_definition_type
1361 -- p_number_of_years
1362 --
1366 -- Post Failure:
1363 -- Post Success:
1364 -- Processing continues.
1365 --
1367 -- An error is raised if the validation fails.
1368 --
1369 -- Access Status:
1370 -- Internal Development Use Only.
1371 --
1372 -- {End Of Comments}
1373 -- ---------------------------------------------------------------------------
1374 Procedure chk_short_name
1375 (p_time_definition_id in number,
1376 p_object_version_number in number,
1377 p_short_name in varchar2
1378 ) is
1379 --
1380 l_proc varchar2(72) := g_package||'chk_short_name';
1381 l_api_updating boolean;
1382 l_exists varchar2(1);
1383
1384 cursor csr_short_name is
1385 select null
1386 from pay_time_definitions ptd
1387 where ptd.short_name = p_short_name;
1388
1389 --
1390 Begin
1391 hr_utility.set_location('Entering:'||l_proc, 5);
1392 --
1393 hr_api.mandatory_arg_error
1394 (p_api_name => l_proc
1395 ,p_argument => 'SHORT_NAME'
1396 ,p_argument_value => p_short_name
1397 );
1398
1399 open csr_short_name;
1400 fetch csr_short_name into l_exists;
1401
1402 if csr_short_name%found then
1403
1404 close csr_short_name;
1405
1406 fnd_message.set_name('PAY','PAY_34062_FLSA_DUP_SHORT_NAME');
1407 fnd_message.raise_error;
1408
1409 end if;
1410
1411 close csr_short_name;
1412
1413 --
1414 hr_utility.set_location(' Leaving:'||l_proc, 10);
1415
1416 exception
1417
1418 when app_exception.application_exception then
1419 if hr_multi_message.exception_add
1420 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.SHORT_NAME') then
1421 raise;
1422 end if;
1423
1424 when others then
1425 if csr_short_name%isopen then
1426 close csr_short_name;
1427 end if;
1428 raise;
1429
1430 End chk_short_name;
1431 --
1432 -- ----------------------------------------------------------------------------
1433 -- |--------------------------< chk_definition_type >-------------------------|
1434 -- ----------------------------------------------------------------------------
1435 -- {Start Of Comments}
1436 --
1437 -- Description:
1438 -- Validates the Definition type column
1439 --
1440 -- Prerequisites:
1441 -- None
1442 --
1443 -- In Arguments:
1444 -- p_time_definition_id
1445 -- p_object_version_number
1446 -- p_definition_type
1447 --
1448 -- Post Success:
1449 -- Processing continues.
1450 --
1451 -- Post Failure:
1452 -- An error is raised if the validation fails.
1453 --
1454 -- Access Status:
1455 -- Internal Development Use Only.
1456 --
1457 -- {End Of Comments}
1458 -- ---------------------------------------------------------------------------
1459 Procedure chk_definition_type
1460 (p_time_definition_id in number,
1461 p_object_version_number in number,
1462 p_definition_type in varchar2
1463 ) is
1464 --
1465 l_proc varchar2(72) := g_package||'chk_definition_type';
1466 l_api_updating boolean;
1467 l_exists varchar2(1);
1468
1469 cursor csr_definition_type is
1470 select null
1471 from hr_standard_lookups hrl
1472 where hrl.lookup_type = 'PAY_TIME_DEFINITION_TYPE'
1473 and hrl.lookup_code = p_definition_type
1474 and hrl.enabled_flag = 'Y';
1475
1476 --
1477 Begin
1478 hr_utility.set_location('Entering:'||l_proc, 5);
1479 --
1480 hr_api.mandatory_arg_error
1481 (p_api_name => l_proc
1482 ,p_argument => 'DEFINITION_TYPE'
1483 ,p_argument_value => p_definition_type
1484 );
1485
1486 open csr_definition_type;
1487 fetch csr_definition_type into l_exists;
1488
1489 if csr_definition_type%notfound then
1490
1491 close csr_definition_type;
1492
1493 fnd_message.set_name('PAY','PAY_34059_FLSA_ARG_INVALID');
1494 fnd_message.set_token('ARGUMENT', 'Definition Type');
1495 fnd_message.raise_error;
1496
1497 end if;
1498
1499 close csr_definition_type;
1500
1501 --
1502 hr_utility.set_location(' Leaving:'||l_proc, 10);
1503
1504 exception
1505
1506 when app_exception.application_exception then
1507 if hr_multi_message.exception_add
1508 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.DEFINITION_TYPE') then
1509 raise;
1510 end if;
1511
1512 when others then
1513 if csr_definition_type%isopen then
1514 close csr_definition_type;
1515 end if;
1516 raise;
1517
1518 End chk_definition_type;
1519 --
1520 -- ----------------------------------------------------------------------------
1521 -- |--------------------------< chk_legislation_code>-------------------------|
1522 -- ----------------------------------------------------------------------------
1523 -- {Start Of Comments}
1524 --
1525 -- Description:
1526 -- Validates the Legislation Code column
1527 --
1528 -- Prerequisites:
1529 -- None
1530 --
1531 -- In Arguments:
1532 -- p_legislation_code
1533 --
1534 -- Post Success:
1535 -- Processing continues.
1536 --
1537 -- Post Failure:
1538 -- An error is raised if the validation fails.
1539 --
1540 -- Access Status:
1541 -- Internal Development Use Only.
1542 --
1543 -- {End Of Comments}
1544 -- ---------------------------------------------------------------------------
1548 --
1545 procedure chk_legislation_code
1546 ( p_legislation_code in varchar2 )
1547 is
1549 cursor csr_legislation_code is
1550 select null
1551 from fnd_territories
1552 where territory_code = p_legislation_code ;
1553 --
1554 l_exists varchar2(1);
1555 l_proc varchar2(100) := g_package || 'chk_legislation_code';
1556 begin
1557 --
1558 hr_utility.set_location('Entering:'|| l_proc, 10);
1559
1560 open csr_legislation_code;
1561 fetch csr_legislation_code into l_exists ;
1562
1563 if csr_legislation_code%notfound then
1564 close csr_legislation_code;
1565 fnd_message.set_name('PAY', 'PAY_34059_FLSA_ARG_INVALID');
1566 fnd_message.set_token('ARGUMENT', 'Legislation Code');
1567 fnd_message.raise_error;
1568 end if;
1569 close csr_legislation_code;
1570
1571 hr_utility.set_location(' Leaving:'|| l_proc, 20);
1572 --
1573 exception
1574 when app_exception.application_exception then
1575 if hr_multi_message.exception_add
1576 (p_associated_column1 => 'PAY_TIME_DEFINITIONS.LEGISLATION_CODE'
1577 ) then
1578 raise;
1579 end if;
1580 when others then
1581 if csr_legislation_code%isopen then
1582 close csr_legislation_code;
1583 end if;
1584 raise;
1585 end chk_legislation_code;
1586 --
1587 -- ----------------------------------------------------------------------------
1588 -- |---------------------------< insert_validate >----------------------------|
1589 -- ----------------------------------------------------------------------------
1590 Procedure insert_validate
1591 (p_effective_date in date
1592 ,p_rec in pay_tdf_shd.g_rec_type
1593 ) is
1594 --
1595 l_proc varchar2(72) := g_package||'insert_validate';
1596 --
1597 Begin
1598 hr_utility.set_location('Entering:'||l_proc, 5);
1599 --
1600 -- Call all supporting business operations
1601 --
1602 --
1603 chk_startup_action(true
1604 ,p_rec.business_group_id
1605 ,p_rec.legislation_code
1606 );
1607
1608 IF hr_startup_data_api_support.g_startup_mode
1609 NOT IN ('GENERIC','STARTUP') THEN
1610 --
1611 -- Validate Important Attributes
1612 --
1613 hr_api.validate_bus_grp_id
1614 (p_business_group_id => p_rec.business_group_id
1615 ,p_associated_column1 => pay_tdf_shd.g_tab_nam
1616 || '.BUSINESS_GROUP_ID');
1617 --
1618 -- after validating the set of important attributes,
1619 -- if Multiple Message Detection is enabled and at least
1620 -- one error has been found then abort further validation.
1621 --
1622 hr_multi_message.end_validation_set;
1623 END IF;
1624 --
1625 if hr_startup_data_api_support.g_startup_mode not in ('GENERIC','USER') then
1626
1627 --
1628 -- Validate Important Attributes
1629 --
1630 chk_legislation_code(p_legislation_code => p_rec.legislation_code);
1631 --
1632 hr_multi_message.end_validation_set;
1633
1634 end if;
1635 --
1636 -- Validate Dependent Attributes
1637 --
1638
1639 chk_definition_name
1640 (p_time_definition_id => p_rec.time_definition_id,
1641 p_object_version_number => p_rec.object_version_number,
1642 p_definition_name => p_rec.definition_name,
1643 p_business_group_id => p_rec.business_group_id,
1644 p_legislation_code => p_rec.legislation_code
1645 );
1646
1647 chk_short_name
1648 (p_time_definition_id => p_rec.time_definition_id,
1649 p_object_version_number => p_rec.object_version_number,
1650 p_short_name => p_rec.short_name
1651 );
1652
1653 chk_definition_type
1654 (p_time_definition_id => p_rec.time_definition_id,
1655 p_object_version_number => p_rec.object_version_number,
1656 p_definition_type => p_rec.definition_type
1657 );
1658
1659 chk_start_date
1660 (p_time_definition_id => p_rec.time_definition_id,
1661 p_object_version_number => p_rec.object_version_number,
1662 p_definition_type => p_rec.definition_type,
1663 p_start_date => p_rec.start_date
1664 );
1665
1666 chk_number_of_years
1667 (p_time_definition_id => p_rec.time_definition_id,
1668 p_object_version_number => p_rec.object_version_number,
1669 p_definition_type => p_rec.definition_type,
1670 p_number_of_years => p_rec.number_of_years
1671 );
1672
1673 chk_cross_validations
1674 (p_time_definition_id => p_rec.time_definition_id,
1675 p_object_version_number => p_rec.object_version_number,
1676 p_definition_type => p_rec.definition_type,
1677 p_period_type => p_rec.period_type,
1678 p_period_time_definition_id => p_rec.period_time_definition_id,
1679 p_day_adjustment => p_rec.day_adjustment,
1680 p_period_unit => p_rec.period_unit
1681 );
1682
1683 chk_period_type
1684 (p_time_definition_id => p_rec.time_definition_id,
1685 p_object_version_number => p_rec.object_version_number,
1686 p_definition_type => p_rec.definition_type,
1687 p_period_type => p_rec.period_type
1688 );
1689
1690 chk_period_unit
1691 (p_time_definition_id => p_rec.time_definition_id,
1692 p_object_version_number => p_rec.object_version_number,
1693 p_definition_type => p_rec.definition_type,
1694 p_period_unit => p_rec.period_unit
1695 );
1696
1697 chk_day_adjustment
1698 (p_time_definition_id => p_rec.time_definition_id,
1702 );
1699 p_object_version_number => p_rec.object_version_number,
1700 p_definition_type => p_rec.definition_type,
1701 p_day_adjustment => p_rec.day_adjustment
1703
1704 chk_period_time_definition_id
1705 (p_time_definition_id => p_rec.time_definition_id,
1706 p_object_version_number => p_rec.object_version_number,
1707 p_definition_type => p_rec.definition_type,
1708 p_period_time_definition_id => p_rec.period_time_definition_id,
1709 p_business_group_id => p_rec.business_group_id,
1710 p_legislation_code => p_rec.legislation_code
1711 );
1712
1713 --
1714 hr_utility.set_location(' Leaving:'||l_proc, 10);
1715 End insert_validate;
1716 --
1717 -- ----------------------------------------------------------------------------
1718 -- |---------------------------< update_validate >----------------------------|
1719 -- ----------------------------------------------------------------------------
1720 Procedure update_validate
1721 (p_effective_date in date
1722 ,p_rec in pay_tdf_shd.g_rec_type
1723 ,p_regenerate_periods out nocopy boolean
1724 ,p_delete_periods out nocopy boolean
1725 ) is
1726 --
1727 l_proc varchar2(72) := g_package||'update_validate';
1728 l_time_def_usage boolean;
1729 --
1730 Begin
1731 hr_utility.set_location('Entering:'||l_proc, 5);
1732 --
1733 -- Call all supporting business operations
1734 --
1735 --
1736 chk_startup_action(false
1737 ,p_rec.business_group_id
1738 ,p_rec.legislation_code
1739 );
1740
1741 IF hr_startup_data_api_support.g_startup_mode
1742 NOT IN ('GENERIC','STARTUP') THEN
1743 --
1744 -- Validate Important Attributes
1745 --
1746 hr_api.validate_bus_grp_id
1747 (p_business_group_id => p_rec.business_group_id
1748 ,p_associated_column1 => pay_tdf_shd.g_tab_nam
1749 || '.BUSINESS_GROUP_ID');
1750 --
1751 -- After validating the set of important attributes,
1752 -- if Multiple Message Detection is enabled and at least
1753 -- one error has been found then abort further validation.
1754 --
1755 hr_multi_message.end_validation_set;
1756 END IF;
1757 --
1758 --
1759 -- Validate Dependent Attributes
1760 --
1761 l_time_def_usage := chk_time_def_usage
1762 ( p_time_definition_id => p_rec.time_definition_id
1763 ,p_definition_type => p_rec.definition_type
1764 );
1765 --
1766 chk_non_updateable_args
1767 (p_effective_date => p_effective_date
1768 ,p_rec => p_rec
1769 ,p_time_def_used => l_time_def_usage
1770 ,p_regenerate_periods => p_regenerate_periods
1771 ,p_delete_periods => p_delete_periods
1772 );
1773 --
1774 chk_definition_name
1775 (p_time_definition_id => p_rec.time_definition_id,
1776 p_object_version_number => p_rec.object_version_number,
1777 p_definition_name => p_rec.definition_name,
1778 p_business_group_id => p_rec.business_group_id,
1779 p_legislation_code => p_rec.legislation_code
1780 );
1781
1782 chk_start_date
1783 (p_time_definition_id => p_rec.time_definition_id,
1784 p_object_version_number => p_rec.object_version_number,
1785 p_definition_type => p_rec.definition_type,
1786 p_start_date => p_rec.start_date
1787 );
1788
1789 chk_number_of_years
1790 (p_time_definition_id => p_rec.time_definition_id,
1791 p_object_version_number => p_rec.object_version_number,
1792 p_definition_type => p_rec.definition_type,
1793 p_number_of_years => p_rec.number_of_years
1794 );
1795
1796 chk_cross_validations
1797 (p_time_definition_id => p_rec.time_definition_id,
1798 p_object_version_number => p_rec.object_version_number,
1799 p_definition_type => p_rec.definition_type,
1800 p_period_type => p_rec.period_type,
1801 p_period_time_definition_id => p_rec.period_time_definition_id,
1802 p_day_adjustment => p_rec.day_adjustment,
1803 p_period_unit => p_rec.period_unit
1804 );
1805
1806 chk_period_type
1807 (p_time_definition_id => p_rec.time_definition_id,
1808 p_object_version_number => p_rec.object_version_number,
1809 p_definition_type => p_rec.definition_type,
1810 p_period_type => p_rec.period_type
1811 );
1812
1813 chk_period_unit
1814 (p_time_definition_id => p_rec.time_definition_id,
1815 p_object_version_number => p_rec.object_version_number,
1816 p_definition_type => p_rec.definition_type,
1817 p_period_unit => p_rec.period_unit
1818 );
1819
1820 chk_day_adjustment
1821 (p_time_definition_id => p_rec.time_definition_id,
1822 p_object_version_number => p_rec.object_version_number,
1823 p_definition_type => p_rec.definition_type,
1824 p_day_adjustment => p_rec.day_adjustment
1825 );
1826
1827 chk_period_time_definition_id
1828 (p_time_definition_id => p_rec.time_definition_id,
1829 p_object_version_number => p_rec.object_version_number,
1830 p_definition_type => p_rec.definition_type,
1831 p_period_time_definition_id => p_rec.period_time_definition_id,
1832 p_business_group_id => p_rec.business_group_id,
1833 p_legislation_code => p_rec.legislation_code
1834 );
1835 --
1836 hr_utility.set_location(' Leaving:'||l_proc, 10);
1837 End update_validate;
1838 --
1842 Procedure delete_validate
1839 -- ----------------------------------------------------------------------------
1840 -- |---------------------------< delete_validate >----------------------------|
1841 -- ----------------------------------------------------------------------------
1843 (p_rec in pay_tdf_shd.g_rec_type
1844 ) is
1845 --
1846 l_proc varchar2(72) := g_package||'delete_validate';
1847 l_time_def_usage boolean;
1848 --
1849 Begin
1850 hr_utility.set_location('Entering:'||l_proc, 5);
1851 --
1852 --
1853 chk_startup_action(false
1854 ,pay_tdf_shd.g_old_rec.business_group_id
1855 ,pay_tdf_shd.g_old_rec.legislation_code
1856 );
1857 IF hr_startup_data_api_support.g_startup_mode
1858 NOT IN ('GENERIC','STARTUP') THEN
1859 --
1860 -- Validate Important Attributes
1861 --
1862 --
1863 -- After validating the set of important attributes,
1864 -- if Multiple Message Detection is enabled and at least
1865 -- one error has been found then abort further validation.
1866 --
1867 hr_multi_message.end_validation_set;
1868 END IF;
1869 --
1870 -- Call all supporting business operations
1871 --
1872 l_time_def_usage := chk_time_def_usage
1873 ( p_time_definition_id => p_rec.time_definition_id
1874 ,p_definition_type => pay_tdf_shd.g_old_rec.definition_type
1875 );
1876
1877 if l_time_def_usage then
1878
1879 fnd_message.set_name('PAY', 'PAY_34064_FLSA_INV_DELETE');
1880 fnd_message.raise_error;
1881
1882 end if;
1883
1884 hr_utility.set_location(' Leaving:'||l_proc, 10);
1885 End delete_validate;
1886 --
1887 end pay_tdf_bus;