DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_LCV_BUS

Source


1 Package Body irc_lcv_bus as
2 /* $Header: irlcvrhi.pkb 120.0 2005/10/03 14:58 rbanda noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_lcv_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_location_criteria_value_id  number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_location_criteria_value_id           in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare local variables
26   --
27   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
28   --
29 begin
30   --
31   hr_utility.set_location('Entering:'|| l_proc, 10);
32   --
33   -- Ensure that all the mandatory parameter are not null
34   --
35   hr_api.mandatory_arg_error
36     (p_api_name           => l_proc
37     ,p_argument           => 'location_criteria_value_id'
38     ,p_argument_value     => p_location_criteria_value_id
39     );
40   --
41   hr_utility.set_location(' Leaving:'|| l_proc, 20);
42   --
43 end set_security_group_id;
44 --
45 --  ---------------------------------------------------------------------------
46 --  |---------------------< return_legislation_code >-------------------------|
47 --  ---------------------------------------------------------------------------
48 --
49 Function return_legislation_code
50   (p_location_criteria_value_id           in     number
51   )
52   Return Varchar2 Is
53   --
54   -- Declare local variables
55   --
56   l_legislation_code  varchar2(150) := 'NONE';
57   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
58   --
59 Begin
60   --
61   hr_utility.set_location('Entering:'|| l_proc, 10);
62   --
63   -- Ensure that all the mandatory parameter are not null
64   --
65   hr_api.mandatory_arg_error
66     (p_api_name           => l_proc
67     ,p_argument           => 'location_criteria_value_id'
68     ,p_argument_value     => p_location_criteria_value_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 40);
72   return l_legislation_code;
73 end return_legislation_code;
74 --
75 -- ----------------------------------------------------------------------------
76 -- |-----------------------< chk_non_updateable_args >------------------------|
77 -- ----------------------------------------------------------------------------
78 -- {Start Of Comments}
79 --
80 -- Description:
81 --   This procedure is used to ensure that non updateable attributes have
82 --   not been updated. If an attribute has been updated an error is generated.
83 --
84 -- Pre Conditions:
85 --   g_old_rec has been populated with details of the values currently in
86 --   the database.
87 --
88 -- In Arguments:
89 --   p_rec has been populated with the updated values the user would like the
90 --   record set to.
91 --
92 -- Post Success:
93 --   Processing continues if all the non updateable attributes have not
94 --   changed.
95 --
96 -- Post Failure:
97 --   An application error is raised if any of the non updatable attributes
98 --   have been altered.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure chk_non_updateable_args
103   (p_rec in irc_lcv_shd.g_rec_type
104   ) IS
105 --
106   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
107 --
108 Begin
109   --
110   -- Only proceed with the validation if a row exists for the current
111   -- record in the HR Schema.
112   --
113   IF NOT irc_lcv_shd.api_updating
114       (p_location_criteria_value_id        => p_rec.location_criteria_value_id
115       ,p_object_version_number             => p_rec.object_version_number
116       ) THEN
117      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
118      fnd_message.set_token('PROCEDURE ', l_proc);
119      fnd_message.set_token('STEP ', '5');
120      fnd_message.raise_error;
121   END IF;
122   --
123   -- Add checks to ensure non-updateable args have
124   --            not been updated.
125   --
126   if p_rec.location_criteria_value_id <>
127        irc_lcv_shd.g_old_rec.location_criteria_value_id then
128      hr_api.argument_changed_error
129      (p_api_name   => l_proc
130      ,p_argument   => 'LOCATION_CRITERIA_VALUE_ID'
131      ,p_base_table => irc_lcv_shd.g_tab_nam
132      );
133   end if;
134   --
135 End chk_non_updateable_args;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |------------------------< chk_search_criteria_id >------------------------|
139 -- ----------------------------------------------------------------------------
140 -- {Start Of Comments}
141 --
142 -- Description:
143 --   This procedure is used to ensure that search criteria id exists in
144 --   IRC_SEARCH_CRITERIA
145 --
146 -- Pre Conditions:
147 --
148 -- In Arguments:
149 --   p_search_criteria_id
150 --
151 -- Post Success:
152 --   Processing continues if search criteria id is valid
153 --
154 -- Post Failure:
155 --   An application error is raised if search criteria id is invalid
156 --
157 -- {End Of Comments}
158 -- ----------------------------------------------------------------------------
159 Procedure chk_search_criteria_id
160   (p_search_criteria_id     in irc_location_criteria_values.search_criteria_id%TYPE
161   ) IS
162 --
163   l_proc       varchar2(72) := g_package || 'chk_search_criteria_id';
164   l_search_criteria_id varchar2(1);
165 --
166   cursor csr_search_criteria is
167     select null from irc_search_criteria isc
168     where isc.search_criteria_id = p_search_criteria_id;
169 --
170 begin
171   hr_utility.set_location('Entering:'||l_proc,10);
172   -- Check that search_criteria_id is not null.
173   hr_api.mandatory_arg_error
174     (p_api_name           => l_proc
175     ,p_argument           => 'SEARCH_CRITERIA_ID'
176     ,p_argument_value     => p_search_criteria_id
177     );
178   -- Check that search_criteria_id exists in irc_search_criteria.
179   hr_utility.set_location(l_proc,20);
180   if p_search_criteria_id is not null then
181     -- Check that search_criteria_id exists in irc_search_criteria.
182     hr_utility.set_location(l_proc,30);
183     open csr_search_criteria;
184     fetch csr_search_criteria into l_search_criteria_id;
185     hr_utility.set_location(l_proc,40);
186     if csr_search_criteria%NOTFOUND then
187       close csr_search_criteria;
188       fnd_message.set_name('PER','IRC_412226_INV_SRCH_CRITERIA');
189       fnd_message.raise_error;
190     end if;
191   end if;
192   close csr_search_criteria;
193   --
194   hr_utility.set_location(' Leaving:'||l_proc,50);
195   exception
196    when app_exception.application_exception then
197     if hr_multi_message.exception_add
198        (p_associated_column1 =>
199          'IRC_LOCATION_CRITERIA_VALUES.SEARCH_CRITERIA_ID'
200        ) then
201       hr_utility.set_location(' Leaving:'||l_proc,60);
202       raise;
203     end if;
204   hr_utility.set_location(' Leaving:'||l_proc,70);
205 end chk_search_criteria_id;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |---------------------------< insert_validate >----------------------------|
209 -- ----------------------------------------------------------------------------
210 Procedure insert_validate
211   (p_rec                          in irc_lcv_shd.g_rec_type
212   ) is
213 --
214   l_proc  varchar2(72) := g_package||'insert_validate';
215 --
216 Begin
217   hr_utility.set_location('Entering:'||l_proc, 5);
218   --
219   -- Call all supporting business operations
220   --
221   --
222   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
223   --
224   -- Validate Dependent Attributes
225   --
226   chk_search_criteria_id
227     (p_search_criteria_id => p_rec.search_criteria_id
228     );
229   --
230   hr_utility.set_location(l_proc, 20);
231   hr_api.mandatory_arg_error
232     (p_api_name           => l_proc
233     ,p_argument           => 'DERIVED_LOCALE'
234     ,p_argument_value     => p_rec.derived_locale
235     );
236   --
237   hr_utility.set_location(' Leaving:'||l_proc, 10);
238 End insert_validate;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |---------------------------< update_validate >----------------------------|
242 -- ----------------------------------------------------------------------------
243 Procedure update_validate
244   (p_rec                          in irc_lcv_shd.g_rec_type
245   ) is
246 --
247   l_proc  varchar2(72) := g_package||'update_validate';
248 --
249 Begin
250   hr_utility.set_location('Entering:'||l_proc, 5);
251   --
252   -- Call all supporting business operations
253   --
254   --
255   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
256   --
257   -- Validate Dependent Attributes
258   --
259   chk_non_updateable_args
260     (p_rec              => p_rec
261     );
262   --
263   hr_utility.set_location(' Leaving:'||l_proc, 10);
264 End update_validate;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |---------------------------< delete_validate >----------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure delete_validate
270   (p_rec                          in irc_lcv_shd.g_rec_type
271   ) is
272 --
273   l_proc  varchar2(72) := g_package||'delete_validate';
274 --
275 Begin
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   --
278   -- Call all supporting business operations
279   --
280   hr_utility.set_location(' Leaving:'||l_proc, 10);
281 End delete_validate;
282 --
283 end irc_lcv_bus;