DBA Data[Home] [Help]

PACKAGE BODY: APPS.AME_ATY_BUS

Source


1 Package Body ame_aty_bus as
2 /* $Header: amatyrhi.pkb 120.4 2005/11/22 03:14 santosin noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ame_aty_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_action_type_id              number         default null;
15 --
16 -- ----------------------------------------------------------------------------
17 -- |-----------------------< chk_non_updateable_args >------------------------|
18 -- ----------------------------------------------------------------------------
19 -- {Start Of Comments}
20 --
21 -- Description:
22 --   This procedure is used to ensure that non updateable attributes have
23 --   not been updated. If an attribute has been updated an error is generated.
24 --
25 -- Pre Conditions:
26 --   g_old_rec has been populated with details of the values currently in
27 --   the database.
28 --
29 -- In Arguments:
30 --   p_rec has been populated with the updated values the user would like the
31 --   record set to.
32 --
33 -- Post Success:
34 --   Processing continues if all the non updateable attributes have not
35 --   changed.
36 --
37 -- Post Failure:
38 --   An application error is raised if any of the non updatable attributes
39 --   have been altered.
40 --
41 -- {End Of Comments}
42 -- ----------------------------------------------------------------------------
43 Procedure chk_non_updateable_args
44   (p_effective_date  in date
45   ,p_rec             in ame_aty_shd.g_rec_type
46   ) IS
47 --
48   createdBy  ame_action_types.created_by%type;
49   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
50   l_error    EXCEPTION;
51   l_argument varchar2(30);
52 --
53 Begin
54   --
55   -- Only proceed with the validation if a row exists for the current
56   -- record in the HR Schema.
57   --
58   IF NOT ame_aty_shd.api_updating
59       (p_action_type_id =>  p_rec.action_type_id
60       ,p_effective_date                   => p_effective_date
61       ,p_object_version_number            => p_rec.object_version_number
62       ) THEN
63      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
64      fnd_message.set_token('PROCEDURE ', l_proc);
65      fnd_message.set_token('STEP ', '5');
66      fnd_message.raise_error;
67   END IF;
68   -- EDIT_HERE: Add checks to ensure non-updateable args have
69   -- not been updated.
70   select ame_utility_pkg.is_seed_user(created_by)
71     into createdBy
72     from ame_action_types
73     where
74       action_type_id = p_rec.action_type_id and
75       p_effective_date between start_date and
76          nvl(end_date - ame_util.oneSecond, p_effective_date);
77   IF createdBy = ame_util.seededDataCreatedById
78      and ame_utility_pkg.check_seeddb = 'N' then
79     IF
80 		  nvl(p_rec.name,
81 		      hr_api.g_number) <>
82       nvl(ame_aty_shd.g_old_rec.name,
83 			    hr_api.g_number) then
84       l_argument := 'name';
85       RAISE l_error;
86     ELSIF
87 		  nvl(p_rec.procedure_name,
88           hr_api.g_number) <>
89       nvl(ame_aty_shd.g_old_rec.procedure_name,
90           hr_api.g_number) then
91       l_argument := 'procedure_name';
92       RAISE l_error;
93     ELSIF
94       nvl(p_rec.description,
95           hr_api.g_number) <>
96       nvl(ame_aty_shd.g_old_rec.description,
97           hr_api.g_number) then
98       l_argument := 'description';
99       RAISE l_error;
100     ELSIF
101       nvl(p_rec.dynamic_description,
102           hr_api.g_number) <>
103       nvl(ame_aty_shd.g_old_rec.dynamic_description,
104           hr_api.g_number) then
105       l_argument := 'dynamic_description';
106       RAISE l_error;
107     END IF;
108   END IF;
109   EXCEPTION
110     WHEN l_error THEN
111        hr_api.argument_changed_error
112          (p_api_name => l_proc
113          ,p_argument => l_argument);
114     WHEN OTHERS THEN
115        RAISE;
116   --
117 End chk_non_updateable_args;
118 --
119 --  ---------------------------------------------------------------------------
120 --  |----------------------<           chk_name    >--------------------------|
121 --  ---------------------------------------------------------------------------
122 --
123 --  {Start Of Comments}
124 --
125 -- Description:
126 --   Validates that the action type name is not null and does not already exist.
127 --
128 -- Prerequisites:
129 --   None.
130 --
131 -- In Parameters:
132 --   p_effective_date
133 --   p_name
134 --
135 -- Post Success:
136 --   Processing continues if action type name is unique.
137 --
138 -- Post Failure:
139 --   Log the error message.
140 --
141 -- Developer Implementation Notes:
142 --   None.
143 --
144 -- Access Status:
145 --   Internal Row Handler Use Only.
146 --
147 -- {End Of Comments}
148 -- ----------------------------------------------------------------------------
149 procedure chk_name
150   (p_effective_date        in date,
151    p_name in ame_action_types.name%type) is
152   l_proc              varchar2(72)  :=  g_package||'chk_name';
153   cursor c_sel1 is
154     select null
155       from ame_action_types
156       where
157         name = p_name and
158         p_effective_date between start_date and
159                  nvl(end_date - ame_util.oneSecond, p_effective_date) ;
160   l_exists varchar2(1);
161 begin
162   hr_api.mandatory_arg_error
163     (p_api_name       => l_proc
164     ,p_argument       => 'name'
165     ,p_argument_value => p_name
166     );
167   open c_sel1;
168   fetch c_sel1 into l_exists;
169   if c_sel1%found then
170      close c_sel1;
171      -- AT MESSAGE
172      -- The action type name specified is already exists
173      fnd_message.set_name('PER','AME_400610_ACT_TYP_NAME_EXISTS');
174      fnd_message.raise_error;
175   end if;
176   close c_sel1;
177 exception
178    when app_exception.application_exception then
179      if hr_multi_message.exception_add
180        (p_associated_column1 => 'NAME') then
181        hr_utility.set_location(' Leaving:'|| l_proc, 50);
182        raise;
183      end if;
184      hr_utility.set_location(' Leaving:'|| l_proc, 60);
188 --  |----------------------< chk_description>--------------------------|
185 end chk_name;
186 --
187 --  ---------------------------------------------------------------------------
189 --  ---------------------------------------------------------------------------
190 --
191 --  {Start Of Comments}
192 --
193 -- Description:
194 --   Validates description to ensure non null values
195 --
196 -- Prerequisites:
197 --   None.
198 --
199 -- In Parameters:
200 --   p_description
201 --
202 -- Post Success:
203 --   Processing continues if description is valid.
204 --
205 -- Post Failure:
206 --   Log the error message.
207 --
208 -- Developer Implementation Notes:
209 --   None.
210 ----
211 -- Access Status:
212 --   Internal Row Handler Use Only.
213 --
214 -- {End Of Comments}
215 -- ----------------------------------------------------------------------------
216 procedure chk_description
217   (p_description in varchar2
218     ) is
219   l_proc  varchar2(72)  :=  g_package||'chk_description';
220 begin
221   hr_api.mandatory_arg_error
222     (p_api_name       => l_proc,
223      p_argument       => 'description',
224      p_argument_value => p_description);
225  exception
226    when app_exception.application_exception then
227      if hr_multi_message.exception_add
228           (p_associated_column1 => 'DESCRIPTION') then
229        hr_utility.set_location(' Leaving:'|| l_proc, 50);
230        raise;
231      end if;
232      hr_utility.set_location(' Leaving:'|| l_proc, 60);
233 end chk_description;
234 --
235 --  ---------------------------------------------------------------------------
236 --  |----------------------<    chk_procedure_name  >--------------------------|
237 --  ---------------------------------------------------------------------------
238 --
239 --  {Start Of Comments}
240 --
241 -- Description:
242 --   Validates that the action type procedure name is not null and
243 --   does not already exist.
244 --
245 -- Prerequisites:
246 --   None.
247 --
248 -- In Parameters:
249 --   p_effective_date
250 --   p_procedure_name
251 --
252 -- Post Success:
253 --   Processing continues if action type procedure name is unique.
254 --
255 -- Post Failure:
256 --   Log the error message.
257 --
258 -- Developer Implementation Notes:
259 --   None.
260 --
261 -- Access Status:
262 --   Internal Row Handler Use Only.
263 --
264 -- {End Of Comments}
265 -- ----------------------------------------------------------------------------
266 procedure chk_procedure_name
267   (p_effective_date        in date,
268    p_procedure_name in ame_action_types.procedure_name%type) is
269   l_proc              varchar2(72)  :=  g_package||'chk_procedure_name';
270   cursor c_sel1 is
271     select null
272       from ame_action_types
273       where
274         procedure_name = p_procedure_name and
275         p_effective_date between start_date and
276                  nvl(end_date - ame_util.oneSecond, p_effective_date) ;
277   l_exists varchar2(1);
278 begin
279   hr_api.mandatory_arg_error
280     (p_api_name       => l_proc
281     ,p_argument       => 'procedure_name'
282     ,p_argument_value => p_procedure_name
283     );
284   --The following piece of code was commented out to fix bug 4402377
285 /*  open c_sel1;
286   fetch c_sel1 into l_exists;
287   if c_sel1%found then
288     close c_sel1;
289      -- AT MESSAGE
290      -- The procedure name specified already exists
291      fnd_message.set_name('PER','AME_400611_ACT_TYP_HAND_EXISTS');
292      fnd_message.raise_error;
293   end if;
294   close c_sel1;
295 */
296 exception
297    when app_exception.application_exception then
298      if hr_multi_message.exception_add
299        (p_associated_column1 => 'PROCEDURE_NAME') then
300        hr_utility.set_location(' Leaving:'|| l_proc, 50);
301        raise;
302      end if;
303      hr_utility.set_location(' Leaving:'|| l_proc, 60);
304 end chk_procedure_name;
305 --
306 --  ---------------------------------------------------------------------------
307 --  |----------------------< chk_dynamic_description>--------------------------|
308 --  ---------------------------------------------------------------------------
309 --
310 --  {Start Of Comments}
311 --
312 -- Description:
316 --
313 --   Validates that the dynamic description is one of the following:
314 --      ame_util.booleanTrue
315 --      ame_util.booleanFalse
317 -- Prerequisites:
318 --   None.
319 --
320 -- In Parameters:
321 --   p_dynamic_description
322 --
323 -- Post Success:
324 --   Processing continues if dynamic description is valid.
325 --
326 -- Post Failure:
327 --   Log the error message.
328 --
329 -- Developer Implementation Notes:
330 --   None.
331 ----
332 -- Access Status:
333 --   Internal Row Handler Use Only.
334 --
335 -- {End Of Comments}
336 -- ----------------------------------------------------------------------------
337 procedure chk_dynamic_description
338   (p_dynamic_description in ame_util.charType) is
339   l_proc  varchar2(72)  :=  g_package||'chk_dynamic_description';
340 begin
341   if p_dynamic_description not in (ame_util.booleanTrue,
342                                    ame_util.booleanFalse) then
343      -- AT MESSAGE
344      -- The dynamic description specified is invalid
345      fnd_message.set_name('PAY','HR_7777_INVALID_PRIMARY_KEY');
346      fnd_message.raise_error;
347   end if;
348  exception
349    when app_exception.application_exception then
350      if hr_multi_message.exception_add
351           (p_associated_column1 => 'DYNAMIC_DESCRIPTION') then
352        hr_utility.set_location(' Leaving:'|| l_proc, 50);
353        raise;
354      end if;
355      hr_utility.set_location(' Leaving:'|| l_proc, 60);
356 end chk_dynamic_description;
357 --
358 --  ---------------------------------------------------------------------------
359 --  |----------------------< chk_description_query>--------------------------|
360 --  ---------------------------------------------------------------------------
361 --
362 --  {Start Of Comments}
363 --
364 -- Description:
365 --   Validates that the dynamic description query does not contain the
366 --   following:
367 --      ';', '--', '/*', '*/'
368 --
369 -- Prerequisites:
370 --   None.
371 --
372 -- In Parameters:
373 --   p_dynamic_description
374 --   p_description_query
375 --
376 -- Post Success:
377 --   Processing continues if description query is valid.
378 --
379 -- Post Failure:
380 --   Log the error message.
381 --
382 -- Developer Implementation Notes:
383 --   None.
384 ----
385 -- Access Status:
386 --   Internal Row Handler Use Only.
387 --
388 -- {End Of Comments}
389 -- ----------------------------------------------------------------------------
390 procedure chk_description_query
391   (p_dynamic_description in varchar2,
392    p_description_query in ame_util.charType) is
393   l_proc  varchar2(72)  :=  g_package||'chk_description_query';
394   l_valid varchar2(1000);
395 begin
396   IF(p_dynamic_description = ame_util.booleanTrue) then
397     hr_api.mandatory_arg_error
398       (p_api_name       => l_proc,
399        p_argument       => 'description_query',
400        p_argument_value => p_description_query);
401     IF(instrb(p_description_query, ';', 1, 1) > 0) or
402       (instrb(p_description_query, '--', 1, 1) > 0) or
403       (instrb(p_description_query, '/*', 1, 1) > 0) or
404       (instrb(p_description_query, '*/', 1, 1) > 0) then
405        fnd_message.set_name('PER','AME_400372_ACT_DYNAMIC_DESC2');
406        fnd_message.raise_error;
407     END IF;
408     /* Verify that the description query includes at least one of the bind variables */
409     IF(instrb(p_description_query, ame_util.actionParameterOne, 1, 1) = 0) then
410       IF(instrb(p_description_query, ame_util.actionParameterTwo, 1, 1) = 0) then
411 				fnd_message.set_name('PER', 'AME_400370_ACT_DYNAMIC_DESC');
412         fnd_message.raise_error;
413       END IF;
414     END IF;
415     IF(instrb(p_description_query, ':', 1, 1) > 0) then
416       IF(instrb(p_description_query, ame_util.actionParameterOne, 1, 1) = 0) then
417         IF(instrb(p_description_query, ame_util.actionParameterTwo, 1, 1) = 0) then
418           fnd_message.set_name('PER', 'AME_400371_ACT_INV_BIND_VAR');
419           fnd_message.raise_error;
420         END IF;
421       END IF;
422     END IF;
423     ame_util.checkForSqlInjection(queryStringIn => upper(p_description_query));
424     l_valid := ame_utility_pkg.validate_query(p_query_string  => p_description_query
425                                              ,p_columns       => 1
426                                              ,p_object        => ame_util2.actionTypeObject
427                                              );
428     if l_valid <> 'Y' then
429       fnd_message.raise_error;
430     end if;
431   ELSE
432     if(p_description_query is not null) then
433       fnd_message.set_name('PER', 'AME_400721_ACT_DYN_DESC_NULL');
434       fnd_message.raise_error;
435     end if;
436   END IF;
437  exception
438    when app_exception.application_exception then
439      if hr_multi_message.exception_add
440           (p_associated_column1 => 'DESCRIPTION_QUERY') then
441        hr_utility.set_location(' Leaving:'|| l_proc, 50);
442        raise;
443      end if;
444      hr_utility.set_location(' Leaving:'|| l_proc, 60);
445 end chk_description_query;
446 --
447 --  ---------------------------------------------------------------------------
448 --  |----------------------<     chk_delete        >--------------------------|
449 --  ---------------------------------------------------------------------------
450 --
451 --  {Start Of Comments}
452 --
453 -- Description:
454 --   check that 1) Seeded action types cannot be deleted.
455 --              2) Action types cannot have usages.
456 --              3) Action types cannot have actions.
460 --
457 --              4) Action types cannot have approver type usages.
458 --              5) Action types cannot have configs.
459 --              6) Action types cannot have required attributes.
461 -- Prerequisites:
462 --   None.
463 --
464 -- In Parameters:
465 --   p_action_type_id
466 --   p_effective_date
467 --
468 -- Post Success:
469 --   Processing continues.
470 --
471 -- Post Failure:
472 --   Log the error message.
473 --
474 -- Developer Implementation Notes:
475 --   None.
476 --
477 -- Access Status:
478 --   Internal Row Handler Use Only.
479 --
480 -- {End Of Comments}
481 -- ----------------------------------------------------------------------------
482 procedure chk_delete
483   (p_action_type_id   in number,
484    p_effective_date        in date) is
485   l_proc              varchar2(72)  :=  g_package||'chk_delete';
486   tempCount integer;
487   cursor c_sel1 is
488     select null
489       from ame_action_type_usages
490       where
491         action_type_id = p_action_type_id and
492         p_effective_date between start_date and
493                  nvl(end_date - ame_util.oneSecond, p_effective_date);
494   cursor c_sel2 is
495     select null
496       from ame_action_type_config
497       where
498         action_type_id = p_action_type_id and
499         p_effective_date between start_date and
500                  nvl(end_date - ame_util.oneSecond, p_effective_date);
501   cursor c_sel3 is
502     select null
503       from ame_approver_type_usages
504       where
505         action_type_id = p_action_type_id and
506         p_effective_date between start_date and
507                  nvl(end_date - ame_util.oneSecond, p_effective_date);
508   cursor c_sel4 is
509     select null
510       from ame_mandatory_attributes
511       where
512         action_type_id = p_action_type_id and
513         p_effective_date between start_date and
514                  nvl(end_date - ame_util.oneSecond, p_effective_date);
515 	cursor c_sel5 Is
516     select null
517       from ame_action_types
518       where
519 		    action_type_id = p_action_type_id and
520         ame_utility_pkg.is_seed_user(created_by) = ame_util.seededDataCreatedById and
521         ame_utility_pkg.check_seeddb = 'N';
522   cursor c_sel6 Is
523     select null
524       from ame_actions
525         where
526           action_type_id = p_action_type_id and
527           p_effective_date between start_date and
528                  nvl(end_date - ame_util.oneSecond, p_effective_date);
529 	l_exists varchar2(1);
530 begin
531   open c_sel1;
532   fetch  c_sel1 into l_exists;
533   if c_sel1%found then
534     close c_sel1;
535     -- AT MESSAGE
536     -- An action type usage(s) still exists.  You must first delete the action type usage(s)
537     -- before deleting the action type
538     fnd_message.set_name('PER','AME_400597_ACT_TYPE_USG_EXIST');
539     fnd_message.raise_error;
540   end if;
541   close c_sel1;
542   open c_sel2;
543   fetch  c_sel2 into l_exists;
544   if c_sel2%found then
545     close c_sel2;
546     -- AT MESSAGE
547     -- An action type config(s) still exists.  You must first delete the action type config(s)
548     -- before deleting the action type
549     fnd_message.set_name('PER','AME_400608_ACT_TYP_CONF_EXISTS');
550     fnd_message.raise_error;
551   end if;
552   close c_sel2;
553   open c_sel3;
554   fetch  c_sel3 into l_exists;
555   if c_sel3%found then
556     close c_sel3;
557     -- AT MESSAGE
558     -- An apporver type usage(s) still exists.  You must first delete the approver type usage(s)
559     -- before deleting the action type
560     fnd_message.set_name('PER','AME_400612_APPR_USG_EXISTS');
561     fnd_message.raise_error;
562   end if;
563   close c_sel3;
564   open c_sel4;
565   fetch  c_sel4 into l_exists;
566   if c_sel4%found then
567     close c_sel4;
568     -- AT MESSAGE
569     -- Required attribute(s) still exists.  You must first delete the required attribute(s)
570     -- before deleting the action type
571     fnd_message.set_name('PER','AME_400613_REQ_ATTR_EXISTS');
572     fnd_message.raise_error;
573   end if;
574   close c_sel4;
575   -- Seeded action types cannot be deleted
576   open c_sel5;
577   fetch  c_sel5 into l_exists;
578   if c_sel5%found then
579     close c_sel5;
580     -- AT MESSAGE
581     -- Seeded action types cannot be deleted
582     fnd_message.set_name('PER','AME_400601_SD_ACT_TYP_CN_DEL');
583     fnd_message.set_token('TABLE_NAME','ame_action_types');
584     fnd_message.raise_error;
585   end if;
586   close c_sel5;
587   -- Action types with existing actions cannot be deleted.
588   open c_sel6;
589   fetch  c_sel6 into l_exists;
590   if c_sel6%found then
591     close c_sel6;
592     -- AT MESSAGE
593     -- Action types with existing actions cannot be deleted
594     fnd_message.set_name('PER','AME_400602_ACT_EXT_ATYP_CN_DEL');
595     fnd_message.set_token('TABLE_NAME','ame_action_types');
596     fnd_message.raise_error;
597   end if;
598   close c_sel6;
599 exception
600    when app_exception.application_exception then
601      if hr_multi_message.exception_add
602        (p_associated_column1 => 'ACTION_TYPE_ID') then
603        hr_utility.set_location(' Leaving:'|| l_proc, 50);
604        raise;
605      end if;
606      hr_utility.set_location(' Leaving:'|| l_proc, 60);
607 end chk_delete;
608 -- ----------------------------------------------------------------------------
609 -- |--------------------------< dt_update_validate >--------------------------|
613 -- Description:
610 -- ----------------------------------------------------------------------------
611 -- {Start Of Comments}
612 --
614 --   This procedure is used for referential integrity of datetracked
615 --   parent entities when a datetrack update operation is taking place
616 --   and where there is no cascading of update defined for this entity.
617 --
618 -- Prerequisites:
619 --   This procedure is called from the update_validate.
620 --
621 -- In Parameters:
622 --
623 -- Post Success:
624 --   Processing continues.
625 --
626 -- Post Failure:
627 --
628 -- Developer Implementation Notes:
629 --   This procedure should not need maintenance unless the HR Schema model
630 --   changes.
631 --
632 -- Access Status:
633 --   Internal Row Handler Use Only.
634 --
635 -- {End Of Comments}
636 -- ----------------------------------------------------------------------------
637 Procedure dt_update_validate
638   (p_datetrack_mode                in varchar2
639   ,p_validation_start_date         in date
640   ,p_validation_end_date           in date
641   ) Is
642 --
643   l_proc  varchar2(72) := g_package||'dt_update_validate';
644 --
645 Begin
646   --
647   -- Ensure that the p_datetrack_mode argument is not null
648   --
649   hr_api.mandatory_arg_error
650     (p_api_name       => l_proc
651     ,p_argument       => 'datetrack_mode'
652     ,p_argument_value => p_datetrack_mode
653     );
654   --
655   -- Mode will be valid, as this is checked at the start of the upd.
656   --
657   -- Ensure the arguments are not null
658   --
659   hr_api.mandatory_arg_error
660     (p_api_name       => l_proc
661     ,p_argument       => 'validation_start_date'
662     ,p_argument_value => p_validation_start_date
663     );
664   --
665   /*hr_api.mandatory_arg_error
666     (p_api_name       => l_proc
667     ,p_argument       => 'validation_end_date'
668     ,p_argument_value => p_validation_end_date
669     );*/
670   --
671 Exception
672   When Others Then
673     --
674     -- An unhandled or unexpected error has occurred which
675     -- we must report
676     --
677     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
678     fnd_message.set_token('PROCEDURE', l_proc);
679     fnd_message.set_token('STEP','15');
680     fnd_message.raise_error;
681 End dt_update_validate;
682 --
683 -- ----------------------------------------------------------------------------
684 -- |--------------------------< dt_delete_validate >--------------------------|
685 -- ----------------------------------------------------------------------------
686 -- {Start Of Comments}
687 --
688 -- Description:
689 --   This procedure is used for referential integrity of datetracked
690 --   child entities when either a datetrack DELETE or ZAP is in operation
691 --   and where there is no cascading of delete defined for this entity.
692 --   For the datetrack mode of DELETE or ZAP we must ensure that no
693 --   datetracked child rows exist between the validation start and end
694 --   dates.
695 --
696 -- Prerequisites:
697 --   This procedure is called from the delete_validate.
698 --
699 -- In Parameters:
700 --
701 -- Post Success:
702 --   Processing continues.
703 --
704 -- Post Failure:
705 --   If a row exists by determining the returning Boolean value from the
706 --   generic dt_api.rows_exist function then we must supply an error via
707 --   the use of the local exception handler l_rows_exist.
708 --
709 -- Developer Implementation Notes:
710 --   This procedure should not need maintenance unless the HR Schema model
711 --   changes.
712 --
713 -- Access Status:
714 --   Internal Row Handler Use Only.
715 --
716 -- {End Of Comments}
717 -- ----------------------------------------------------------------------------
718 Procedure dt_delete_validate
719   (p_action_type_id                   in number
720   ,p_datetrack_mode                   in varchar2
721   ,p_validation_start_date            in date
722   ,p_validation_end_date              in date
723   ) Is
724 --
725   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
726 --
727 Begin
728   --
729   -- Ensure that the p_datetrack_mode argument is not null
730   --
731   hr_api.mandatory_arg_error
732     (p_api_name       => l_proc
733     ,p_argument       => 'datetrack_mode'
734     ,p_argument_value => p_datetrack_mode
735     );
736   --
737   -- Only perform the validation if the datetrack mode is either
738   -- DELETE or ZAP
739   --
740   If (p_datetrack_mode = hr_api.g_delete or
741       p_datetrack_mode = hr_api.g_zap) then
742     --
743     --
744     -- Ensure the arguments are not null
745     --
746     hr_api.mandatory_arg_error
747       (p_api_name       => l_proc
748       ,p_argument       => 'validation_start_date'
749       ,p_argument_value => p_validation_start_date
750       );
751     --
752     /*hr_api.mandatory_arg_error
753       (p_api_name       => l_proc
754       ,p_argument       => 'validation_end_date'
755       ,p_argument_value => p_validation_end_date
756       );*/
757     --
758     hr_api.mandatory_arg_error
759       (p_api_name       => l_proc
760       ,p_argument       => 'action_type_id'
761       ,p_argument_value => p_action_type_id
762       );
763     --
764   ame_aty_shd.child_rows_exist
765 (p_action_type_id => p_action_type_id
766 ,p_start_date => p_validation_start_date
767 ,p_end_date   => p_validation_end_date);
768 --
769     --
770   End If;
771   --
772 Exception
776     -- we must report
773   When Others Then
774     --
775     -- An unhandled or unexpected error has occurred which
777     --
778     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
779     fnd_message.set_token('PROCEDURE', l_proc);
780     fnd_message.set_token('STEP','15');
781     fnd_message.raise_error;
782   --
783 End dt_delete_validate;
784 --
785 -- ----------------------------------------------------------------------------
786 -- |---------------------------< insert_validate >----------------------------|
787 -- ----------------------------------------------------------------------------
788 Procedure insert_validate
789   (p_rec                   in ame_aty_shd.g_rec_type
790   ,p_effective_date        in date
791   ,p_datetrack_mode        in varchar2
792   ,p_validation_start_date in date
793   ,p_validation_end_date   in date
794   ) is
795 --
796   l_proc        varchar2(72) := g_package||'insert_validate';
797 --
798 Begin
799   hr_utility.set_location('Entering:'||l_proc, 5);
800   --
801   -- Call all supporting business operations
802   -- Description Query
803   if hr_multi_message.no_exclusive_error('DYNAMIC_DESCRIPTION') then
804     chk_description_query(p_dynamic_description => p_rec.dynamic_description,
805                           p_description_query => p_rec.description_query);
806   end if;
807   --
808   -- Name
809   chk_name(p_effective_date => p_effective_date,
810            p_name => p_rec.name);
811   --Description
812   chk_description(p_description => p_rec.description);
813   -- Procedure Name
814   chk_procedure_name(p_effective_date => p_effective_date,
815                      p_procedure_name => p_rec.procedure_name);
816   -- Dynamic Description
817   chk_dynamic_description(p_dynamic_description => p_rec.dynamic_description);
818 	--
819   -- EDIT_HERE: As this table does not have a mandatory business_group_id
820   -- column, ensure client_info is populated by calling a suitable
821   -- ???_???_bus.set_security_group_id procedure, or add one of the following
822   -- comments:
823   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
824   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
825   --
826   -- Validate Dependent Attributes
827   --
828   --
829   hr_utility.set_location(' Leaving:'||l_proc, 10);
830 End insert_validate;
831 --
832 -- ----------------------------------------------------------------------------
833 -- |---------------------------< update_validate >----------------------------|
834 -- ----------------------------------------------------------------------------
835 Procedure update_validate
836   (p_rec                     in ame_aty_shd.g_rec_type
837   ,p_effective_date          in date
838   ,p_datetrack_mode          in varchar2
839   ,p_validation_start_date   in date
840   ,p_validation_end_date     in date
841   ) is
842 --
843   l_proc        varchar2(72) := g_package||'update_validate';
844 --
845 Begin
846   hr_utility.set_location('Entering:'||l_proc, 5);
847   --
848   -- Call all supporting business operations
849   --
850   --
851   -- EDIT_HERE: As this table does not have a mandatory business_group_id
852   -- column, ensure client_info is populated by calling a suitable
853   -- ???_???_bus.set_security_group_id procedure, or add one of the following
854   -- comments:
855   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
856   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
857   --
858   -- Validate Dependent Attributes
859   --
860   -- Call the datetrack update integrity operation
861   --
862   dt_update_validate
863     (p_datetrack_mode                 => p_datetrack_mode
864     ,p_validation_start_date          => p_validation_start_date
865     ,p_validation_end_date            => p_validation_end_date
866     );
867   --
868   chk_non_updateable_args
869     (p_effective_date  => p_effective_date
870     ,p_rec             => p_rec
871     );
872   --Added the following chk proc to fix bug 4402377
873   chk_procedure_name(p_effective_date => p_effective_date,
874                      p_procedure_name => p_rec.procedure_name);
875   --
876   --Description
877   chk_description(p_description => p_rec.description);
878   --Description_query
879   chk_description_query(p_dynamic_description => p_rec.dynamic_description,
880                         p_description_query => p_rec.description_query);
881   hr_utility.set_location(' Leaving:'||l_proc, 10);
882 End update_validate;
883 --
884 -- ----------------------------------------------------------------------------
885 -- |---------------------------< delete_validate >----------------------------|
886 -- ----------------------------------------------------------------------------
887 Procedure delete_validate
888   (p_rec                    in ame_aty_shd.g_rec_type
889   ,p_effective_date         in date
890   ,p_datetrack_mode         in varchar2
891   ,p_validation_start_date  in date
892   ,p_validation_end_date    in date
893   ) is
894 --
895   l_proc        varchar2(72) := g_package||'delete_validate';
896 --
897 Begin
898   hr_utility.set_location('Entering:'||l_proc, 5);
899   --
900   -- Call all supporting business operations
901   -- check if delete operation is allowed.
902   chk_delete(p_action_type_id => p_rec.action_type_id,
903              p_effective_date => p_effective_date);
904   --
905   dt_delete_validate
906     (p_datetrack_mode                   => p_datetrack_mode
907     ,p_validation_start_date            => p_validation_start_date
908     ,p_validation_end_date              => p_validation_end_date
909     ,p_action_type_id =>  p_rec.action_type_id
910     );
914 --
911   --
912   hr_utility.set_location(' Leaving:'||l_proc, 10);
913 End delete_validate;
915 end ame_aty_bus;