DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_AUD_BUS

Source


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