DBA Data[Home] [Help]

PACKAGE BODY: APPS.AME_GCF_BUS

Source


1 Package Body ame_gcf_bus as
2 /* $Header: amgcfrhi.pkb 120.5 2006/10/05 16:08:09 pvelugul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ame_gcf_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-------------------------< CHK_APPROVER_TYPE >----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --  This procedure checks if the approver group consists of members of approver
17 --  type not allowed in the current transaction type.
18 --
19 -- Pre-Requisites:
20 --   None
21 --
22 -- In Parameters:
23 --   p_application_id
24 --   p_approval_group_id
25 --
26 -- Post Success:
27 --   Processing continues if a valid application_id has been entered.
28 --
29 -- Post Failure:
30 --   An application error is raised.
31 --
32 -- Access Status:
33 --   Internal Row Handler Use Only.
34 --
35 -- {End Of Comments}
36 -- ----------------------------------------------------------------------------
37 procedure chk_approver_type(p_application_id      in   number
38                            ,p_approval_group_id   in   number
39                                  ) IS
40 --
41   l_proc           varchar2(72) := g_package || 'CHK_APPROVER_TYPE';
42   l_count          number;
43   l_config_value   ame_config_vars.variable_value%type;
44   l_group_name     ame_approval_groups.name%type;
45   --
46   -- cursor to find the value of allowAllApproverTypes config variable for the
47   -- current transaction type.
48   --
49   cursor C_Sel1 is
50     select variable_value
51       from ame_config_vars
52      where variable_name like 'allowAllApproverTypes'
53        and application_id = p_application_id
54        and sysdate between start_date and
55            nvl(end_date-ame_util.oneSecond,SYSDATE);
56   --
57   -- cursor to find if the approver group consists of group members of approver
58   -- type not allowed in the current transaction type.
59   --
60   cursor C_Sel2 is
61     select count(*)
62       from ame_approval_group_members
63      where approval_group_id = p_approval_group_id
64        and orig_system not in ('FND_USR','PER');
65 Begin
66     hr_utility.set_location('Entering:'||l_proc,10);
67 
68     -- find the value of config variable allowAllApproverTypes for the current
69     -- transaction type
70     open C_Sel1;
71     fetch C_Sel1 into l_config_value;
72     if C_Sel1%notfound then
73       -- if the config variable is not defined for the current transaction type
74       -- use the global value
75       select variable_value into l_config_value
76         from ame_config_vars
77        where variable_name like 'allowAllApproverTypes'
78          and application_id = 0
79          and sysdate between start_date and
80              nvl(end_date-ame_util.oneSecond,SYSDATE);
81     end if;
82     close C_Sel1;
83     -- if all approver types are allowed for the current transaction ,then return
84     if l_config_value = 'yes' then
85       return;
86     end if;
87     -- find if the approver group has members of approver type other than 'PER'
88     -- and 'FND_USR'
89   open C_Sel2;
90   fetch C_Sel2 into l_count;
91   close C_Sel2;
92   if l_count <> 0 then
93     select name into l_group_name
94       from ame_approval_groups
95      where approval_group_id = p_approval_group_id
96        and sysdate between start_date and
97            nvl(end_date-ame_util.oneSecond,SYSDATE)
98        and rownum < 2;
99     fnd_message.set_name('PER','AME_400617_APG_INV_APPR_TYPE');
100     fnd_message.set_token('GRP_NAME',l_group_name);
101     fnd_message.raise_error;
102   end if;
103   hr_utility.set_location(' Leaving:'||l_proc,30);
104   exception
105     when app_exception.application_exception then
106       if hr_multi_message.exception_add
107                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.APPLICATION_ID'
108                      ) then
109         hr_utility.set_location(' Leaving:'||l_proc, 40);
110         raise;
111       end if;
112       hr_utility.set_location( ' Leaving:'||l_proc,50 );
113 end chk_approver_type;
114 
115 -- ----------------------------------------------------------------------------
116 -- |-------------------------< CHK_DELETE >---------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 --  This procedure checks if any rule in the current transaction type
122 --  uses an action based on the group config to be deleted.
123 --
124 -- Pre-Requisites:
125 --   None
126 --
127 -- In Parameters:
128 --   p_application_id
129 --   p_approval_group_id
130 --   p_effective_date
131 --
132 -- Post Success:
133 --   Processing continues if a valid application_id has been entered.
134 --
135 -- Post Failure:
136 --   An application error is raised.
137 --
138 -- Access Status:
139 --   Internal Row Handler Use Only.
140 --
141 -- {End Of Comments}
142 -- ----------------------------------------------------------------------------
143 procedure chk_delete(p_application_id      in   number
144                     ,p_approval_group_id   in   number
145                     ,p_effective_date      in   date
146                             ) IS
147 --
148   l_proc     varchar2(72) := g_package || 'CHK_DELETE';
149   l_count    number;
150   --
151   -- cursor to find if any rules using this group action
152   -- has usage for this transaction type
153   --
154   cursor C_Sel1 is
155     select count(*)
156       from ame_action_types aty
157           ,ame_actions act
158           ,ame_rule_usages aru
159           ,ame_action_usages actu
160       where aty.name in ( ame_util.preApprovalTypeName
161                        ,ame_util.postApprovalTypeName
162                        ,ame_util.groupChainApprovalTypeName
163                       )
164         and aty.action_type_id = act.action_type_id
165         and act.parameter = to_char(p_approval_group_id)
166         and aru.item_id = p_application_id
167         and actu.rule_id = aru.rule_id
168         and actu.action_id = act.action_id
169         and p_effective_date between aty.start_date and
170             nvl(aty.end_date,p_effective_date)
171         and p_effective_date between act.start_Date and
172             nvl(act.end_date,p_effective_date)
173         and ((p_effective_date between aru.start_date and
174               nvl(aru.end_date - ame_util.oneSecond, p_effective_date)) or
175              (p_effective_date < aru.start_date and
176               aru.start_date < nvl(aru.end_date,aru.start_date + ame_util.oneSecond)))
177         and ((p_effective_date between actu.start_date and
178               nvl(actu.end_date - ame_util.oneSecond, p_effective_date)) or
179              (p_effective_date < actu.start_date and
180               actu.start_date < nvl(actu.end_date,actu.start_date + ame_util.oneSecond)));
181 
182   cursor c_sel2 is
183     select null
184       from ame_approval_group_config
185       where ame_utility_pkg.check_seeddb = 'N'
186         and approval_group_id = p_approval_group_id
187         and application_id = p_application_id
188         and ame_utility_pkg.is_seed_user(created_by) = ame_util.seededDataCreatedById
189         and p_effective_date between start_date
190               and nvl(end_date - (1/86400), p_effective_date);
191 Begin
192     hr_utility.set_location('Entering:'||l_proc,10);
193 
194     -- Check if the group action is being used by an active rule in
195     --current transaction type.
196     open C_Sel1;
197     fetch C_Sel1 into l_count;
198     close C_Sel1;
199     if l_count <> 0 then
200       fnd_message.set_name('PER','AME_400558_RULES_EXIST_FOR_APG');
201       fnd_message.raise_error;
202     end if;
203 
204     hr_utility.set_location(' Leaving:'||l_proc,30);
205   exception
206     when app_exception.application_exception then
207       if hr_multi_message.exception_add
208                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.APPLICATION_ID'
209                      ) then
210         hr_utility.set_location(' Leaving:'||l_proc, 40);
211         raise;
212       end if;
213       hr_utility.set_location( ' Leaving:'||l_proc,50 );
214 end chk_delete;
215 
216 
217 -- ----------------------------------------------------------------------------
218 -- |-------------------------< CHK_APPLICATION_ID >---------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 --  This procedure validates the application_id.
224 --
225 -- Pre-Requisites:
226 --   None
227 --
228 -- In Parameters:
229 --   p_application_id
230 --   p_effective_date
231 --
232 -- Post Success:
233 --   Processing continues if a valid application_id has been entered.
234 --
235 -- Post Failure:
236 --   An application error is raised.
237 --
238 -- Access Status:
239 --   Internal Row Handler Use Only.
240 --
241 -- {End Of Comments}
242 -- ----------------------------------------------------------------------------
243 procedure chk_application_id(p_application_id      in   number
244                             ,p_effective_date      in   date
245                             ) IS
246 --
247   l_proc     varchar2(72) := g_package || 'CHK_APPLICATION_ID';
248   l_count    number;
249 --
250 -- Cursor to find if application_id exists in ame_calling_apps
251 --
252   Cursor C_Sel1 Is
253     select count(application_id)
254     from   ame_calling_apps t
255     where t.application_id = p_application_id
256     and p_effective_date between t.start_date and nvl(t.end_date-(1/84600),sysdate);
257 
258   Begin
259     hr_utility.set_location('Entering:'||l_proc,10);
260     hr_api.mandatory_arg_error(p_api_name           => l_proc
261                               ,p_argument           => 'APPLICATION_ID'
262                               ,p_argument_value     => p_application_id
263                               );
264     -- Check if the application_id is existing in ame_calling_apps.
265     open C_Sel1;
266     fetch C_Sel1 into l_count;
267     close C_Sel1;
268     if l_count = 0 then
269       fnd_message.set_name('PER','AME_400474_INV_APPLICATION_ID');
270       fnd_message.raise_error;
271     end if;
272     hr_utility.set_location(' Leaving:'||l_proc,30);
273   exception
274     when app_exception.application_exception then
275       if hr_multi_message.exception_add
276                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.APPLICATION_ID'
277                      ) then
278         hr_utility.set_location(' Leaving:'||l_proc, 40);
279         raise;
280       end if;
281       hr_utility.set_location( ' Leaving:'||l_proc,50 );
282   End chk_application_id;
283 
284 
285 -- ----------------------------------------------------------------------------
286 -- |-------------------------< CHK_APPROVAL_GROUP_ID >---------------------------|
287 -- ----------------------------------------------------------------------------
288 -- {Start Of Comments}
289 --
290 -- Description:
291 --  This procedure validates the approval_group_id.
292 --
293 -- Pre-Requisites:
294 --   None
295 --
296 -- In Parameters:
297 --   p_approval_group_id
298 --   p_effective_date
299 --
300 -- Post Success:
301 --   Processing continues if a valid approval_group_id has been entered.
302 --
303 -- Post Failure:
304 --   An application error is raised.
305 --
306 -- Access Status:
307 --   Internal Row Handler Use Only.
308 --
309 -- {End Of Comments}
310 -- ----------------------------------------------------------------------------
311 procedure chk_approval_group_id(p_approval_group_id   in   number
312                                ,p_effective_date      in   date
313                                ) IS
314 --
315   l_proc     varchar2(72) := g_package || 'CHK_APPROVAL_GROUP_ID';
316   l_count    number;
317 --
318 -- Cursor to find if approval_group_id exists in ame_approval_groups
319 --
320   Cursor C_Sel1 Is
321     select count(approval_group_id)
322     from   ame_approval_groups t
323     where t.approval_group_id = p_approval_group_id
324     and p_effective_date between t.start_date and t.end_date;
325 
326   Begin
327     hr_utility.set_location('Entering:'||l_proc,10);
328     hr_api.mandatory_arg_error(p_api_name           => l_proc
329                               ,p_argument           => 'APPROVAL_GROUP_ID'
330                               ,p_argument_value     => p_approval_group_id
331                               );
332     -- Check if the approval_group_id is existing in ame_approval_groups.
333     open C_Sel1;
334     fetch C_Sel1 into l_count;
335     close C_Sel1;
336     if l_count = 0 then
337       fnd_message.set_name('PER','AME_400557_INVALID_APG_ID');
338       fnd_message.raise_error;
339     end if;
340     hr_utility.set_location(' Leaving:'||l_proc,30);
341   exception
342     when app_exception.application_exception then
343       if hr_multi_message.exception_add
344                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.APPROVAL_GROUP_ID'
345                      ) then
346         hr_utility.set_location(' Leaving:'||l_proc, 40);
347         raise;
348       end if;
349       hr_utility.set_location( ' Leaving:'||l_proc,50 );
350   End chk_approval_group_id;
351 
352 
353 -- ----------------------------------------------------------------------------
354 -- |-------------------------< CHK_VOTING_REGIME >---------------------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 --  This procedure validates the voting_regime value which should be in (C,F,O,S)
360 --
361 -- Pre-Requisites:
362 --   None
363 --
364 -- In Parameters:
365 --   p_voting_regime
366 --
367 -- Post Success:
368 --   Processing continues if a valid voting_regime has been entered.
369 --
370 -- Post Failure:
371 --   An application error is raised.
372 --
373 -- Access Status:
374 --   Internal Row Handler Use Only.
375 --
376 -- {End Of Comments}
377 -- ----------------------------------------------------------------------------
378 procedure chk_voting_regime(p_voting_regime       in   varchar2
379                            ) IS
380 --
381   l_proc     varchar2(72) := g_package || 'CHK_VOTING_REGIME';
382 --
383 
384   Begin
385     hr_utility.set_location('Entering:'||l_proc,10);
386     hr_api.mandatory_arg_error(p_api_name           => l_proc
387                               ,p_argument           => 'VOTING_REGIME'
388                               ,p_argument_value     => p_voting_regime
389                               );
390     -- Check if the voting_regime has value in ('C','F','O','S').
391     if p_voting_regime not in ('C','F','O','S') then
392       fnd_message.set_name('PER','AME_400564_APG_INVALID_VOT_REG');
393       fnd_message.raise_error;
394     end if;
395     hr_utility.set_location(' Leaving:'||l_proc,30);
396   exception
397     when app_exception.application_exception then
398       if hr_multi_message.exception_add
399                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.VOTING_REGIME'
400                      ) then
401         hr_utility.set_location(' Leaving:'||l_proc, 40);
402         raise;
403       end if;
404       hr_utility.set_location( ' Leaving:'||l_proc,50 );
405   End chk_voting_regime;
406 
407 -- ----------------------------------------------------------------------------
408 -- |-------------------------< CHK_ORDER_NUMBER >---------------------------|
409 -- ----------------------------------------------------------------------------
410 -- {Start Of Comments}
411 --
412 -- Description:
413 --  This procedure validates the order_number value which should be positive.
414 --
415 -- Pre-Requisites:
416 --   None
417 --
418 -- In Parameters:
419 --   p_order_number
420 --
421 -- Post Success:
422 --   Processing continues if a valid order_number has been entered.
423 --
424 -- Post Failure:
425 --   An application error is raised.
426 --
427 -- Access Status:
428 --   Internal Row Handler Use Only.
429 --
430 -- {End Of Comments}
431 -- ----------------------------------------------------------------------------
432 procedure chk_order_number(p_order_number       in   number
433                            ) IS
434 --
435   l_proc     varchar2(72) := g_package || 'CHK_ORDER_NUMBER';
436 --
437 
438   Begin
439     hr_utility.set_location('Entering:'||l_proc,10);
440     hr_api.mandatory_arg_error(p_api_name           => l_proc
441                               ,p_argument           => 'ORDER_NUMBER'
442                               ,p_argument_value     => p_order_number
443                               );
444     -- Check if the order number is negative
445     if p_order_number <= 0 then
446       fnd_message.set_name('PER','AME_400565_INVALID_ORDER_NUM');
447       fnd_message.raise_error;
448     end if;
449     hr_utility.set_location(' Leaving:'||l_proc,30);
450   exception
451     when app_exception.application_exception then
452       if hr_multi_message.exception_add
453                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.ORDER_NUMBER'
454                      ) then
455         hr_utility.set_location(' Leaving:'||l_proc, 40);
456         raise;
457       end if;
458       hr_utility.set_location( ' Leaving:'||l_proc,50 );
459   End chk_order_number;
460 
461 -- ----------------------------------------------------------------------------
462 -- |-------------------------< CHK_UNIQUE >---------------------------|
463 -- ----------------------------------------------------------------------------
464 -- {Start Of Comments}
465 --
466 -- Description:
467 --  This procedure validates the order_number value which should be positive.
468 --
469 -- Pre-Requisites:
470 --   None
471 --
472 -- In Parameters:
473 --   p_order_number
474 --
475 -- Post Success:
476 --   Processing continues if a valid order_number has been entered.
477 --
478 -- Post Failure:
479 --   An application error is raised.
480 --
481 -- Access Status:
482 --   Internal Row Handler Use Only.
483 --
484 -- {End Of Comments}
485 -- ----------------------------------------------------------------------------
486 procedure chk_unique(p_approval_group_id   in   number
487                     ,p_application_id      in   number
488                            ) IS
489 --
490   l_proc     varchar2(72) := g_package || 'chk_unique';
491   l_count    number;
492 --
493   cursor CSel1 is
494     select count(*)
495       from ame_approval_group_config
496       where approval_group_id = p_approval_group_id
497         and application_id = p_application_id
498         and sysdate between start_date and end_date;
499 
500   Begin
501     hr_utility.set_location('Entering:'||l_proc,10);
502     -- Check if the configuration already exists
503     open CSel1;
504     fetch CSel1 into l_count;
505     close CSel1;
506     if l_count <> 0 then
507       fnd_message.set_name('PER','AME_400566_APG_CFG_EXISTS');
508       fnd_message.raise_error;
509     end if;
510     hr_utility.set_location(' Leaving:'||l_proc,30);
511   exception
512     when app_exception.application_exception then
513       if hr_multi_message.exception_add
514                      (p_associated_column1 => 'AME_APPROVAL_GROUP_CONFIG.APPLICATION_ID'
515                      ) then
516         hr_utility.set_location(' Leaving:'||l_proc, 40);
517         raise;
518       end if;
519       hr_utility.set_location( ' Leaving:'||l_proc,50 );
520   End chk_unique;
521 
525 -- {Start Of Comments}
522 -- ----------------------------------------------------------------------------
523 -- |-----------------------< chk_non_updateable_args >------------------------|
524 -- ----------------------------------------------------------------------------
526 --
527 -- Description:
528 --   This procedure is used to ensure that non updateable attributes have
529 --   not been updated. If an attribute has been updated an error is generated.
530 --
531 -- Pre Conditions:
532 --   g_old_rec has been populated with details of the values currently in
533 --   the database.
534 --
535 -- In Arguments:
536 --   p_rec has been populated with the updated values the user would like the
537 --   record set to.
538 --
539 -- Post Success:
540 --   Processing continues if all the non updateable attributes have not
541 --   changed.
542 --
543 -- Post Failure:
544 --   An application error is raised if any of the non updatable attributes
545 --   have been altered.
546 --
547 -- {End Of Comments}
548 -- ----------------------------------------------------------------------------
549 Procedure chk_non_updateable_args
550   (p_effective_date  in date
551   ,p_rec             in ame_gcf_shd.g_rec_type
552   ) IS
553 --
554   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
555 --
556 Begin
557   --
558   -- Only proceed with the validation if a row exists for the current
559   -- record in the HR Schema.
560   --
561   IF NOT ame_gcf_shd.api_updating
562       (p_approval_group_id =>  p_rec.approval_group_id
563  ,p_application_id =>  p_rec.application_id
564       ,p_effective_date                   => p_effective_date
565       ,p_object_version_number            => p_rec.object_version_number
566       ) THEN
567      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
568      fnd_message.set_token('PROCEDURE ', l_proc);
569      fnd_message.set_token('STEP ', '5');
570      fnd_message.raise_error;
571   END IF;
572   --
573   -- EDIT_HERE: Add checks to ensure non-updateable args have
574   --            not been updated.
575   --
576 
577 End chk_non_updateable_args;
578 --
579 -- ----------------------------------------------------------------------------
580 -- |--------------------------< dt_update_validate >--------------------------|
581 -- ----------------------------------------------------------------------------
582 -- {Start Of Comments}
583 --
584 -- Description:
585 --   This procedure is used for referential integrity of datetracked
586 --   parent entities when a datetrack update operation is taking place
587 --   and where there is no cascading of update defined for this entity.
588 --
589 -- Prerequisites:
590 --   This procedure is called from the update_validate.
591 --
592 -- In Parameters:
593 --
594 -- Post Success:
595 --   Processing continues.
596 --
597 -- Post Failure:
598 --
599 -- Developer Implementation Notes:
600 --   This procedure should not need maintenance unless the HR Schema model
601 --   changes.
602 --
603 -- Access Status:
604 --   Internal Row Handler Use Only.
605 --
606 -- {End Of Comments}
607 -- ----------------------------------------------------------------------------
608 Procedure dt_update_validate
609   (p_datetrack_mode                in varchar2
610   ,p_validation_start_date         in date
611   ,p_validation_end_date           in date
612   ) Is
613 --
614   l_proc  varchar2(72) := g_package||'dt_update_validate';
615 --
616 Begin
617   --
618   -- Ensure that the p_datetrack_mode argument is not null
619   --
620   hr_api.mandatory_arg_error
621     (p_api_name       => l_proc
622     ,p_argument       => 'datetrack_mode'
623     ,p_argument_value => p_datetrack_mode
624     );
625   --
626   -- Mode will be valid, as this is checked at the start of the upd.
627   --
628   -- Ensure the arguments are not null
629   --
630   hr_api.mandatory_arg_error
631     (p_api_name       => l_proc
632     ,p_argument       => 'validation_start_date'
633     ,p_argument_value => p_validation_start_date
634     );
635   --
636   /*hr_api.mandatory_arg_error
637     (p_api_name       => l_proc
638     ,p_argument       => 'validation_end_date'
639     ,p_argument_value => p_validation_end_date
640     );*/
641   --
642 Exception
643   When Others Then
644     --
645     -- An unhandled or unexpected error has occurred which
646     -- we must report
647     --
648     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
649     fnd_message.set_token('PROCEDURE', l_proc);
650     fnd_message.set_token('STEP','15');
651     fnd_message.raise_error;
652 End dt_update_validate;
653 --
654 -- ----------------------------------------------------------------------------
655 -- |--------------------------< dt_delete_validate >--------------------------|
656 -- ----------------------------------------------------------------------------
657 -- {Start Of Comments}
658 --
659 -- Description:
660 --   This procedure is used for referential integrity of datetracked
661 --   child entities when either a datetrack DELETE or ZAP is in operation
662 --   and where there is no cascading of delete defined for this entity.
663 --   For the datetrack mode of DELETE or ZAP we must ensure that no
664 --   datetracked child rows exist between the validation start and end
665 --   dates.
666 --
667 -- Prerequisites:
668 --   This procedure is called from the delete_validate.
669 --
670 -- In Parameters:
671 --
672 -- Post Success:
673 --   Processing continues.
674 --
675 -- Post Failure:
676 --   If a row exists by determining the returning Boolean value from the
677 --   generic dt_api.rows_exist function then we must supply an error via
678 --   the use of the local exception handler l_rows_exist.
679 --
680 -- Developer Implementation Notes:
681 --   This procedure should not need maintenance unless the HR Schema model
682 --   changes.
683 --
684 -- Access Status:
685 --   Internal Row Handler Use Only.
686 --
687 -- {End Of Comments}
688 -- ----------------------------------------------------------------------------
689 Procedure dt_delete_validate
690   (p_application_id                   in number
691   ,p_approval_group_id                in number
692   ,p_datetrack_mode                   in varchar2
693   ,p_validation_start_date            in date
694   ,p_validation_end_date              in date
695   ) Is
696 --
697   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
698 --
699 Begin
700   --
701   -- Ensure that the p_datetrack_mode argument is not null
702   --
703   hr_api.mandatory_arg_error
704     (p_api_name       => l_proc
705     ,p_argument       => 'datetrack_mode'
706     ,p_argument_value => p_datetrack_mode
707     );
708   --
709   -- Only perform the validation if the datetrack mode is either
710   -- DELETE or ZAP
711   --
712   If (p_datetrack_mode = hr_api.g_delete or
713       p_datetrack_mode = hr_api.g_zap) then
714     --
715     --
716     -- Ensure the arguments are not null
717     --
718     hr_api.mandatory_arg_error
719       (p_api_name       => l_proc
720       ,p_argument       => 'validation_start_date'
721       ,p_argument_value => p_validation_start_date
722       );
723     --
724     /*hr_api.mandatory_arg_error
725       (p_api_name       => l_proc
726       ,p_argument       => 'validation_end_date'
727       ,p_argument_value => p_validation_end_date
728       );*/
729     --
730     hr_api.mandatory_arg_error
731       (p_api_name       => l_proc
732       ,p_argument       => 'approval_group_id'
733       ,p_argument_value => p_approval_group_id
734       );
735     --
736     --
737     --
738     --
739   End If;
740   --
741 Exception
742   When Others Then
743     --
744     -- An unhandled or unexpected error has occurred which
745     -- we must report
746     --
747     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
748     fnd_message.set_token('PROCEDURE', l_proc);
749     fnd_message.set_token('STEP','15');
750     fnd_message.raise_error;
751   --
752 End dt_delete_validate;
753 --
754 -- ----------------------------------------------------------------------------
755 -- |---------------------------< insert_validate >----------------------------|
756 -- ----------------------------------------------------------------------------
757 Procedure insert_validate
758   (p_rec                   in ame_gcf_shd.g_rec_type
759   ,p_effective_date        in date
760   ,p_datetrack_mode        in varchar2
761   ,p_validation_start_date in date
762   ,p_validation_end_date   in date
763   ) is
764 --
765   l_proc        varchar2(72) := g_package||'insert_validate';
766 --
767 Begin
768   hr_utility.set_location('Entering:'||l_proc, 5);
769   --
770   -- Validate Dependent Attributes
771   --
772   --
773   -- User Entered calls to validate procedures
774   chk_application_id (
775                       p_application_id  => p_rec.application_id
776                      ,p_effective_date  => p_effective_date
777                      );
778   chk_approval_group_id (
779                          p_approval_group_id  => p_rec.approval_group_id
780                         ,p_effective_date  => p_effective_date
781                         );
782   chk_unique (
783               p_approval_group_id => p_rec.approval_group_id
784              ,p_application_id    => p_rec.application_id
785              );
786   chk_approver_type (
787                      p_application_id  => p_rec.application_id
788                     ,p_approval_group_id  => p_rec.approval_group_id
789                     );
790   chk_voting_regime(
791                    p_voting_regime => p_rec.voting_regime
792                    );
793 /*  chk_order_number(
794                    p_order_number  => p_rec.order_number
795                   );*/
796   hr_utility.set_location(' Leaving:'||l_proc, 10);
797 End insert_validate;
798 --
799 -- ----------------------------------------------------------------------------
800 -- |---------------------------< update_validate >----------------------------|
801 -- ----------------------------------------------------------------------------
802 Procedure update_validate
803   (p_rec                     in ame_gcf_shd.g_rec_type
804   ,p_effective_date          in date
805   ,p_datetrack_mode          in varchar2
806   ,p_validation_start_date   in date
807   ,p_validation_end_date     in date
808   ) is
809 --
810   l_proc        varchar2(72) := g_package||'update_validate';
811 --
812 Begin
813   hr_utility.set_location('Entering:'||l_proc, 5);
814   --
815   -- Validate Dependent Attributes
816   --
817   -- Call the datetrack update integrity operation
818   --
819   dt_update_validate
820     (p_datetrack_mode                 => p_datetrack_mode
821     ,p_validation_start_date          => p_validation_start_date
822     ,p_validation_end_date            => p_validation_end_date
823     );
824   --
825   chk_non_updateable_args
826     (p_effective_date  => p_effective_date
827     ,p_rec             => p_rec
828     );
829   --
830   --
831 
832   -- User Entered calls to validate procedures
833   chk_voting_regime(
834                    p_voting_regime => p_rec.voting_regime
835                    );
836   chk_order_number(
837                    p_order_number  => p_rec.order_number
838                   );
839 
840   hr_utility.set_location(' Leaving:'||l_proc, 10);
841 End update_validate;
842 --
843 -- ----------------------------------------------------------------------------
844 -- |---------------------------< delete_validate >----------------------------|
845 -- ----------------------------------------------------------------------------
846 Procedure delete_validate
847   (p_rec                    in ame_gcf_shd.g_rec_type
848   ,p_effective_date         in date
849   ,p_datetrack_mode         in varchar2
850   ,p_validation_start_date  in date
851   ,p_validation_end_date    in date
852   ) is
853 --
854   l_proc        varchar2(72) := g_package||'delete_validate';
855 --
856 Begin
857   hr_utility.set_location('Entering:'||l_proc, 5);
858   --
859   -- Call all supporting business operations
860   --
861   dt_delete_validate
862     (p_datetrack_mode                   => p_datetrack_mode
863     ,p_validation_start_date            => p_validation_start_date
864     ,p_validation_end_date              => p_validation_end_date
865     ,p_approval_group_id =>  p_rec.approval_group_id
866  ,p_application_id =>  p_rec.application_id
867     );
868   chk_delete
869     (p_application_id                   =>p_rec.application_id
870     ,p_approval_group_id                => p_rec.approval_group_id
871     ,p_effective_date                   => sysdate
872     );
873   --
874   hr_utility.set_location(' Leaving:'||l_proc, 10);
875 End delete_validate;
876 --
877 end ame_gcf_bus;