DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BTT_BUS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body pay_btt_bus as
2 /* $Header: pybttrhi.pkb 120.0 2005/05/29 03:24 appldev noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_btt_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_balance_type_id             number         default null;
15 g_language                    varchar2(4)    default null;
16 --
17 --  ---------------------------------------------------------------------------
21 Procedure set_security_group_id
18 --  |----------------------< set_security_group_id >--------------------------|
19 --  ---------------------------------------------------------------------------
20 --
22   (p_balance_type_id                      in number
23   ,p_associated_column1                   in varchar2 default null
24   ) is
25   --
26   -- Declare cursor
27   --
28   cursor csr_sec_grp is
29     select pbg.security_group_id,
30            pbg.legislation_code
31       from per_business_groups_perf pbg
32          , pay_balance_types_tl btt
33          , pay_balance_types pbt
34      where btt.balance_type_id = p_balance_type_id
35        and btt.balance_type_id = pbt.balance_type_id
36        and pbg.business_group_id = pbt.business_group_id;
37   --
38   -- Declare local variables
39   --
40   l_security_group_id number;
41   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
42   l_legislation_code  varchar2(150);
43   --
44 begin
45   --
46   hr_utility.set_location('Entering:'|| l_proc, 10);
47   --
48   -- Ensure that all the mandatory parameter are not null
49   --
50   hr_api.mandatory_arg_error
51     (p_api_name           => l_proc
52     ,p_argument           => 'balance_type_id'
53     ,p_argument_value     => p_balance_type_id
54     );
55   --
56   --
57   open csr_sec_grp;
58   fetch csr_sec_grp into l_security_group_id
59                        , l_legislation_code;
60   --
61   if csr_sec_grp%notfound then
62      --
63      close csr_sec_grp;
64      --
65      -- The primary key is invalid therefore we must error
66      --
67      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
68      hr_multi_message.add
69        (p_associated_column1
70         => nvl(p_associated_column1,'BALANCE_TYPE_ID')
71        );
72      --
73   else
74     close csr_sec_grp;
75     --
76     -- Set the security_group_id in CLIENT_INFO
77     --
78     hr_api.set_security_group_id
79       (p_security_group_id => l_security_group_id
80       );
81     --
82     -- Set the sessions legislation context in HR_SESSION_DATA
83     --
84     hr_api.set_legislation_context(l_legislation_code);
85   end if;
86   --
87   hr_utility.set_location(' Leaving:'|| l_proc, 20);
88   --
89 end set_security_group_id;
90 --
91 --  ---------------------------------------------------------------------------
92 --  |---------------------< return_legislation_code >-------------------------|
93 --  ---------------------------------------------------------------------------
94 --
95 Function return_legislation_code
96   (p_balance_type_id                      in     number
97   ,p_language                             in     varchar2
98   )
99   Return Varchar2 Is
100   --
101   -- Declare cursor
102   --
103   cursor csr_leg_code is
104     select pbg.legislation_code
105       from per_business_groups_perf     pbg
106          , pay_balance_types_tl btt
107          , pay_balance_types pbt
108      where btt.balance_type_id = p_balance_type_id
109        and btt.language = p_language
110        and btt.balance_type_id = pbt.balance_type_id
111        and pbg.business_group_id = pbt.business_group_id;
112 
113   --
114   -- Declare local variables
115   --
116   l_legislation_code  varchar2(150);
117   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
118   --
119 Begin
120   --
121   hr_utility.set_location('Entering:'|| l_proc, 10);
122   --
123   -- Ensure that all the mandatory parameter are not null
124   --
125   hr_api.mandatory_arg_error
126     (p_api_name           => l_proc
127     ,p_argument           => 'balance_type_id'
128     ,p_argument_value     => p_balance_type_id
129     );
130   --
131   --
132   if (( nvl(pay_btt_bus.g_balance_type_id, hr_api.g_number)
133        = p_balance_type_id)
134   and ( nvl(pay_btt_bus.g_language, hr_api.g_varchar2)
135        = p_language)) then
136     --
137     -- The legislation code has already been found with a previous
138     -- call to this function. Just return the value in the global
139     -- variable.
140     --
141     l_legislation_code := pay_btt_bus.g_legislation_code;
142     hr_utility.set_location(l_proc, 20);
143   else
144     --
145     -- The ID is different to the last call to this function
146     -- or this is the first call to this function.
147     --
148     open csr_leg_code;
149     fetch csr_leg_code into l_legislation_code;
150     --
151     if csr_leg_code%notfound then
152       --
153       -- The primary key is invalid therefore we must error
154       --
155       close csr_leg_code;
156       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
157       fnd_message.raise_error;
158     end if;
159     hr_utility.set_location(l_proc,30);
160     --
161     -- Set the global variables so the values are
162     -- available for the next call to this function.
163     --
164     close csr_leg_code;
165     pay_btt_bus.g_balance_type_id             := p_balance_type_id;
166     pay_btt_bus.g_language                    := p_language;
167     pay_btt_bus.g_legislation_code  := l_legislation_code;
168   end if;
172 --
169   hr_utility.set_location(' Leaving:'|| l_proc, 40);
170   return l_legislation_code;
171 end return_legislation_code;
173 -- ----------------------------------------------------------------------------
174 -- |-----------------------< chk_non_updateable_args >------------------------|
175 -- ----------------------------------------------------------------------------
176 -- {Start Of Comments}
177 --
181 --
178 -- Description:
179 --   This procedure is used to ensure that non updateable attributes have
180 --   not been updated. If an attribute has been updated an error is generated.
182 -- Pre Conditions:
183 --   g_old_rec has been populated with details of the values currently in
184 --   the database.
185 --
186 -- In Arguments:
187 --   p_rec has been populated with the updated values the user would like the
188 --   record set to.
189 --
190 -- Post Success:
191 --   Processing continues if all the non updateable attributes have not
192 --   changed.
193 --
194 -- Post Failure:
195 --   An application error is raised if any of the non updatable attributes
196 --   have been altered.
197 --
198 -- {End Of Comments}
199 -- ----------------------------------------------------------------------------
200 Procedure chk_non_updateable_args
201   (p_rec in pay_btt_shd.g_rec_type
202   ) IS
203 --
204   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
205 --
206 Begin
207   --
208   -- Only proceed with the validation if a row exists for the current
209   -- record in the HR Schema.
210   --
211   IF NOT pay_btt_shd.api_updating
212       (p_balance_type_id                   => p_rec.balance_type_id
213       ,p_language                          => p_rec.language
214       ) THEN
215      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
216      fnd_message.set_token('PROCEDURE ', l_proc);
217      fnd_message.set_token('STEP ', '5');
218      fnd_message.raise_error;
219   END IF;
220   --
221   -- EDIT_HERE: Add checks to ensure non-updateable args have
222   --            not been updated.
223   --
224 End chk_non_updateable_args;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |---------------------------< insert_validate >----------------------------|
228 -- ----------------------------------------------------------------------------
229 Procedure insert_validate
230   (p_rec                          in pay_btt_shd.g_rec_type
231   ) is
232 --
233   l_proc  varchar2(72) := g_package||'insert_validate';
234 --
235 Begin
236   hr_utility.set_location('Entering:'||l_proc, 5);
237   --
238   -- Call all supporting business operations
239   --
240   --
241   -- EDIT_HERE: As this table does not have a mandatory business_group_id
242   -- column, ensure client_info is populated by calling a suitable
243   -- ???_???_bus.set_security_group_id procedure, or add one of the following
244   -- comments:
245   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
246   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
247   --
248   -- Validate Dependent Attributes
249   --
250   --
251   hr_utility.set_location(' Leaving:'||l_proc, 10);
252 End insert_validate;
253 --
254 -- ----------------------------------------------------------------------------
255 -- |---------------------------< update_validate >----------------------------|
256 -- ----------------------------------------------------------------------------
257 Procedure update_validate
258   (p_rec                          in pay_btt_shd.g_rec_type
259   ) is
260 --
261   l_proc  varchar2(72) := g_package||'update_validate';
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 5);
265   --
266   -- Call all supporting business operations
267   --
268   --
269   -- EDIT_HERE: As this table does not have a mandatory business_group_id
270   -- column, ensure client_info is populated by calling a suitable
271   -- ???_???_bus.set_security_group_id procedure, or add one of the following
272   -- comments:
273   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
274   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
275   --
276   -- Validate Dependent Attributes
277   --
278   chk_non_updateable_args
279     (p_rec              => p_rec
280     );
281   --
282   --
283   hr_utility.set_location(' Leaving:'||l_proc, 10);
284 End update_validate;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |---------------------------< delete_validate >----------------------------|
291   ) is
288 -- ----------------------------------------------------------------------------
289 Procedure delete_validate
290   (p_rec                          in pay_btt_shd.g_rec_type
292 --
293   l_proc  varchar2(72) := g_package||'delete_validate';
294 --
295 Begin
296   hr_utility.set_location('Entering:'||l_proc, 5);
297   --
298   -- Call all supporting business operations
299   --
300   hr_utility.set_location(' Leaving:'||l_proc, 10);
301 End delete_validate;
302 --
303 end pay_btt_bus;