DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ITL_BUS

Source


1 Package Body hr_itl_bus as
2 /* $Header: hritlrhi.pkb 115.1 2004/04/05 07:21 menderby noship $ */
3 /* $Header: hritlrhi.pkb 115.1 2004/04/05 07:21 menderby noship $ */
4 --
5 -- ----------------------------------------------------------------------------
6 -- |                     Private Global Definitions                           |
7 -- ----------------------------------------------------------------------------
8 --
9 g_package  varchar2(33) := '  hr_itl_bus.';  -- Global package name
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code            varchar2(150)  default null;
15 g_integration_id              number         default null;
16 g_language                    varchar2(4)    default null;
17 --
18 --
19 -- ----------------------------------------------------------------------------
20 -- |-----------------------< chk_non_updateable_args >------------------------|
21 -- ----------------------------------------------------------------------------
22 -- {Start Of Comments}
23 --
24 -- Description:
25 --   This procedure is used to ensure that non updateable attributes have
26 --   not been updated. If an attribute has been updated an error is generated.
27 --
28 -- Pre Conditions:
29 --   g_old_rec has been populated with details of the values currently in
30 --   the database.
31 --
32 -- In Arguments:
33 --   p_rec has been populated with the updated values the user would like the
34 --   record set to.
35 --
36 -- Post Success:
37 --   Processing continues if all the non updateable attributes have not
38 --   changed.
39 --
40 -- Post Failure:
41 --   An application error is raised if any of the non updatable attributes
42 --   have been altered.
43 --
44 -- {End Of Comments}
45 -- ----------------------------------------------------------------------------
46 Procedure chk_non_updateable_args
47   (p_rec in hr_itl_shd.g_rec_type
48   ) IS
49 --
50   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
51 --
52 Begin
53   --
54   -- Only proceed with the validation if a row exists for the current
55   -- record in the HR Schema.
56   --
57   IF NOT hr_itl_shd.api_updating
58       (p_integration_id                    => p_rec.integration_id
59       ,p_language                     => p_rec.language
60 
61       ) THEN
62      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
63      fnd_message.set_token('PROCEDURE ', l_proc);
64      fnd_message.set_token('STEP ', '5');
65      fnd_message.raise_error;
66   END IF;
67   --
68   -- EDIT_HERE: Add checks to ensure non-updateable args have
69   --            not been updated.
70   --
71 End chk_non_updateable_args;
72 -- ----------------------------------------------------------------------------
73 -- |-----------------------< chk_integration_id>------------------------|
74 -- ----------------------------------------------------------------------------
75 -- {Start Of Comments}
76 --
77 -- Description:
78 --   This procedure ensures that parent integration_id exists in
79 --   hr_ki_integrations table.
80 -- Pre Conditions:
81 --   g_old_rec has been populated with details of the values currently in
82 --   the database.
83 --
84 -- In Arguments:
85 --   p_integration_id
86 --
87 -- Post Success:
88 --   Processing continues if integration_id exist in hr_ki_integrations table
89 --
90 -- Post Failure:
91 --   An application error is raised if id does not exist in hr_ki_integrations
92 --
93 -- {End Of Comments}
94 -- ----------------------------------------------------------------------------
95 
96 
97 procedure chk_integration_id
98 (
99   p_integration_id in number
100 )
101 is
102   -- Declare cursors and local variables
103   --
104   -- Cursor to check if there is an entry in hr_ki_integrations
105   l_proc     varchar2(72) := g_package || 'chk_integration_id';
106   l_name     varchar2(1);
107 
108 
109 CURSOR csr_id is
110   select
111    null
112   From
113     hr_ki_integrations
114   where
115     integration_id = p_integration_id;
116 
117   Begin
118 
119 
120    hr_utility.set_location(' Entering:' || l_proc,10);
121 
122    open csr_id;
123    fetch csr_id into l_name;
124 
125    if csr_id%NOTFOUND then
126     fnd_message.set_name('PER', 'PER_449983_ITL_INT_ID_ABSENT');
127     fnd_message.raise_error;
128    end if;
129 
130    close csr_id;
131 
132    hr_utility.set_location(' Leaving:' || l_proc,20);
133 
134 Exception
135  when app_exception.application_exception then
136     IF hr_multi_message.exception_add
137                  (p_associated_column1   => 'HR_KI_INTEGRATIONS_TL.INTEGRATION_ID'
138                  ) THEN
139        hr_utility.set_location(' Leaving:'|| l_proc,30);
140        raise;
141     END IF;
142 
143     hr_utility.set_location(' Leaving:'|| l_proc,40);
144   --
145   End chk_integration_id;
146 
147 
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------< CHK_SERVICE_NAME>--------------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 --   This procedure ensures entered partner name is not null and unique.
155 -- Pre Conditions:
156 --   g_old_rec has been populated with details of the values currently in
157 --   the database.
158 --
159 -- In Arguments:
160 --   p_name
161 --   p_language
162 -- Post Success:
163 --   Processing continues if service name is not null and unique
164 --
165 -- Post Failure:
166 --   An application error is raised if service name is null or exists already
167 --
168 -- {End Of Comments}
169 -- ----------------------------------------------------------------------------
170 Procedure CHK_SERVICE_NAME
171   (
172    p_integration_id in number
173   ,p_partner_name in varchar
174   ,p_service_name     in varchar2
175   ,p_language              in varchar2
176   ) IS
177 --
178   l_proc     varchar2(72) := g_package || 'CHK_SERVICE_NAME';
179   l_name     varchar2(1);
180   cursor csr_name is
181          select null
182            from hr_ki_integrations_tl
183           where
184            integration_id <> p_integration_id
185           and service_name = p_service_name
186           and partner_name=p_partner_name
187           and language = p_language;
188 
189   l_check varchar2(1);
190 
191 --
192 Begin
193   hr_utility.set_location('Entering:'||l_proc,10);
194   --
195   -- Check value has been passed
196   --
197 
198   hr_api.mandatory_arg_error
199   (p_api_name           => l_proc
200   ,p_argument           => 'PARTNER_NAME'
201   ,p_argument_value     => p_partner_name
202   );
203 
204   hr_utility.set_location('Checking:'||l_proc,20);
205 
206   hr_api.mandatory_arg_error
207   (p_api_name           => l_proc
208   ,p_argument           => 'SERVICE_NAME'
209   ,p_argument_value     => p_service_name
210   );
211   hr_utility.set_location('Checking:'||l_proc,30);
212 
213 ---First check if record already present in the table
214 ---  for same id ,partner name and service name and language
215 ---If record exist then user is not updating the record
216 ---so NO validation is required
217 
218    open csr_name;
219    fetch csr_name into l_name;
220    hr_utility.set_location('After fetching:'||l_proc,40);
221    if (csr_name%found)
222    then
223      close csr_name;
224      fnd_message.set_name('PER','PER_449984_ITL_SNAME_DUPLICATE');
225      fnd_message.raise_error;
226    end if;
227    close csr_name;
228 
229   hr_utility.set_location(' Leaving:'||l_proc,50);
230   exception
231   when app_exception.application_exception then
232     if hr_multi_message.exception_add
233     (p_associated_column1 => 'HR_KI_INTEGRATIONS_TL.SERVICE_NAME'
234     )then
235       hr_utility.set_location(' Leaving:'||l_proc, 60);
236       raise;
237     end if;
238     hr_utility.set_location(' Leaving:'||l_proc,70);
239 End CHK_SERVICE_NAME;
240 
241 --
242 -- ----------------------------------------------------------------------------
243 -- |---------------------------< insert_validate >----------------------------|
244 -- ----------------------------------------------------------------------------
245 Procedure insert_validate
246   (p_rec                          in hr_itl_shd.g_rec_type
247   ,p_integration_id               in number
248   ) is
249 --
250   l_proc  varchar2(72) := g_package||'insert_validate';
251 --
252 Begin
253   hr_utility.set_location('Entering:'||l_proc, 5);
254   --
255   -- Call all supporting business operations
256   --
257   --
258   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
259   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
260   --
261   -- Validate Dependent Attributes
262   --
263   --
264   CHK_INTEGRATION_ID
265   (
266   p_integration_id  => p_integration_id
267   );
268 
269   CHK_SERVICE_NAME
270       (
271       p_integration_id=>p_integration_id
272       ,p_partner_name  => p_rec.partner_name
273       ,p_service_name  => p_rec.service_name
274       ,p_language  => p_rec.language
275       );
276   hr_utility.set_location(' Leaving:'||l_proc, 10);
277 End insert_validate;
278 --
279 -- ----------------------------------------------------------------------------
280 -- |---------------------------< update_validate >----------------------------|
281 -- ----------------------------------------------------------------------------
282 Procedure update_validate
283   (p_rec                          in hr_itl_shd.g_rec_type
284   ) is
285 --
286   l_proc  varchar2(72) := g_package||'update_validate';
287 --
288 Begin
289   hr_utility.set_location('Entering:'||l_proc, 5);
290   --
291   -- Call all supporting business operations
292   --
293   --
294   -- "-- No business group context.  HR_STANDARD_LOOKUPS used for validation."
295   -- "-- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS."
296   --
297   -- Validate Dependent Attributes
298   --
299   chk_non_updateable_args
300     (p_rec              => p_rec
301     );
302 
303 
304   CHK_SERVICE_NAME
305       (
306       p_integration_id=>p_rec.integration_id
307       ,p_partner_name  => p_rec.partner_name
308        ,p_service_name  => p_rec.service_name
309        ,p_language  => p_rec.language
310       );
311   --
312   --
313   hr_utility.set_location(' Leaving:'||l_proc, 10);
314 End update_validate;
315 --
316 -- ----------------------------------------------------------------------------
317 -- |---------------------------< delete_validate >----------------------------|
318 -- ----------------------------------------------------------------------------
319 Procedure delete_validate
320   (p_rec                          in hr_itl_shd.g_rec_type
321   ) is
322 --
323   l_proc  varchar2(72) := g_package||'delete_validate';
324 --
325 Begin
326   hr_utility.set_location('Entering:'||l_proc, 5);
327   --
328   -- Call all supporting business operations
329   --
330   hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End delete_validate;
332 --
333 end hr_itl_bus;