DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CNT_BUS

Source


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