DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_IVT_BUS

Source


1 Package Body pay_ivt_bus as
2 /* $Header: pyivtrhi.pkb 120.1 2005/10/04 23:01:29 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_ivt_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_input_value_id              number         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_input_value_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       from per_business_groups pbg
31          , pay_input_values_f_tl ivt
32      where ivt.input_value_id = p_input_value_id;
33   --
34   -- Declare local variables
35   --
36   l_security_group_id number;
37   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
38   --
39 begin
40   --
41   hr_utility.set_location('Entering:'|| l_proc, 10);
42   --
43   -- Ensure that all the mandatory parameter are not null
44   --
45   hr_api.mandatory_arg_error
46     (p_api_name           => l_proc
47     ,p_argument           => 'input_value_id'
48     ,p_argument_value     => p_input_value_id
49     );
50   --
51   --
52   open csr_sec_grp;
53   fetch csr_sec_grp into l_security_group_id;
54   --
55   if csr_sec_grp%notfound then
56      --
57      close csr_sec_grp;
58      --
59      -- The primary key is invalid therefore we must error
60      --
61      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
62      hr_multi_message.add
63        (p_associated_column1
64         => nvl(p_associated_column1,'INPUT_VALUE_ID')
65        );
66      --
67   else
68     close csr_sec_grp;
69     --
70     -- Set the security_group_id in CLIENT_INFO
71     --
72     hr_api.set_security_group_id
73       (p_security_group_id => l_security_group_id
74       );
75   end if;
76   --
77   hr_utility.set_location(' Leaving:'|| l_proc, 20);
78   --
79 end set_security_group_id;
80 --
81 --  ---------------------------------------------------------------------------
82 --  |---------------------< return_legislation_code >-------------------------|
83 --  ---------------------------------------------------------------------------
84 --
85 Function return_legislation_code
86   (p_input_value_id                       in     number
87   ,p_language                             in     varchar2
88   )
89   Return Varchar2 Is
90   --
91   -- Declare cursor
92   --
93   cursor csr_leg_code is
94     select pbg.legislation_code
95       from per_business_groups     pbg
96          , pay_input_values_f_tl ivt
97      where ivt.input_value_id = p_input_value_id
98        and ivt.language = p_language;
99   --
100   -- Declare local variables
101   --
102   l_legislation_code  varchar2(150);
103   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
104   --
105 Begin
106   --
107   hr_utility.set_location('Entering:'|| l_proc, 10);
108   --
109   -- Ensure that all the mandatory parameter are not null
110   --
111   hr_api.mandatory_arg_error
112     (p_api_name           => l_proc
113     ,p_argument           => 'input_value_id'
114     ,p_argument_value     => p_input_value_id
115     );
116   --
117   --
118   if (( nvl(pay_ivt_bus.g_input_value_id, hr_api.g_number)
119        = p_input_value_id)
120   and ( nvl(pay_ivt_bus.g_language, hr_api.g_varchar2)
121        = p_language)) then
122     --
123     -- The legislation code has already been found with a previous
124     -- call to this function. Just return the value in the global
125     -- variable.
126     --
127     l_legislation_code := pay_ivt_bus.g_legislation_code;
128     hr_utility.set_location(l_proc, 20);
129   else
130     --
131     -- The ID is different to the last call to this function
132     -- or this is the first call to this function.
133     --
134     open csr_leg_code;
135     fetch csr_leg_code into l_legislation_code;
136     --
137     if csr_leg_code%notfound then
138       --
139       -- The primary key is invalid therefore we must error
140       --
141       close csr_leg_code;
142       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
143       fnd_message.raise_error;
144     end if;
145     hr_utility.set_location(l_proc,30);
146     --
147     -- Set the global variables so the values are
148     -- available for the next call to this function.
149     --
150     close csr_leg_code;
151     pay_ivt_bus.g_input_value_id              := p_input_value_id;
152     pay_ivt_bus.g_language                    := p_language;
153     pay_ivt_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 pay_ivt_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 pay_ivt_shd.api_updating
198       (p_input_value_id                    => p_rec.input_value_id
199       ,p_language                          => p_rec.language
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 pay_ivt_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   --  No business group context.  HR_STANDARD_LOOKUPS used for validation.
228   --  CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
229   --
230   -- Validate Dependent Attributes
231   --
232   --
233   hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End insert_validate;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |---------------------------< update_validate >----------------------------|
238 -- ----------------------------------------------------------------------------
239 Procedure update_validate
240   (p_rec                          in pay_ivt_shd.g_rec_type
241   ) is
242 --
243   l_proc  varchar2(72) := g_package||'update_validate';
244 --
245 Begin
246   hr_utility.set_location('Entering:'||l_proc, 5);
247   --
248   -- Call all supporting business operations
249   --
250   --
251   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
252   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
253   --
254   -- Validate Dependent Attributes
255   --
256   chk_non_updateable_args
257     (p_rec              => p_rec
258     );
259   --
260   --
261   hr_utility.set_location(' Leaving:'||l_proc, 10);
262 End update_validate;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------< delete_validate >----------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure delete_validate
268   (p_rec                          in pay_ivt_shd.g_rec_type
269   ) is
270 --
271   l_proc  varchar2(72) := g_package||'delete_validate';
272 --
273 Begin
274   hr_utility.set_location('Entering:'||l_proc, 5);
275   --
276   -- Call all supporting business operations
277   --
278   hr_utility.set_location(' Leaving:'||l_proc, 10);
279 End delete_validate;
280 --
281 end pay_ivt_bus;