[Home] [Help]
PACKAGE BODY: APPS.PQP_GDA_BUS
Source
1 Package Body pqp_gda_bus as
2 /* $Header: pqgdarhi.pkb 120.0 2005/05/29 01:52 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqp_gda_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_gap_daily_absence_id number default null;
15
16 /*
17 -- Commented out set_security_group_id proc as currently
18 -- the proc in row handler of parent table PQP_GAP_ABSENCE_PLANS
19 -- does the job.
20 --
21 -- ---------------------------------------------------------------------------
22 -- |----------------------< set_security_group_id >--------------------------|
23 -- ---------------------------------------------------------------------------
24 --
25 Procedure set_security_group_id
26 (p_gap_daily_absence_id in number
27 ,p_associated_column1 in varchar2 default null
28 ) is
29 --
30 -- Declare cursor
31 --
32 cursor csr_sec_grp is
33 select pbg.security_group_id,
34 pbg.legislation_code
35 from pqp_gap_daily_absences gda
36 , pqp_gap_absence_plans gap
37 , per_all_assignments_f paa
38 , per_business_groups_perf pbg
39 where gda.gap_daily_absence_id = p_gap_daily_absence_id
40 and gap.gap_absence_plan_id = gda.gap_absence_plan_id
41 and paa.assignment_id = gap.assignment_id
42 and pbg.business_group_id = paa.business_group_id;
43 --
44 -- Declare local variables
45 --
46 l_security_group_id number;
47 l_proc varchar2(72) := g_package||'set_security_group_id';
48 l_legislation_code varchar2(150);
49 --
50 begin
51 --
52 hr_utility.set_location('Entering:'|| l_proc, 10);
53 --
54 -- Ensure that all the mandatory parameter are not null
55 --
56 hr_api.mandatory_arg_error
57 (p_api_name => l_proc
58 ,p_argument => 'gap_daily_absence_id'
59 ,p_argument_value => p_gap_daily_absence_id
60 );
61 --
62 open csr_sec_grp;
63 fetch csr_sec_grp into l_security_group_id
64 , l_legislation_code;
65 --
66 if csr_sec_grp%notfound then
67 --
68 close csr_sec_grp;
69 --
70 -- The primary key is invalid therefore we must error
71 --
72 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
73 hr_multi_message.add
74 (p_associated_column1
75 => nvl(p_associated_column1,'GAP_DAILY_ABSENCE_ID')
76 );
77 --
78 else
79 close csr_sec_grp;
80 --
81 -- Set the security_group_id in CLIENT_INFO
82 --
83 hr_api.set_security_group_id
84 (p_security_group_id => l_security_group_id
85 );
86 --
87 -- Set the sessions legislation context in HR_SESSION_DATA
88 --
89 hr_api.set_legislation_context(l_legislation_code);
90 end if;
91 --
92 hr_utility.set_location(' Leaving:'|| l_proc, 20);
93 --
94 end set_security_group_id;
95 */
96
97 --
98 -- ---------------------------------------------------------------------------
99 -- |---------------------< return_legislation_code >-------------------------|
100 -- ---------------------------------------------------------------------------
101 --
102 Function return_legislation_code
103 (p_gap_daily_absence_id in number
104 )
105 Return Varchar2 Is
106 --
107 -- Declare cursor
108 --
109 cursor csr_leg_code is
110 select pbg.legislation_code
111 from pqp_gap_daily_absences gda
112 , pqp_gap_absence_plans gap
113 , per_all_assignments_f paa
114 , per_business_groups_perf pbg
115 where gda.gap_daily_absence_id = p_gap_daily_absence_id
116 and gap.gap_absence_plan_id = gda.gap_absence_plan_id
117 and paa.assignment_id = gap.assignment_id
118 and pbg.business_group_id = paa.business_group_id;
119 --
120 -- Declare local variables
121 --
122 l_legislation_code varchar2(150);
123 l_proc varchar2(72) := g_package||'return_legislation_code';
124 --
125 Begin
126 --
127 hr_utility.set_location('Entering:'|| l_proc, 10);
128 --
129 -- Ensure that all the mandatory parameter are not null
130 --
131 hr_api.mandatory_arg_error
132 (p_api_name => l_proc
133 ,p_argument => 'gap_daily_absence_id'
134 ,p_argument_value => p_gap_daily_absence_id
135 );
136 --
137 if ( nvl(pqp_gda_bus.g_gap_daily_absence_id, hr_api.g_number)
138 = p_gap_daily_absence_id) then
139 --
140 -- The legislation code has already been found with a previous
141 -- call to this function. Just return the value in the global
142 -- variable.
143 --
144 l_legislation_code := pqp_gda_bus.g_legislation_code;
145 hr_utility.set_location(l_proc, 20);
146 else
147 --
148 -- The ID is different to the last call to this function
149 -- or this is the first call to this function.
150 --
151 open csr_leg_code;
152 fetch csr_leg_code into l_legislation_code;
153 --
154 if csr_leg_code%notfound then
155 --
156 -- The primary key is invalid therefore we must error
157 --
158 close csr_leg_code;
159 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
160 fnd_message.raise_error;
161 end if;
162 hr_utility.set_location(l_proc,30);
163 --
164 -- Set the global variables so the values are
165 -- available for the next call to this function.
166 --
167 close csr_leg_code;
168 pqp_gda_bus.g_gap_daily_absence_id := p_gap_daily_absence_id;
169 pqp_gda_bus.g_legislation_code := l_legislation_code;
170 end if;
171 hr_utility.set_location(' Leaving:'|| l_proc, 40);
172 return l_legislation_code;
173 end return_legislation_code;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |-----------------------< chk_non_updateable_args >------------------------|
177 -- ----------------------------------------------------------------------------
178 -- {Start Of Comments}
179 --
180 -- Description:
181 -- This procedure is used to ensure that non updateable attributes have
182 -- not been updated. If an attribute has been updated an error is generated.
183 --
184 -- Pre Conditions:
185 -- g_old_rec has been populated with details of the values currently in
186 -- the database.
187 --
188 -- In Arguments:
189 -- p_rec has been populated with the updated values the user would like the
190 -- record set to.
191 --
192 -- Post Success:
193 -- Processing continues if all the non updateable attributes have not
194 -- changed.
195 --
196 -- Post Failure:
197 -- An application error is raised if any of the non updatable attributes
198 -- have been altered.
199 --
200 -- {End Of Comments}
201 -- ----------------------------------------------------------------------------
202 Procedure chk_non_updateable_args
203 (p_effective_date in date
204 ,p_rec in pqp_gda_shd.g_rec_type
205 ) IS
206 --
207 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
208 --
209 Begin
210 --
211 -- Only proceed with the validation if a row exists for the current
212 -- record in the HR Schema.
213 --
214 IF NOT pqp_gda_shd.api_updating
215 (p_gap_daily_absence_id => p_rec.gap_daily_absence_id
216 ,p_object_version_number => p_rec.object_version_number
217 ) THEN
218 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
219 fnd_message.set_token('PROCEDURE ', l_proc);
220 fnd_message.set_token('STEP ', '5');
221 fnd_message.raise_error;
222 END IF;
223 --
224 IF nvl(p_rec.gap_absence_plan_id, hr_api.g_number) <>
225 nvl(pqp_gda_shd.g_old_rec.gap_absence_plan_id
226 ,hr_api.g_number
227 ) THEN
228
229 hr_api.argument_changed_error
230 (p_api_name => l_proc
231 ,p_argument => 'GAP_ABSENCE_PLAN_ID'
232 ,p_base_table => pqp_gda_shd.g_tab_nam
233 );
234
235 END IF;
236 --
237 IF nvl(p_rec.absence_date, hr_api.g_date) <>
238 nvl(pqp_gda_shd.g_old_rec.absence_date
239 ,hr_api.g_date
240 ) THEN
241
242 hr_api.argument_changed_error
243 (p_api_name => l_proc
244 ,p_argument => 'ABSENCE_DATE'
245 ,p_base_table => pqp_gda_shd.g_tab_nam
246 );
247
248 END IF;
249 --
250 End chk_non_updateable_args;
251 --
252 -- ---------------------------------------------------------------------------+
253 -- |-----------------------< chk_gap_absence_plan_id >------------------------|
254 -- ---------------------------------------------------------------------------+
255 -- {Start Of Comments}
256 --
257 -- Description:
258 -- This procedure is used to validate gap_absence_plan_id
259 --
260 -- Pre Conditions:
261 --
262 -- In Arguments:
263 -- p_gap_absence_plan_id
264 --
265 -- Post Success:
266 -- Processing continues
267 --
268 -- Post Failure:
269 -- An application error will be raised and processing is
270 -- terminated
271 --
272 -- {End Of Comments}
273 -- ---------------------------------------------------------------------------+
274 Procedure chk_gap_absence_plan_id
275 (p_gap_absence_plan_id in number
276 ) IS
277 --
278 Cursor ChkGAPId is
279 Select 'Y'
280 From pqp_gap_absence_plans gap
281 Where gap.gap_absence_plan_id = p_gap_absence_plan_id;
282 --
283 l_proc varchar2(72) := g_package || 'chk_gap_absence_plan_id';
284 l_GAPValid char(1) := 'N';
285 --
286 Begin
287 --
288 hr_utility.set_location(' Entering: '|| l_proc, 10);
289 --
290 hr_api.mandatory_arg_error
291 (p_api_name => l_proc
292 ,p_argument => 'gap_absence_plan_id'
293 ,p_argument_value => p_gap_absence_plan_id
294 );
295 --
296 hr_utility.set_location(l_proc, 20);
297 --
298 open ChkGAPId;
299 fetch ChkGAPId into l_GAPValid;
300 close ChkGAPId;
301
302 if l_GAPValid = 'N' then
303
304 -- invalid gap absence plan id
305 fnd_message.set_name('PQP', 'PQP_230949_INVALID_GAP_ID');
306 fnd_message.raise_error;
307
308 end if; -- l_GAPValid = 'N'
309 --
310 hr_utility.set_location(' Leaving: '|| l_proc, 30);
311 --
312 end chk_gap_absence_plan_id;
313 --
314 -- ---------------------------------------------------------------------------+
315 -- |-----------------------< chk_absence_date >-------------------------------|
316 -- ---------------------------------------------------------------------------+
317 -- {Start Of Comments}
318 --
319 -- Description:
320 -- This procedure is used to validate absence_date
321 --
322 -- Pre Conditions:
323 --
324 -- In Arguments:
325 -- p_absence_date
326 --
327 -- Post Success:
328 -- Processing continues
329 --
330 -- Post Failure:
331 -- An application error will be raised and processing is
332 -- terminated
333 --
334 -- {End Of Comments}
335 -- ---------------------------------------------------------------------------+
336 Procedure chk_absence_date
337 (p_absence_date in date
338 ) IS
339 --
340 l_proc varchar2(72) := g_package || 'chk_absence_date';
341 --
342 Begin
343 --
344 hr_utility.set_location(' Entering: '|| l_proc, 10);
345 --
346 hr_api.mandatory_arg_error
347 (p_api_name => l_proc
348 ,p_argument => 'absence_date'
349 ,p_argument_value => p_absence_date
350 );
351 --
352 hr_utility.set_location(' Leaving: '|| l_proc, 20);
353 --
354 end chk_absence_date;
355 --
356 -- ---------------------------------------------------------------------------+
357 -- |-----------------------< chk_work_pattern_day_type >----------------------|
358 -- ---------------------------------------------------------------------------+
359 -- {Start Of Comments}
360 --
361 -- Description:
362 -- This procedure is used to validate work_pattern_day_type against
363 -- HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE is
364 -- 'PQP_GAP_WORK_PATTERN_DAY_TYPE'.
365 --
366 -- Pre Conditions:
367 --
368 -- In Arguments:
369 -- p_effective_date
370 -- p_work_pattern_day_type
371 --
372 -- Post Success:
373 -- Processing continues
374 --
375 -- Post Failure:
376 -- An application error will be raised and processing is
377 -- terminated
378 --
379 -- {End Of Comments}
380 -- ---------------------------------------------------------------------------+
381 Procedure chk_work_pattern_day_type
382 (p_gap_daily_absence_id in number
383 ,p_work_pattern_day_type in varchar2
384 ,p_effective_date in date
385 ) IS
386 --
387 l_proc varchar2(72) := g_package || 'chk_work_pattern_day_type';
388 --
389 Begin
390 --
391 hr_utility.set_location(' Entering: '|| l_proc, 10);
392 --
393 hr_api.mandatory_arg_error
394 (p_api_name => l_proc
395 ,p_argument => 'effective_date'
396 ,p_argument_value => p_effective_date
397 );
398 --
399 hr_api.mandatory_arg_error
400 (p_api_name => l_proc
401 ,p_argument => 'work_pattern_day_type'
402 ,p_argument_value => p_work_pattern_day_type
403 );
404 --
405 hr_utility.set_location(l_proc, 20);
406 --
407 if (((p_gap_daily_absence_id is not null) and
408 nvl(pqp_gda_shd.g_old_rec.work_pattern_day_type,
409 hr_api.g_varchar2) <> nvl(p_work_pattern_day_type,
410 hr_api.g_varchar2))
411 or
412 (p_gap_daily_absence_id is null)) then
413
414 hr_utility.set_location(l_proc, 30);
415 --
416 if hr_api.not_exists_in_hr_lookups
417 (p_effective_date => p_effective_date
418 ,p_lookup_type => 'PQP_GAP_WORK_PATTERN_DAY_TYPE'
419 ,p_lookup_code => p_work_pattern_day_type
420 ) then
421
422 -- Invalid work Pattern Day Type
423 fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
424 fnd_message.set_token('COLUMN_NAME', 'WORK_PATTERN_DAY_TYPE');
425 fnd_message.raise_error;
426
427 end if; -- hr_api.not_exists_in_hr_lookups
428 --
429 hr_utility.set_location(l_proc, 40);
430 --
431 end if; -- (((p_gap_daily_absence_id is not null) and...
432 --
433 hr_utility.set_location(' Leaving: '|| l_proc, 50);
434 --
435 end chk_work_pattern_day_type;
436 --
437 -- ---------------------------------------------------------------------------+
438 -- |-----------------------< chk_level_of_entitlement >-----------------------|
439 -- ---------------------------------------------------------------------------+
440 -- {Start Of Comments}
441 --
442 -- Description:
443 -- This procedure is used to validate level_of_entitlement against
444 -- HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE is
445 -- 'PQP_GAP_ENTITLEMENT_BANDS'.
446 --
447 -- Pre Conditions:
448 --
449 -- In Arguments:
450 -- p_effective_date
451 -- p_level_of_entitlement
452 --
453 -- Post Success:
454 -- Processing continues
455 --
456 -- Post Failure:
457 -- An application error will be raised and processing is
458 -- terminated
459 --
460 -- {End Of Comments}
461 -- ---------------------------------------------------------------------------+
462 Procedure chk_level_of_entitlement
463 (p_gap_daily_absence_id in number
464 ,p_level_of_entitlement in varchar2
465 ,p_effective_date in date
466 ) IS
467 --
468 l_proc varchar2(72) := g_package || 'chk_level_of_entitlement';
469 --
470 Begin
471 --
472 hr_utility.set_location(' Entering: '|| l_proc, 10);
473 --
474 hr_api.mandatory_arg_error
475 (p_api_name => l_proc
476 ,p_argument => 'effective_date'
477 ,p_argument_value => p_effective_date
478 );
479 --
480 hr_api.mandatory_arg_error
481 (p_api_name => l_proc
482 ,p_argument => 'level_of_entitlement'
483 ,p_argument_value => p_level_of_entitlement
484 );
485 --
486 hr_utility.set_location(l_proc, 20);
487 --
488 if (((p_gap_daily_absence_id is not null) and
489 nvl(pqp_gda_shd.g_old_rec.level_of_entitlement,
490 hr_api.g_varchar2) <> nvl(p_level_of_entitlement,
491 hr_api.g_varchar2))
492 or
493 (p_gap_daily_absence_id is null)) then
494
495 hr_utility.set_location(l_proc, 30);
496 --
497 if hr_api.not_exists_in_hr_lookups
498 (p_effective_date => p_effective_date
499 ,p_lookup_type => 'PQP_GAP_ENTITLEMENT_BANDS'
500 ,p_lookup_code => p_level_of_entitlement
501 ) then
502
503 -- Invalid Level of Entitlement
504 fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
505 fnd_message.set_token('COLUMN_NAME', 'LEVEL_OF_ENTITLEMENT');
506 fnd_message.raise_error;
507
508 end if; -- hr_api.not_exists_in_hr_lookups
509 --
510 hr_utility.set_location(l_proc, 40);
511 --
512 end if; -- (((p_gap_daily_absence_id is not null) and...
513 --
514 hr_utility.set_location(' Leaving: '|| l_proc, 50);
515 --
516 end chk_level_of_entitlement;
517 --
518 -- ---------------------------------------------------------------------------+
519 -- |-----------------------< chk_level_of_pay >-----------------------|
520 -- ---------------------------------------------------------------------------+
521 -- {Start Of Comments}
522 --
523 -- Description:
524 -- This procedure is used to validate level_of_pay against
525 -- HR_LOOKUP.LOOKUP_CODE in any one of the following
526 -- LOOKUP_TYPEs
527 -- 'PQP_GB_OSP_CALENDAR_RULES', 'PQP_GB_OMP_CALENDAR_RULES' and
528 -- 'PQP_GAP_ENTITLEMENT_BANDS'
529 --
530 -- Pre Conditions:
531 --
532 -- In Arguments:
533 -- p_effective_date
534 -- p_level_of_pay
535 --
536 -- Post Success:
537 -- Processing continues
538 --
539 -- Post Failure:
540 -- An application error will be raised and processing is
541 -- terminated
542 --
543 -- {End Of Comments}
544 -- ---------------------------------------------------------------------------+
545 Procedure chk_level_of_pay
546 (p_gap_daily_absence_id in number
547 ,p_level_of_pay in varchar2
548 ,p_effective_date in date
549 ) IS
550 --
551 l_proc varchar2(72) := g_package || 'chk_level_of_pay';
552 --
553 Begin
554 --
555 hr_utility.set_location(' Entering: '|| l_proc, 10);
556 --
557 hr_api.mandatory_arg_error
558 (p_api_name => l_proc
559 ,p_argument => 'effective_date'
560 ,p_argument_value => p_effective_date
561 );
562 --
563 hr_api.mandatory_arg_error
564 (p_api_name => l_proc
565 ,p_argument => 'level_of_pay'
566 ,p_argument_value => p_level_of_pay
567 );
568 --
569 hr_utility.set_location(l_proc, 20);
570 --
571 if (((p_gap_daily_absence_id is not null) and
572 nvl(pqp_gda_shd.g_old_rec.level_of_pay,
573 hr_api.g_varchar2) <> nvl(p_level_of_pay,
574 hr_api.g_varchar2))
575 or
576 (p_gap_daily_absence_id is null)) then
577
578 hr_utility.set_location(l_proc, 30);
579 --
580 if hr_api.not_exists_in_hr_lookups
581 (p_effective_date => p_effective_date
582 ,p_lookup_type => 'PQP_GB_OSP_CALENDAR_RULES'
583 ,p_lookup_code => p_level_of_pay
584 ) then
585
586 hr_utility.set_location(l_proc, 40);
587 --
588 if hr_api.not_exists_in_hr_lookups
589 (p_effective_date => p_effective_date
590 ,p_lookup_type => 'PQP_GB_OMP_CALENDAR_RULES'
591 ,p_lookup_code => p_level_of_pay
592 ) then
593
594 hr_utility.set_location(l_proc, 50);
595 --
596 if hr_api.not_exists_in_hr_lookups
597 (p_effective_date => p_effective_date
598 ,p_lookup_type => 'PQP_GAP_ENTITLEMENT_BANDS'
599 ,p_lookup_code => p_level_of_pay
600 ) then
601
602 -- Invalid work Level of Pay
603 fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
604 fnd_message.set_token('COLUMN_NAME', 'LEVEL_OF_PAY');
605 fnd_message.raise_error;
606 --
607 end if; -- PQP_GAP_ENTITLEMENT_BANDS
608 --
609 end if; -- PQP_GB_OMP_CALENDAR_RULES
610 --
611 end if; -- PQP_GB_OSP_CALENDAR_RULES
612 --
613 hr_utility.set_location(l_proc, 60);
614 --
615 end if; -- (((p_gap_daily_absence_id is not null) and...
616 --
617 hr_utility.set_location(' Leaving: '|| l_proc, 70);
618 --
619 end chk_level_of_pay;
620 --
621 -- ---------------------------------------------------------------------------+
622 -- |-----------------------< chk_duration >-----------------------------------|
623 -- ---------------------------------------------------------------------------+
624 -- {Start Of Comments}
625 --
626 -- Description:
627 -- This procedure is used to validate duration
628 --
629 -- Pre Conditions:
630 --
631 -- In Arguments:
632 -- p_gap_daily_absence_id
633 -- p_duration
634 --
635 -- Post Success:
636 -- Processing continues
637 --
638 -- Post Failure:
639 -- An application error will be raised and processing is
640 -- terminated
641 --
642 -- {End Of Comments}
643 -- ---------------------------------------------------------------------------+
644 Procedure chk_duration
645 (p_gap_daily_absence_id in number
646 ,p_duration in number
647 ) IS
648 --
649 l_proc varchar2(72) := g_package || 'chk_duration';
650 --
651 Begin
652 --
653 hr_utility.set_location(' Entering: '|| l_proc, 10);
654 --
655 hr_api.mandatory_arg_error
656 (p_api_name => l_proc
657 ,p_argument => 'duration'
658 ,p_argument_value => p_duration
659 );
660 --
661 hr_utility.set_location(l_proc, 20);
662 --
663 if (((p_gap_daily_absence_id is not null) and
664 nvl(pqp_gda_shd.g_old_rec.duration,
665 hr_api.g_number) <> nvl(p_duration,
666 hr_api.g_number))
667 or
668 (p_gap_daily_absence_id is null)) then
669
670 hr_utility.set_location(l_proc, 30);
671 --
672 if NOT (p_duration between 0 and 1) then
673
674 -- invalid duration
675 fnd_message.set_name('PQP', 'PQP_230950_INVALID_DURATION');
676 fnd_message.raise_error;
677
678 end if; -- NOT (p_duration between 0 and 1)
679 --
680 hr_utility.set_location(l_proc, 40);
681 --
682 end if; -- (((p_gap_daily_absence_id is not null) and...
683 --
684 hr_utility.set_location(' Leaving: '|| l_proc, 50);
685 --
686 end chk_duration;
687 --
688 -- ---------------------------------------------------------------------------+
689 -- |-----------------------< chk_duration_in_hours >--------------------------|
690 -- ---------------------------------------------------------------------------+
691 -- {Start Of Comments}
692 --
693 -- Description:
694 -- This procedure is used to validate duration_in_hours
695 --
696 -- Pre Conditions:
697 --
698 -- In Arguments:
699 -- p_gap_daily_absence_id
700 -- p_duration_in_hours
701 --
702 -- Post Success:
703 -- Processing continues
704 --
705 -- Post Failure:
706 -- An application error will be raised and processing is
707 -- terminated
708 --
709 -- {End Of Comments}
710 -- ---------------------------------------------------------------------------+
711 Procedure chk_duration_in_hours
712 (p_gap_daily_absence_id in number
713 ,p_duration_in_hours in number
714 ) IS
715 --
716 l_proc varchar2(72) := g_package || 'chk_duration_in_hours';
717 --
718 Begin
719 --
720 hr_utility.set_location(' Entering: '|| l_proc, 10);
721 --
722 -- Duration_in_hours is mandatory only while inserting
723 -- because this is a new column and existing customers
724 -- will not have data in this column hence we cannot
725 -- enforce this while updating
726 if p_gap_daily_absence_id is null then
727 hr_api.mandatory_arg_error
728 (p_api_name => l_proc
729 ,p_argument => 'duration_in_hours'
730 ,p_argument_value => p_duration_in_hours
731 );
732 end if;
733 --
734 hr_utility.set_location(l_proc, 20);
735 --
736 if (((p_gap_daily_absence_id is not null) and
737 nvl(pqp_gda_shd.g_old_rec.duration_in_hours,
738 hr_api.g_number) <> nvl(p_duration_in_hours,
739 hr_api.g_number))
740 or
741 (p_gap_daily_absence_id is null)) then
742
743 hr_utility.set_location(l_proc, 30);
744 --
745 if NOT (p_duration_in_hours between 0 and 24) then
746
747 -- invalid duration_in_hours
748 fnd_message.set_name('PQP', 'PQP_230951_INV_DURATION_IN_HRS');
749 fnd_message.raise_error;
750
751 end if; -- NOT (p_duration_in_hours between 0 and 24)
752 --
753 hr_utility.set_location(l_proc, 40);
754 --
755 end if; -- (((p_gap_daily_absence_id is not null) and...
756 --
757 hr_utility.set_location(' Leaving: '|| l_proc, 50);
758 --
759 end chk_duration_in_hours;
760 -- ---------------------------------------------------------------------------+
761 -- |-----------------------< chk_working_days_per_week >----------------------|
762 -- ---------------------------------------------------------------------------+
763 -- {Start Of Comments}
764 --
765 -- Description:
766 -- This procedure is used to validate working_days_per_week
767 --
768 -- Pre Conditions:
769 --
770 -- In Arguments:
771 -- p_gap_daily_absence_id
772 -- p_working_days_per_week
773 --
774 -- Post Success:
775 -- Processing continues
776 --
777 -- Post Failure:
778 -- An application error will be raised and processing is
779 -- terminated
780 --
781 -- {End Of Comments}
782 -- ---------------------------------------------------------------------------+
783 Procedure chk_working_days_per_week
784 (p_gap_daily_absence_id in number
785 ,p_working_days_per_week in number
786 ) IS
787 --
788 l_proc varchar2(72) := g_package || 'chk_working_days_per_week';
789 --
790 Begin
791 --
792 hr_utility.set_location(' Entering: '|| l_proc, 10);
793 --
794 -- Working_Days_Per_Week is mandatory only while inserting
795 -- because this is a new column and existing customers
796 -- will not have data in this column hence we cannot
797 -- enforce this while updating
798 if p_gap_daily_absence_id is null then
799 hr_api.mandatory_arg_error
800 (p_api_name => l_proc
801 ,p_argument => 'working_days_per_week'
802 ,p_argument_value => p_working_days_per_week
803 );
804 end if;
805 --
806 hr_utility.set_location(l_proc, 20);
807 --
808 if (((p_gap_daily_absence_id is not null) and
809 nvl(pqp_gda_shd.g_old_rec.working_days_per_week,
810 hr_api.g_number) <> nvl(p_working_days_per_week,
811 hr_api.g_number))
812 or
813 (p_gap_daily_absence_id is null)) then
814
815 hr_utility.set_location(l_proc, 30);
816 --
817 if (p_working_days_per_week <= 0 -- Must be greater than 0
818 or
819 p_working_days_per_week > 7 -- Must be 7 or less
820 ) then
821
822 -- invalid working_days_per_week
823 fnd_message.set_name('PQP', 'PQP_230094_INV_WRKDAYS_PERWEEK');
824 fnd_message.raise_error;
825
826 end if; -- (p_working_days_per_week <= 0..
827 --
828 hr_utility.set_location(l_proc, 40);
829 --
830 end if; -- (((p_gap_daily_absence_id is not null) and...
831 --
832 hr_utility.set_location(' Leaving: '|| l_proc, 50);
833 --
834 end chk_working_days_per_week;
835 --
836 -- LG below Procedure added
837 -- ---------------------------------------------------------------------------+
838 -- |--------------------------------< chk_fte >-------------------------------|
839 -- ---------------------------------------------------------------------------+
840 -- {Start Of Comments}
841 --
842 -- Description:
843 -- This procedure is used to validate fte
844 --
845 -- Pre Conditions:
846 --
847 -- In Arguments:
848 -- p_gap_daily_absence_id
849 -- p_fte
850 --
851 -- Post Success:
852 -- Processing continues
853 --
854 -- Post Failure:
855 -- An application error will be raised and processing is
856 -- terminated
857 --
858 -- {End Of Comments}
859 -- ---------------------------------------------------------------------------+
860 Procedure chk_fte
861 (p_gap_daily_absence_id in number
862 ,p_fte in number
863 ) IS
864 --
865 l_proc varchar2(72) := g_package || 'chk_fte';
866 --
867 Begin
868 --
869 hr_utility.set_location(' Entering: '|| l_proc, 10);
870 --
871 -- fte is mandatory only while inserting
872 -- because this is a new column and existing customers
873 -- will not have data in this column hence we cannot
874 -- enforce this while updating
875 if p_gap_daily_absence_id is null then
876 hr_api.mandatory_arg_error
877 (p_api_name => l_proc
878 ,p_argument => 'fte'
879 ,p_argument_value => p_fte
880 );
881 end if;
882 --
883 hr_utility.set_location(l_proc, 20);
884 --
885 if (((p_gap_daily_absence_id is not null) and
886 nvl(pqp_gda_shd.g_old_rec.fte,hr_api.g_number)
887 <> nvl(p_fte, hr_api.g_number))
888 or
889 (p_gap_daily_absence_id is null)) then
890
891 hr_utility.set_location(l_proc, 30);
892 --
893 if (p_fte <= 0 -- Must be greater than 0
894 or
895 p_fte > 7 -- Must be 7 or less
896 ) then
897
898 -- invalid working_days_per_week
899 fnd_message.set_name('PQP', 'PQP_230094_INV_FTE');
900 fnd_message.raise_error;
901
902 end if; -- (p_working_days_per_week <= 0..
903 --
904 hr_utility.set_location(l_proc, 40);
905 --
906 end if; -- (((p_gap_daily_absence_id is not null) and...
907 --
908 hr_utility.set_location(' Leaving: '|| l_proc, 50);
909 --
910 end chk_fte;
911 --
912 -- ----------------------------------------------------------------------------
913 -- |---------------------------< insert_validate >----------------------------|
914 -- ----------------------------------------------------------------------------
915 Procedure insert_validate
916 (p_effective_date in date
917 ,p_rec in pqp_gda_shd.g_rec_type
918 ) is
919 --
920 l_proc varchar2(72) := g_package||'insert_validate';
921 --
922 Begin
923 hr_utility.set_location('Entering:'||l_proc, 5);
924 --
925 -- Call all supporting business operations
926 --
927
928 -- Calling set_securit_group_id from row handler of parent
929 -- table PQP_GAP_ABSENCE_PLANS as FK is available
930 pqp_gap_bus.set_security_group_id
931 (p_gap_absence_plan_id => p_rec.gap_absence_plan_id
932 );
933 --
934 -- Validate Dependent Attributes
935 --
936 chk_gap_absence_plan_id
937 (p_gap_absence_plan_id => p_rec.gap_absence_plan_id
938 );
939 --
940 chk_absence_date
941 (p_absence_date => p_rec.absence_date
942 );
943 --
944 chk_work_pattern_day_type
945 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
946 ,p_work_pattern_day_type => p_rec.work_pattern_day_type
947 ,p_effective_date => p_effective_date
948 );
949 --
950 chk_level_of_entitlement
951 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
952 ,p_level_of_entitlement => p_rec.level_of_entitlement
953 ,p_effective_date => p_effective_date
954 );
955 --
956 chk_level_of_pay
957 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
958 ,p_level_of_pay => p_rec.level_of_pay
959 ,p_effective_date => p_effective_date
960 );
961 --
962 chk_duration
963 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
964 ,p_duration => p_rec.duration
965 );
966 --
967 chk_duration_in_hours
968 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
969 ,p_duration_in_hours => p_rec.duration_in_hours
970 );
971 --
972 chk_working_days_per_week
973 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
974 ,p_working_days_per_week => p_rec.working_days_per_week
975 );
976 -- -- LG added chk_fte call
977 chk_fte
978 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
979 ,p_fte => p_rec.fte
980 );
981 --
982 hr_utility.set_location(' Leaving:'||l_proc, 10);
983 End insert_validate;
984 --
985 -- ----------------------------------------------------------------------------
986 -- |---------------------------< update_validate >----------------------------|
987 -- ----------------------------------------------------------------------------
988 Procedure update_validate
989 (p_effective_date in date
990 ,p_rec in pqp_gda_shd.g_rec_type
991 ) is
992 --
993 l_proc varchar2(72) := g_package||'update_validate';
994 --
995 Begin
996 hr_utility.set_location('Entering:'||l_proc, 5);
997 --
998 -- Call all supporting business operations
999 --
1000
1001 -- Calling set_securit_group_id from row handler of parent
1002 -- table PQP_GAP_ABSENCE_PLANS as FK is available
1003 pqp_gap_bus.set_security_group_id
1004 (p_gap_absence_plan_id => p_rec.gap_absence_plan_id
1005 );
1006
1007 --
1008 -- Validate Dependent Attributes
1009 --
1010 chk_non_updateable_args
1011 (p_effective_date => p_effective_date
1012 ,p_rec => p_rec
1013 );
1014 --
1015 chk_gap_absence_plan_id
1016 (p_gap_absence_plan_id => p_rec.gap_absence_plan_id
1017 );
1018 --
1019 chk_absence_date
1020 (p_absence_date => p_rec.absence_date
1021 );
1022 --
1023 chk_work_pattern_day_type
1024 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1025 ,p_work_pattern_day_type => p_rec.work_pattern_day_type
1026 ,p_effective_date => p_effective_date
1027 );
1028 --
1029 chk_level_of_entitlement
1030 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1031 ,p_level_of_entitlement => p_rec.level_of_entitlement
1032 ,p_effective_date => p_effective_date
1033 );
1034 --
1035 chk_level_of_pay
1036 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1037 ,p_level_of_pay => p_rec.level_of_pay
1038 ,p_effective_date => p_effective_date
1039 );
1040 --
1041 chk_duration
1042 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1043 ,p_duration => p_rec.duration
1044 );
1045 --
1046 chk_duration_in_hours
1047 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1048 ,p_duration_in_hours => p_rec.duration_in_hours
1049 );
1050 chk_working_days_per_week
1051 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1052 ,p_working_days_per_week => p_rec.working_days_per_week
1053 );
1054 -- LG added below call to chk_fte
1055 chk_fte
1056 (p_gap_daily_absence_id => p_rec.gap_absence_plan_id
1057 ,p_fte => p_rec.fte
1058 );
1059 --
1060 hr_utility.set_location(' Leaving:'||l_proc, 10);
1061 End update_validate;
1062 --
1063 -- ----------------------------------------------------------------------------
1064 -- |---------------------------< delete_validate >----------------------------|
1065 -- ----------------------------------------------------------------------------
1066 Procedure delete_validate
1067 (p_rec in pqp_gda_shd.g_rec_type
1068 ) is
1069 --
1070 l_proc varchar2(72) := g_package||'delete_validate';
1071 --
1072 Begin
1073 hr_utility.set_location('Entering:'||l_proc, 5);
1074 --
1075 -- Call all supporting business operations
1076 --
1077 hr_utility.set_location(' Leaving:'||l_proc, 10);
1078 End delete_validate;
1079 --
1080 end pqp_gda_bus;