DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_FFA_BUS

Source


1 Package Body pqp_ffa_bus as
2 /* $Header: pqffarhi.pkb 120.0 2006/04/26 23:47 pbhure noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_ffa_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_flxdu_func_attribute_id     number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_flxdu_func_attribute_id              in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare cursor
26   --
27   cursor csr_sec_grp is
28     select pbg.security_group_id,
29            pbg.legislation_code
30       from per_business_groups_perf pbg
31          , pqp_flxdu_func_attributes ffa
32      where ffa.flxdu_func_attribute_id = p_flxdu_func_attribute_id
33        and pbg.legislation_code = ffa.legislation_code;
34 
35   --
36   -- Declare local variables
37   --
38   l_security_group_id number;
39   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
40   l_legislation_code  varchar2(150);
41   --
42 begin
43   --
44   hr_utility.set_location('Entering:'|| l_proc, 10);
45   --
46   -- Ensure that all the mandatory parameter are not null
47   --
48   hr_api.mandatory_arg_error
49     (p_api_name           => l_proc
50     ,p_argument           => 'flxdu_func_attribute_id'
51     ,p_argument_value     => p_flxdu_func_attribute_id
52     );
53   --
54   open csr_sec_grp;
55   fetch csr_sec_grp into l_security_group_id
56                        , l_legislation_code;
57   --
58   if csr_sec_grp%notfound then
59      --
60      close csr_sec_grp;
61      --
62      -- The primary key is invalid therefore we must error
63      --
64      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
65      hr_multi_message.add
66        (p_associated_column1
67         => nvl(p_associated_column1,'FLXDU_FUNC_ATTRIBUTE_ID')
68        );
69      --
70   else
71     close csr_sec_grp;
72     --
73     -- Set the security_group_id in CLIENT_INFO
74     --
75     hr_api.set_security_group_id
76       (p_security_group_id => l_security_group_id
77       );
78     --
79     -- Set the sessions legislation context in HR_SESSION_DATA
80     --
81     hr_api.set_legislation_context(l_legislation_code);
82   end if;
83   --
84   hr_utility.set_location(' Leaving:'|| l_proc, 20);
85   --
86 end set_security_group_id;
87 --
88 --  ---------------------------------------------------------------------------
89 --  |---------------------< return_legislation_code >-------------------------|
90 --  ---------------------------------------------------------------------------
91 --
92 Function return_legislation_code
93   (p_flxdu_func_attribute_id              in     number
94   )
95   Return Varchar2 Is
96   --
97   -- Declare cursor
98   --
99   cursor csr_leg_code is
100     select ffa.legislation_code
101       from pqp_flxdu_func_attributes ffa
102      where ffa.flxdu_func_attribute_id = p_flxdu_func_attribute_id;
103   --
104   -- Declare local variables
105   --
106   l_legislation_code  varchar2(150);
107   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
108   --
109 Begin
110   --
111   hr_utility.set_location('Entering:'|| l_proc, 10);
112   --
116     (p_api_name           => l_proc
113   -- Ensure that all the mandatory parameter are not null
114   --
115   hr_api.mandatory_arg_error
117     ,p_argument           => 'flxdu_func_attribute_id'
118     ,p_argument_value     => p_flxdu_func_attribute_id
119     );
120   --
121   if ( nvl(pqp_ffa_bus.g_flxdu_func_attribute_id, hr_api.g_number)
122        = p_flxdu_func_attribute_id) then
123     --
124     -- The legislation code has already been found with a previous
125     -- call to this function. Just return the value in the global
126     -- variable.
127     --
128     l_legislation_code := pqp_ffa_bus.g_legislation_code;
129     hr_utility.set_location(l_proc, 20);
130   else
131     --
132     -- The ID is different to the last call to this function
133     -- or this is the first call to this function.
134     --
135     open csr_leg_code;
136     fetch csr_leg_code into l_legislation_code;
137     --
138     if csr_leg_code%notfound then
139       --
140       -- The primary key is invalid therefore we must error
141       --
142       close csr_leg_code;
143       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
144       fnd_message.raise_error;
145     end if;
146     hr_utility.set_location(l_proc,30);
147     --
148     -- Set the global variables so the values are
149     -- available for the next call to this function.
150     --
151     close csr_leg_code;
152     pqp_ffa_bus.g_flxdu_func_attribute_id     := p_flxdu_func_attribute_id;
153     pqp_ffa_bus.g_legislation_code  := l_legislation_code;
154   end if;
155   hr_utility.set_location(' Leaving:'|| l_proc, 40);
156   return l_legislation_code;
157 end return_legislation_code;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |-----------------------< chk_non_updateable_args >------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 --   This procedure is used to ensure that non updateable attributes have
166 --   not been updated. If an attribute has been updated an error is generated.
167 --
168 -- Pre Conditions:
169 --   g_old_rec has been populated with details of the values currently in
170 --   the database.
171 --
172 -- In Arguments:
173 --   p_rec has been populated with the updated values the user would like the
174 --   record set to.
175 --
176 -- Post Success:
177 --   Processing continues if all the non updateable attributes have not
178 --   changed.
179 --
180 -- Post Failure:
181 --   An application error is raised if any of the non updatable attributes
182 --   have been altered.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 Procedure chk_non_updateable_args
187   (p_rec in pqp_ffa_shd.g_rec_type
188   ) IS
189 --
190   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
191 --
192 Begin
193   --
194   -- Only proceed with the validation if a row exists for the current
195   -- record in the HR Schema.
196   --
197   IF NOT pqp_ffa_shd.api_updating
198       (p_flxdu_func_attribute_id           => p_rec.flxdu_func_attribute_id
199       ,p_object_version_number             => p_rec.object_version_number
200       ) THEN
201      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
202      fnd_message.set_token('PROCEDURE ', l_proc);
203      fnd_message.set_token('STEP ', '5');
204      fnd_message.raise_error;
205   END IF;
206   --
207   -- EDIT_HERE: Add checks to ensure non-updateable args have
208   --            not been updated.
209   --
210 End chk_non_updateable_args;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |---------------------------< insert_validate >----------------------------|
214 -- ----------------------------------------------------------------------------
215 Procedure insert_validate
216   (p_rec                          in pqp_ffa_shd.g_rec_type
217   ) is
218 --
219   l_proc  varchar2(72) := g_package||'insert_validate';
220 --
221 Begin
222   hr_utility.set_location('Entering:'||l_proc, 5);
223   --
224   -- Call all supporting business operations
225   --
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 pqp_ffa_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 pqp_ffa_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 pqp_ffa_bus;