DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_EXA_BUS

Source


1 PACKAGE BODY pay_exa_bus AS
2 /* $Header: pyexarhi.pkb 115.13 2003/09/26 06:48:50 tvankayl ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_exa_bus.';  -- global package name
9 -- [start of change: 40.1, Dave Harris]
10 -- ----------------------------------------------------------------------------
11 -- |--------------------------< chk_territory_code >--------------------------|
12 -- ----------------------------------------------------------------------------
13 procedure chk_territory_code(
14    p_territory_code        in varchar2
15   ,p_external_account_id   in number
16   ,p_object_version_number in number
17   ) is
18   --
19   cursor csr_chk_territory_code is
20     SELECT 1
21     FROM   FND_TERRITORIES_VL ft
22     WHERE  ft.territory_code = p_territory_code
23     ;
24   --
25   cursor csr_territory_code is
26     SELECT territory_code
27     FROM   PAY_EXTERNAL_ACCOUNTS pea
28     WHERE  pea.external_account_id = p_external_account_id
29     ;
30   --
31   l_proc     varchar2(72) := g_package||'chk_territory_code';
32   -- stub - l_api_updating is redundant
33   l_api_updating boolean;
34   l_territory_code          pay_external_accounts.territory_code%type;
35   l_dummy        number;
36   --
37 begin
38   hr_utility.set_location('Entering:'||l_proc, 5);
39   --
40   -- true if PK exists, false if PK does not exist
41   -- stub - not required
42   --
43   l_api_updating := pay_exa_shd.api_updating
44                       (p_external_account_id   => p_external_account_id,
45                        p_object_version_number => p_object_version_number);
46 
47   --
48   -- should not be able to U territory_code on an existing combination,
49   -- only set territory code if I'ing a fresh combination record,
50   --
51   open  csr_territory_code;
52   fetch csr_territory_code into l_territory_code;
53   close csr_territory_code;
54   --
55   -- new combination record,
56   -- will be setting territory code onto it,
57   -- therefore validate territory code,
58   -- nb. territory code can be assumed to be not null as it is a mandatory
59   --     parameter
60   --
61   if l_territory_code is null then
62     hr_utility.trace('| fresh combination, validate territory_code');
63     --
64     hr_utility.set_location(l_proc, 10);
65     --
66     open csr_chk_territory_code;
67     fetch csr_chk_territory_code into l_dummy;
68     --
69     if csr_chk_territory_code%notfound then
70       close csr_chk_territory_code;
71       hr_utility.set_message(801, 'HR_7727_EXA_TERR_CODE_INVALID');
72       hr_utility.raise_error;
73     end if;
74     --
75     close csr_chk_territory_code;
76   --
77   -- territory code exists, therefore using an existing combination record,
78   -- check that territory code has not being changed
79   --
80   else
81     hr_utility.trace('| old combination, chk territory_code is not mutating');
82     if ( nvl(p_territory_code, hr_api.g_varchar2) <>
83          nvl(pay_exa_shd.g_old_rec.territory_code, hr_api.g_varchar2) ) then
84       hr_api.argument_changed_error(
85         p_api_name => l_proc,
86         p_argument => 'TERRITORY_CODE');
87     end if;
88   end if;
89   --
90   hr_utility.set_location(' Leaving:'||l_proc, 15);
91 end chk_territory_code;
92 -- [end of change: 40.1, Dave Harris]
93 --
94 -- ----------------------------------------------------------------------------
95 -- |---------------------------< insert_validate >----------------------------|
96 -- ----------------------------------------------------------------------------
97 procedure insert_validate(
98    p_rec               in pay_exa_shd.g_rec_type
99   ,p_business_group_id in number
100   ) is
101   --
102   l_proc  varchar2(72) := g_package||'insert_validate';
103   --
104 begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   -- Call all supporting business operations
108   --
109   -- [start of change: 40.1, Dave Harris]
110   chk_territory_code(p_territory_code        => p_rec.territory_code,
111                      p_external_account_id   => p_rec.external_account_id,
112                      p_object_version_number => p_rec.object_version_number);
113   -- [end of change: 40.1, Dave Harris]
114   --
115   hr_utility.set_location(' Leaving:'||l_proc, 10);
116 end insert_validate;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------< update_validate >----------------------------|
120 -- ----------------------------------------------------------------------------
121 procedure update_validate(
122    p_rec in pay_exa_shd.g_rec_type
123    ) is
124   --
125   l_proc  varchar2(72) := g_package||'update_validate';
126   --
127 begin
128   hr_utility.set_location('Entering:'||l_proc, 5);
129   --
130   -- Call all supporting business operations
131   --
132   -- [start of change: 40.1, Dave Harris]
133   chk_territory_code(p_territory_code        => p_rec.territory_code,
134                      p_external_account_id   => p_rec.external_account_id,
135                      p_object_version_number => p_rec.object_version_number);
136   --
137   -- [end of change: 40.1, Dave Harris]
138   --
139   hr_utility.set_location(' Leaving:'||l_proc, 10);
140 end update_validate;
141 --
142 END pay_exa_bus;