DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AIF_BUS

Source


1 Package Body pay_aif_bus as
2 /* $Header: pyaifrhi.pkb 120.2.12000000.2 2007/03/30 05:34:36 ttagawa noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_aif_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_information_id       number         default null;
15 --
16 -- The following three global variables are only to be used by
17 -- the return_nonpk_leg_code function.
18 --
19 g_nonpk_leg_code              varchar2(150)  default null;
20 g_action_context_id           number         default null;
21 g_action_context_type         varchar2(15)   default null;
22 --
23 --  ---------------------------------------------------------------------------
24 --  |----------------------< set_security_group_id >--------------------------|
25 --  ---------------------------------------------------------------------------
26 --
27 Procedure set_security_group_id
28   (p_action_information_id                in number
29   ) is
30   --
31   -- Declare cursor
32   --
33   cursor csr_sec_grp is
34     select pbg.security_group_id
35     from   per_business_groups       pbg
36     ,      pay_action_information    aif
37     ,      pay_assignment_actions    act
38     ,      pay_payroll_actions       pct
39     where  aif.action_information_id = p_action_information_id
40     and    pbg.business_group_id     = pct.business_group_id
41     and    act.payroll_action_id     = pct.payroll_action_id
42     and    act.assignment_action_id  = aif.action_context_id
43     and    aif.action_context_type   in ('AAP', 'AAC')
44     union all
45     select pbg.security_group_id
46     from   per_business_groups       pbg
47     ,      pay_action_information    aif
48     ,      pay_payroll_actions       pct
49     where  aif.action_information_id = p_action_information_id
50     and    pbg.business_group_id     = pct.business_group_id
51     and    pct.payroll_action_id     = aif.action_context_id
52     and    aif.action_context_type   = 'PA';
53   --
54   -- Declare local variables
55   --
56   l_security_group_id number;
57   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
58   --
59 Begin
60   --
61   hr_utility.set_location('Entering:'|| l_proc, 10);
62   --
63   -- Ensure that all the mandatory parameter are not null
64   --
65   hr_api.mandatory_arg_error
66     (p_api_name           => l_proc
67     ,p_argument           => 'action_information_id'
68     ,p_argument_value     => p_action_information_id
69     );
70   --
71   open csr_sec_grp;
72   fetch csr_sec_grp into l_security_group_id;
73   --
74   if csr_sec_grp%notfound then
75      --
76      close csr_sec_grp;
77      --
78      -- The primary key is invalid therefore we must error
79      --
80      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
81      fnd_message.raise_error;
82      --
83   end if;
84   close csr_sec_grp;
85   --
86   -- Set the security_group_id in CLIENT_INFO
87   --
88   hr_api.set_security_group_id
89     (p_security_group_id => l_security_group_id
90     );
91   --
92   hr_utility.set_location(' Leaving:'|| l_proc, 20);
93   --
94 End set_security_group_id;
95 --
96 --  ---------------------------------------------------------------------------
97 --  |---------------------< return_legislation_code >-------------------------|
98 --  ---------------------------------------------------------------------------
99 --
100 Function return_legislation_code
101   (p_action_information_id                in     number
102   )
103   Return Varchar2 Is
104   --
105   -- Declare cursor
106   --
107   cursor csr_leg_code is
108     select pbg.legislation_code
109     from   per_business_groups       pbg
110     ,      pay_action_information    aif
111     ,      pay_assignment_actions    act
112     ,      pay_payroll_actions       pct
113     where  aif.action_information_id = p_action_information_id
114     and    pbg.business_group_id     = pct.business_group_id
115     and    act.payroll_action_id     = pct.payroll_action_id
116     and    act.assignment_action_id  = aif.action_context_id
117     and    aif.action_context_type   in ('AAP', 'AAC')
118     union all
119     select pbg.legislation_code
120     from   per_business_groups       pbg
121     ,      pay_action_information    aif
122     ,      pay_payroll_actions       pct
123     where  aif.action_information_id = p_action_information_id
124     and    pbg.business_group_id     = pct.business_group_id
125     and    pct.payroll_action_id     = aif.action_context_id
126     and    aif.action_context_type   = 'PA';
127   --
128   -- Declare local variables
129   --
130   l_legislation_code  varchar2(150);
131   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
132   --
133 Begin
134   --
135   hr_utility.set_location('Entering:'|| l_proc, 10);
136   --
137   -- Ensure that all the mandatory parameter are not null
138   --
139   hr_api.mandatory_arg_error
140     (p_api_name           => l_proc
141     ,p_argument           => 'action_information_id'
142     ,p_argument_value     => p_action_information_id
143     );
144   --
145   if ( nvl(pay_aif_bus.g_action_information_id, hr_api.g_number)
146        = p_action_information_id) then
147     --
148     -- The legislation code has already been found with a previous
149     -- call to this function. Just return the value in the global
150     -- variable.
151     --
152     l_legislation_code := pay_aif_bus.g_legislation_code;
153     hr_utility.set_location(l_proc, 20);
154   else
155     --
156     -- The ID is different to the last call to this function
157     -- or this is the first call to this function.
158     --
159     open csr_leg_code;
160     fetch csr_leg_code into l_legislation_code;
161     --
162     if csr_leg_code%notfound then
163       --
164       -- The primary key is invalid therefore we must error
165       --
166       close csr_leg_code;
167       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
168       fnd_message.raise_error;
169     end if;
170     hr_utility.set_location(l_proc,30);
171     --
172     -- Set the global variables so the values are
173     -- available for the next call to this function.
174     --
175     close csr_leg_code;
176     pay_aif_bus.g_action_information_id := p_action_information_id;
177     pay_aif_bus.g_legislation_code  := l_legislation_code;
178   end if;
179   hr_utility.set_location(' Leaving:'|| l_proc, 40);
180   return l_legislation_code;
181 end return_legislation_code;
182 --
183 --  ---------------------------------------------------------------------------
184 --  |----------------------<return_nonpk_leg_code >---------------------------|
185 --  ---------------------------------------------------------------------------
186 --
187 Function return_nonpk_leg_code
188   (p_action_context_id            in     number
189   ,p_action_context_type          in     varchar2
190   )
191   Return Varchar2 Is
192   --
193   -- Declare cursor
194   --
195   cursor csr_aa_leg_code is
196     select pbg.legislation_code
197     from   per_business_groups       pbg
198     ,      pay_assignment_actions    act
199     ,      pay_payroll_actions       pct
200     where  act.assignment_action_id  = p_action_context_id
201     and    act.payroll_action_id     = pct.payroll_action_id
202     and    pct.business_group_id     = pbg.business_group_id;
203   --
204   cursor csr_pa_leg_code is
205     select pbg.legislation_code
206     from   per_business_groups     pbg
207     ,      pay_payroll_actions     pct
208     where  pct.payroll_action_id   = p_action_context_id
209     and    pct.business_group_id   = pbg.business_group_id;
210   --
211   -- Declare local variables
212   --
213   l_legislation_code  varchar2(150);
214   l_proc              varchar2(72)  :=  g_package||'return_nonpk_leg_code';
215   --
216 Begin
217   --
218   hr_utility.set_location('Entering:'|| l_proc, 10);
219   --
220   -- Ensure that all the mandatory parameter are not null
221   --
222   hr_api.mandatory_arg_error
223     (p_api_name           => l_proc
224     ,p_argument           => 'action_context_id'
225     ,p_argument_value     => p_action_context_id
226     );
227   hr_api.mandatory_arg_error
228     (p_api_name           => l_proc
229     ,p_argument           => 'action_context_type'
230     ,p_argument_value     => p_action_context_type
231     );
232   --
233   if ((nvl(pay_aif_bus.g_action_context_id,hr_api.g_number) = p_action_context_id)
234   and (nvl(pay_aif_bus.g_action_context_type,hr_api.g_varchar2) = p_action_context_type)) then
235   --
236     --
237     -- Legislation code is for same row as cached values therefore return
238     -- cached legislation code
239     --
240     l_legislation_code := pay_aif_bus.g_nonpk_leg_code;
241   --
242   else
243   --
244     if (p_action_context_type = 'PA') then
245     --
246       open csr_pa_leg_code;
247       fetch csr_pa_leg_code into l_legislation_code;
248       --
249       if csr_pa_leg_code%notfound then
250       --
251         --
252         -- The payroll action is invalid therefore we must error
253         --
254         close csr_pa_leg_code;
255         fnd_message.set_name('PAY','PAY_34985_INVALID_PAY_ACTION');
256         fnd_message.raise_error;
257       --
258       else
259       --
260         close csr_pa_leg_code;
261       --
262       end if;
263     --
264     elsif (p_action_context_type in ('AAC','AAP')) then
265     --
266       open csr_aa_leg_code;
267       fetch csr_aa_leg_code into l_legislation_code;
268       --
269       if csr_aa_leg_code%notfound then
270       --
271         --
272         -- The assignment action is invalid therefore we must error
273         --
274         close csr_aa_leg_code;
275         fnd_message.set_name('PAY','PAY_34987_INVALID_ASG_ACTION');
276         fnd_message.raise_error;
277       --
278       else
279       --
280         close csr_aa_leg_code;
281       --
282       end if;
283     --
284     else
285     --
286       --
287       -- The action context type is invalid therefore we must error
288       --
289       fnd_message.set_name('PAY','PAY_34986_INV_ACT_CONTEXT_TYPE');
290       fnd_message.raise_error;
291     --
292     end if;
293     --
294     pay_aif_bus.g_action_context_id   := p_action_context_id;
295     pay_aif_bus.g_action_context_type := p_action_context_type;
296     pay_aif_bus.g_nonpk_leg_code      := l_legislation_code;
297   --
298   end if;
299   --
300   hr_utility.set_location(' Leaving:'|| l_proc, 20);
301   --
302   return l_legislation_code;
303 --
304 end return_nonpk_leg_code;
305 --
306 -- ----------------------------------------------------------------------------
307 -- |-----------------------------< chk_ddf >----------------------------------|
308 -- ----------------------------------------------------------------------------
309 --
310 -- Description:
311 --   Validates all the Developer Descriptive Flexfield values.
312 --
313 -- Prerequisites:
314 --   All other columns have been validated.  Must be called as the
315 --   last step from insert_validate and update_validate.
316 --
317 -- In Arguments:
318 --   p_rec
319 --
320 -- Post Success:
321 --   If the Developer Descriptive Flexfield structure column and data values
322 --   are all valid this procedure will end normally and processing will
323 --   continue.
324 --
325 -- Post Failure:
326 --   If the Developer Descriptive Flexfield structure column value or any of
327 --   the data values are invalid then an application error is raised as
328 --   a PL/SQL exception.
329 --
330 -- Access Status:
331 --   Internal Row Handler Use Only.
332 --
333 -- ----------------------------------------------------------------------------
334 procedure chk_ddf
335   (p_rec in pay_aif_shd.g_rec_type
336   ) is
337 --
338   l_proc   varchar2(72) := g_package || 'chk_ddf';
339 --
340 begin
341   hr_utility.set_location('Entering:'||l_proc,10);
342   --
343   if ((p_rec.action_information_id is not null)  and (
344     nvl(pay_aif_shd.g_old_rec.action_information_id, hr_api.g_number) <>
345     nvl(p_rec.action_information_id, hr_api.g_number)  or
346     nvl(pay_aif_shd.g_old_rec.effective_date, hr_api.g_date) <>
347     nvl(p_rec.effective_date, hr_api.g_date)  or
348     nvl(pay_aif_shd.g_old_rec.assignment_id, hr_api.g_number) <>
349     nvl(p_rec.assignment_id, hr_api.g_number)  or
350     nvl(pay_aif_shd.g_old_rec.action_information_category, hr_api.g_varchar2) <>
351     nvl(p_rec.action_information_category, hr_api.g_varchar2)  or
352     nvl(pay_aif_shd.g_old_rec.action_information1, hr_api.g_varchar2) <>
353     nvl(p_rec.action_information1, hr_api.g_varchar2)  or
354     nvl(pay_aif_shd.g_old_rec.action_information2, hr_api.g_varchar2) <>
355     nvl(p_rec.action_information2, hr_api.g_varchar2)  or
356     nvl(pay_aif_shd.g_old_rec.action_information3, hr_api.g_varchar2) <>
357     nvl(p_rec.action_information3, hr_api.g_varchar2)  or
358     nvl(pay_aif_shd.g_old_rec.action_information4, hr_api.g_varchar2) <>
359     nvl(p_rec.action_information4, hr_api.g_varchar2)  or
360     nvl(pay_aif_shd.g_old_rec.action_information5, hr_api.g_varchar2) <>
361     nvl(p_rec.action_information5, hr_api.g_varchar2)  or
362     nvl(pay_aif_shd.g_old_rec.action_information6, hr_api.g_varchar2) <>
363     nvl(p_rec.action_information6, hr_api.g_varchar2)  or
367     nvl(p_rec.action_information8, hr_api.g_varchar2)  or
364     nvl(pay_aif_shd.g_old_rec.action_information7, hr_api.g_varchar2) <>
365     nvl(p_rec.action_information7, hr_api.g_varchar2)  or
366     nvl(pay_aif_shd.g_old_rec.action_information8, hr_api.g_varchar2) <>
368     nvl(pay_aif_shd.g_old_rec.action_information9, hr_api.g_varchar2) <>
369     nvl(p_rec.action_information9, hr_api.g_varchar2)  or
370     nvl(pay_aif_shd.g_old_rec.action_information10, hr_api.g_varchar2) <>
371     nvl(p_rec.action_information10, hr_api.g_varchar2)  or
372     nvl(pay_aif_shd.g_old_rec.action_information11, hr_api.g_varchar2) <>
373     nvl(p_rec.action_information11, hr_api.g_varchar2)  or
374     nvl(pay_aif_shd.g_old_rec.action_information12, hr_api.g_varchar2) <>
375     nvl(p_rec.action_information12, hr_api.g_varchar2)  or
376     nvl(pay_aif_shd.g_old_rec.action_information13, hr_api.g_varchar2) <>
377     nvl(p_rec.action_information13, hr_api.g_varchar2)  or
378     nvl(pay_aif_shd.g_old_rec.action_information14, hr_api.g_varchar2) <>
379     nvl(p_rec.action_information14, hr_api.g_varchar2)  or
380     nvl(pay_aif_shd.g_old_rec.action_information15, hr_api.g_varchar2) <>
381     nvl(p_rec.action_information15, hr_api.g_varchar2)  or
382     nvl(pay_aif_shd.g_old_rec.action_information16, hr_api.g_varchar2) <>
383     nvl(p_rec.action_information16, hr_api.g_varchar2)  or
384     nvl(pay_aif_shd.g_old_rec.action_information17, hr_api.g_varchar2) <>
385     nvl(p_rec.action_information17, hr_api.g_varchar2)  or
386     nvl(pay_aif_shd.g_old_rec.action_information18, hr_api.g_varchar2) <>
387     nvl(p_rec.action_information18, hr_api.g_varchar2)  or
388     nvl(pay_aif_shd.g_old_rec.action_information19, hr_api.g_varchar2) <>
389     nvl(p_rec.action_information19, hr_api.g_varchar2)  or
390     nvl(pay_aif_shd.g_old_rec.action_information20, hr_api.g_varchar2) <>
391     nvl(p_rec.action_information20, hr_api.g_varchar2)  or
392     nvl(pay_aif_shd.g_old_rec.action_information21, hr_api.g_varchar2) <>
393     nvl(p_rec.action_information21, hr_api.g_varchar2)  or
394     nvl(pay_aif_shd.g_old_rec.action_information22, hr_api.g_varchar2) <>
395     nvl(p_rec.action_information22, hr_api.g_varchar2)  or
396     nvl(pay_aif_shd.g_old_rec.action_information23, hr_api.g_varchar2) <>
397     nvl(p_rec.action_information23, hr_api.g_varchar2)  or
398     nvl(pay_aif_shd.g_old_rec.action_information24, hr_api.g_varchar2) <>
399     nvl(p_rec.action_information24, hr_api.g_varchar2)  or
400     nvl(pay_aif_shd.g_old_rec.action_information25, hr_api.g_varchar2) <>
401     nvl(p_rec.action_information25, hr_api.g_varchar2)  or
402     nvl(pay_aif_shd.g_old_rec.action_information26, hr_api.g_varchar2) <>
403     nvl(p_rec.action_information26, hr_api.g_varchar2)  or
404     nvl(pay_aif_shd.g_old_rec.action_information27, hr_api.g_varchar2) <>
405     nvl(p_rec.action_information27, hr_api.g_varchar2)  or
406     nvl(pay_aif_shd.g_old_rec.action_information28, hr_api.g_varchar2) <>
407     nvl(p_rec.action_information28, hr_api.g_varchar2)  or
408     nvl(pay_aif_shd.g_old_rec.action_information29, hr_api.g_varchar2) <>
409     nvl(p_rec.action_information29, hr_api.g_varchar2)  or
410     nvl(pay_aif_shd.g_old_rec.action_information30, hr_api.g_varchar2) <>
411     nvl(p_rec.action_information30, hr_api.g_varchar2) ))
412     or (p_rec.action_information_id is null)  then
413     --
414     -- Only execute the validation if absolutely necessary:
415     -- a) During update, the structure column value or any
416     --    of the attribute values have actually changed.
417     -- b) During insert.
418     --
419     hr_dflex_utility.ins_or_upd_descflex_attribs
420       (p_appl_short_name                 => 'PAY'
421       ,p_descflex_name                   => 'Action Information DF'
422       ,p_attribute_category              => p_rec.action_information_category
423       ,p_attribute1_name                 => 'ACTION_INFORMATION1'
424       ,p_attribute1_value                => p_rec.action_information1
425       ,p_attribute2_name                 => 'ACTION_INFORMATION2'
426       ,p_attribute2_value                => p_rec.action_information2
427       ,p_attribute3_name                 => 'ACTION_INFORMATION3'
428       ,p_attribute3_value                => p_rec.action_information3
429       ,p_attribute4_name                 => 'ACTION_INFORMATION4'
430       ,p_attribute4_value                => p_rec.action_information4
431       ,p_attribute5_name                 => 'ACTION_INFORMATION5'
432       ,p_attribute5_value                => p_rec.action_information5
433       ,p_attribute6_name                 => 'ACTION_INFORMATION6'
434       ,p_attribute6_value                => p_rec.action_information6
435       ,p_attribute7_name                 => 'ACTION_INFORMATION7'
436       ,p_attribute7_value                => p_rec.action_information7
437       ,p_attribute8_name                 => 'ACTION_INFORMATION8'
438       ,p_attribute8_value                => p_rec.action_information8
439       ,p_attribute9_name                 => 'ACTION_INFORMATION9'
440       ,p_attribute9_value                => p_rec.action_information9
441       ,p_attribute10_name                => 'ACTION_INFORMATION10'
442       ,p_attribute10_value               => p_rec.action_information10
443       ,p_attribute11_name                => 'ACTION_INFORMATION11'
444       ,p_attribute11_value               => p_rec.action_information11
445       ,p_attribute12_name                => 'ACTION_INFORMATION12'
446       ,p_attribute12_value               => p_rec.action_information12
447       ,p_attribute13_name                => 'ACTION_INFORMATION13'
448       ,p_attribute13_value               => p_rec.action_information13
449       ,p_attribute14_name                => 'ACTION_INFORMATION14'
450       ,p_attribute14_value               => p_rec.action_information14
454       ,p_attribute16_value               => p_rec.action_information16
451       ,p_attribute15_name                => 'ACTION_INFORMATION15'
452       ,p_attribute15_value               => p_rec.action_information15
453       ,p_attribute16_name                => 'ACTION_INFORMATION16'
455       ,p_attribute17_name                => 'ACTION_INFORMATION17'
456       ,p_attribute17_value               => p_rec.action_information17
457       ,p_attribute18_name                => 'ACTION_INFORMATION18'
458       ,p_attribute18_value               => p_rec.action_information18
459       ,p_attribute19_name                => 'ACTION_INFORMATION19'
460       ,p_attribute19_value               => p_rec.action_information19
461       ,p_attribute20_name                => 'ACTION_INFORMATION20'
462       ,p_attribute20_value               => p_rec.action_information20
463       ,p_attribute21_name                => 'ACTION_INFORMATION21'
464       ,p_attribute21_value               => p_rec.action_information21
465       ,p_attribute22_name                => 'ACTION_INFORMATION22'
466       ,p_attribute22_value               => p_rec.action_information22
467       ,p_attribute23_name                => 'ACTION_INFORMATION23'
468       ,p_attribute23_value               => p_rec.action_information23
469       ,p_attribute24_name                => 'ACTION_INFORMATION24'
470       ,p_attribute24_value               => p_rec.action_information24
471       ,p_attribute25_name                => 'ACTION_INFORMATION25'
472       ,p_attribute25_value               => p_rec.action_information25
473       ,p_attribute26_name                => 'ACTION_INFORMATION26'
474       ,p_attribute26_value               => p_rec.action_information26
475       ,p_attribute27_name                => 'ACTION_INFORMATION27'
476       ,p_attribute27_value               => p_rec.action_information27
477       ,p_attribute28_name                => 'ACTION_INFORMATION28'
478       ,p_attribute28_value               => p_rec.action_information28
479       ,p_attribute29_name                => 'ACTION_INFORMATION29'
480       ,p_attribute29_value               => p_rec.action_information29
481       ,p_attribute30_name                => 'ACTION_INFORMATION30'
482       ,p_attribute30_value               => p_rec.action_information30
483       );
484  end if;
485   --
486   hr_utility.set_location(' Leaving:'||l_proc,20);
487 end chk_ddf;
488 --
489 -- ----------------------------------------------------------------------------
490 -- |---------------------< chk_action_context_type >--------------------------|
491 -- ----------------------------------------------------------------------------
492 --
493 -- Description:
494 --   Validates the action context type.
495 --
496 -- Prerequisites:
497 --   None.
498 --
499 -- In Arguments:
500 --   p_action_context_type
501 --
502 -- Post Success:
503 --   If the action context type is valid this procedure will end normally and
504 --   processing will continue.
505 --
506 -- Post Failure:
507 --   If the  action context type is invalid then an application error is
508 --   raised as a PL/SQL exception.
509 --
510 -- Access Status:
511 --   Internal Row Handler Use Only.
512 --
513 -- ----------------------------------------------------------------------------
514 Procedure chk_action_context_type
515   (p_action_context_type in varchar2
516   ) is
517   --
518   l_proc     varchar2(72) := g_package || 'chk_action_context_type';
519 --
520 Begin
521 --
522   hr_utility.set_location('Entering:'||l_proc,10);
523   --
524   if p_action_context_type not in ('PA','AAC','AAP') then
525   --
526     fnd_message.set_name('PAY','PAY_34986_INV_ACT_CONTEXT_TYPE');
527     fnd_message.raise_error;
528   --
529   end if;
530   --
531   hr_utility.set_location('Leaving:'||l_proc,20);
532 --
533 End chk_action_context_type;
534 --
535 -- ----------------------------------------------------------------------------
536 -- |----------------------< chk_action_context_id >---------------------------|
537 -- ----------------------------------------------------------------------------
538 --
539 -- Description:
540 --   Validates the action context.
541 --
542 -- Prerequisites:
543 --   Must have already validated action context type.
544 --
545 -- In Arguments:
546 --   p_action_context_id
547 --   p_action_context_type
548 --
549 -- Post Success:
550 --   If the action context is valid this procedure will end normally and
551 --   processing will continue.
552 --
553 -- Post Failure:
554 --   If the  action context is invalid then an application error is
555 --   raised as a PL/SQL exception.
556 --
557 -- Access Status:
558 --   Internal Row Handler Use Only.
559 --
560 -- ----------------------------------------------------------------------------
561 Procedure chk_action_context_id
562   (p_action_context_id   in number
563   ,p_action_context_type in varchar2
564   ) is
565   --
566   cursor csr_pact_exists is
567     select 'X'
568     from   pay_payroll_actions
569     where  payroll_action_id = p_action_context_id;
570   --
571   cursor csr_aact_exists is
572     select 'X'
573     from   pay_assignment_actions
574     where  assignment_action_id = p_action_context_id;
575   --
576   l_proc     varchar2(72) := g_package || 'chk_action_context_id';
577   l_dummy    varchar2(1);
578 --
579 Begin
580 --
584   --
581   hr_utility.set_location('Entering:'||l_proc,10);
582   --
583   if (p_action_context_type = 'PA') then
585     open csr_pact_exists;
586     fetch csr_pact_exists into l_dummy;
587     if csr_pact_exists%notfound then
588     --
589       fnd_message.set_name('PAY','PAY_34985_INVALID_PAY_ACTION');
590       fnd_message.raise_error;
591     --
592     end if;
593   --
594   elsif (p_action_context_type in ('AAC','AAP')) then
595   --
596     open csr_aact_exists;
597     fetch csr_aact_exists into l_dummy;
598     if csr_aact_exists%notfound then
599     --
600       fnd_message.set_name('PAY','PAY_34985_INVALID_PAY_ACTION');
601       fnd_message.raise_error;
602     --
603     end if;
604   --
605   else
606   --
607     fnd_message.set_name('PAY','PAY_34986_INV_ACT_CONTEXT_TYPE');
608     fnd_message.raise_error;
609   --
610   end if;
611   --
612   hr_utility.set_location('Leaving:'||l_proc,20);
613 --
614 End chk_action_context_id;
615 --
616 -- ----------------------------------------------------------------------------
617 -- |------------------------< chk_assignment_id >-----------------------------|
618 -- ----------------------------------------------------------------------------
619 --
620 -- Description:
621 --   Validates the assignment.
622 --
623 -- Prerequisites:
624 --   None
625 --
626 -- In Arguments:
627 --   p_assignment_id
628 --
629 -- Post Success:
630 --   If the assignment is valid this procedure will end normally and
631 --   processing will continue.
632 --
633 -- Post Failure:
634 --   If the assignment is invalid then an application error is
635 --   raised as a PL/SQL exception.
636 --
637 -- Access Status:
638 --   Internal Row Handler Use Only.
639 --
640 -- ----------------------------------------------------------------------------
641 Procedure chk_assignment_id
642   (p_assignment_id   in number
643   ) is
644   --
645   cursor csr_asg_exists is
646     select 'X'
647     from   per_all_assignments_f
648     where  assignment_id = p_assignment_id;
649   --
650   l_proc     varchar2(72) := g_package || 'chk_assignment_id';
651   l_dummy    varchar2(1);
652 --
653 Begin
654 --
655   hr_utility.set_location('Entering:'||l_proc,10);
656   --
657   if (p_assignment_id is not null) then
658   --
659     open csr_asg_exists;
660     fetch csr_asg_exists into l_dummy;
661     if csr_asg_exists%notfound then
662     --
663       fnd_message.set_name('PAY','PAY_52099_ASG_INV_ASG_ID');
664       fnd_message.raise_error;
665     --
666     end if;
667   --
668   end if;
669   --
670   hr_utility.set_location('Leaving:'||l_proc,20);
671 --
672 End chk_assignment_id;
673 --
674 -- ----------------------------------------------------------------------------
675 -- |-----------------------< chk_non_updateable_args >------------------------|
676 -- ----------------------------------------------------------------------------
677 -- {Start Of Comments}
678 --
679 -- Description:
680 --   This procedure is used to ensure that non updateable attributes have
681 --   not been updated. If an attribute has been updated an error is generated.
682 --
683 -- Pre Conditions:
684 --   g_old_rec has been populated with details of the values currently in
685 --   the database.
686 --
687 -- In Arguments:
688 --   p_rec has been populated with the updated values the user would like the
689 --   record set to.
690 --
691 -- Post Success:
692 --   Processing continues if all the non updateable attributes have not
693 --   changed.
694 --
695 -- Post Failure:
696 --   An application error is raised if any of the non updatable attributes
697 --   have been altered.
698 --
699 -- {End Of Comments}
700 -- ----------------------------------------------------------------------------
701 Procedure chk_non_updateable_args
702   (p_rec in pay_aif_shd.g_rec_type
703   ) IS
704 --
705   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
706   l_error    EXCEPTION;
707   l_argument varchar2(30);
708 --
709 Begin
710   --
711   -- Only proceed with the validation if a row exists for the current
712   -- record in the HR Schema.
713   --
714   IF NOT pay_aif_shd.api_updating
715       (p_action_information_id                => p_rec.action_information_id
716       ,p_object_version_number                => p_rec.object_version_number
717       ) THEN
718      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
719      fnd_message.set_token('PROCEDURE ', l_proc);
720      fnd_message.set_token('STEP ', '5');
721      fnd_message.raise_error;
722   END IF;
723   --
724   -- action_context_id
725   --
726   if nvl(p_rec.action_context_id,hr_api.g_number) <>
727      nvl(pay_aif_shd.g_old_rec.action_context_id,hr_api.g_number) then
728   --
729     l_argument := 'p_rec.action_context_id';
730     raise l_error;
731   --
732   end if;
733   --
734   -- action_context_type
735   --
736   if nvl(p_rec.action_context_type,hr_api.g_varchar2) <>
740     raise l_error;
737      nvl(pay_aif_shd.g_old_rec.action_context_type,hr_api.g_varchar2) then
738   --
739     l_argument := 'p_rec.action_context_type';
741   --
742   end if;
743   --
744   -- effective_date
745   --
746   if nvl(p_rec.effective_date,hr_api.g_date) <>
747      nvl(pay_aif_shd.g_old_rec.effective_date,hr_api.g_date) then
748   --
749     l_argument := 'p_rec.effective_date';
750     raise l_error;
751   --
752   end if;
753   --
754   -- assignment_id
755   --
756   if nvl(p_rec.assignment_id,hr_api.g_number) <>
757      nvl(pay_aif_shd.g_old_rec.assignment_id,hr_api.g_number) then
758   --
759     l_argument := 'p_rec.assignment_id';
760     raise l_error;
761   --
762   end if;
763   --
764   -- action_information_category
765   --
766   if nvl(p_rec.action_information_category,hr_api.g_varchar2) <>
767      nvl(pay_aif_shd.g_old_rec.action_information_category,hr_api.g_varchar2) then
768   --
769     l_argument := 'p_rec.action_information_category';
770     raise l_error;
771   --
772   end if;
773   --
774   -- tax_unit_id
775   --
776   if nvl(p_rec.tax_unit_id,hr_api.g_number) <>
777      nvl(pay_aif_shd.g_old_rec.tax_unit_id,hr_api.g_number) then
778   --
779     l_argument := 'p_rec.tax_unit_id';
780     raise l_error;
781   --
782   end if;
783   --
784   -- jurisdiction_code
785   --
786   if nvl(p_rec.jurisdiction_code,hr_api.g_varchar2) <>
787      nvl(pay_aif_shd.g_old_rec.jurisdiction_code,hr_api.g_varchar2) then
788   --
789     l_argument := 'p_rec.jurisdiction_code';
790     raise l_error;
791   --
792   end if;
793   --
794   -- source_id
795   --
796   if nvl(p_rec.source_id,hr_api.g_number) <>
797      nvl(pay_aif_shd.g_old_rec.source_id,hr_api.g_number) then
798   --
799     l_argument := 'p_rec.source_id';
800     raise l_error;
801   --
802   end if;
803   --
804   -- source_text
805   --
806   if nvl(p_rec.source_text,hr_api.g_varchar2) <>
807      nvl(pay_aif_shd.g_old_rec.source_text,hr_api.g_varchar2) then
808   --
809     l_argument := 'p_rec.source_text';
810     raise l_error;
811   --
812   end if;
813   --
814   -- tax_group
815   --
816   if nvl(p_rec.tax_group,hr_api.g_varchar2) <>
817      nvl(pay_aif_shd.g_old_rec.tax_group,hr_api.g_varchar2) then
818   --
819     l_argument := 'p_rec.tax_group';
820     raise l_error;
821   --
822   end if;
823   --
824   EXCEPTION
825     WHEN l_error THEN
826        hr_api.argument_changed_error
827          (p_api_name => l_proc
828          ,p_argument => l_argument);
829     WHEN OTHERS THEN
830        RAISE;
831 End chk_non_updateable_args;
832 --
833 -- ----------------------------------------------------------------------------
834 -- |---------------------------< insert_validate >----------------------------|
835 -- ----------------------------------------------------------------------------
836 Procedure insert_validate
837   (p_rec                          in pay_aif_shd.g_rec_type
838   ) is
839 --
840   l_proc  varchar2(72) := g_package||'insert_validate';
841 --
842 Begin
843 --
844   hr_utility.set_location('Entering:'||l_proc, 5);
845   --
846   -- Call all supporting business operations
847   --
848   pay_aif_bus.chk_action_context_type(p_rec.action_context_type);
849   --
850   pay_aif_bus.chk_action_context_id(p_rec.action_context_id,p_rec.action_context_type);
851   --
852   pay_aif_bus.chk_assignment_id(p_rec.assignment_id);
853   --
854   -- Removed call - assume trusted source (performance implications
855   --                in calling this for large volumes)
856   --  pay_aif_bus.chk_ddf(p_rec);
857   --
858   hr_utility.set_location(' Leaving:'||l_proc, 10);
859 --
860 End insert_validate;
861 --
862 -- ----------------------------------------------------------------------------
863 -- |---------------------------< update_validate >----------------------------|
864 -- ----------------------------------------------------------------------------
865 Procedure update_validate
866   (p_rec                          in pay_aif_shd.g_rec_type
867   ) is
868 --
869   l_proc  varchar2(72) := g_package||'update_validate';
870 --
871 Begin
872 --
873   hr_utility.set_location('Entering:'||l_proc, 5);
874   --
875   chk_non_updateable_args(p_rec);
876   --
877   -- Removed call - assume trusted source (performance implications
878   --                in calling this for large volumes)
879   --  pay_aif_bus.chk_ddf(p_rec);
880   --
881   hr_utility.set_location(' Leaving:'||l_proc, 10);
882 --
883 End update_validate;
884 --
885 -- ----------------------------------------------------------------------------
886 -- |---------------------------< delete_validate >----------------------------|
887 -- ----------------------------------------------------------------------------
888 Procedure delete_validate
889   (p_rec                          in pay_aif_shd.g_rec_type
890   ) is
891 --
892   l_proc  varchar2(72) := g_package||'delete_validate';
893 --
894 Begin
898   --
895   hr_utility.set_location('Entering:'||l_proc, 5);
896   --
897   -- Call all supporting business operations
899   hr_utility.set_location(' Leaving:'||l_proc, 10);
900 End delete_validate;
901 --
902 end pay_aif_bus;