DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_STL_BUS

Source


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