[Home] [Help]
PACKAGE BODY: APPS.HR_IPT_BUS
Source
1 Package Body hr_ipt_bus as
2 /* $Header: hriptrhi.pkb 115.9 2003/05/06 17:43:05 adhunter noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_ipt_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_item_property_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_item_property_id in number
23 ) is
24 --
25 l_proc varchar2(72) := g_package||'set_security_group_id';
26 --
27 begin
28 --
29 hr_utility.set_location('Entering:'|| l_proc, 10);
30 --
31 hr_itp_bus.set_security_group_id
32 (p_item_property_id => p_item_property_id
33 );
34 --
35 hr_utility.set_location(' Leaving:'|| l_proc, 20);
36 --
37 end set_security_group_id;
38 --
39 -- ---------------------------------------------------------------------------
40 -- |---------------------< return_legislation_code >-------------------------|
41 -- ---------------------------------------------------------------------------
42 --
43 Function return_legislation_code
44 (p_item_property_id in number
45 ,p_language in varchar2
46 )
47 Return Varchar2 Is
48 --
49 l_legislation_code varchar2(150);
50 l_proc varchar2(72) := g_package||'return_legislation_code';
51 --
52 Begin
53 --
54 hr_utility.set_location('Entering:'|| l_proc, 10);
55 --
56 l_legislation_code := hr_itp_bus.return_legislation_code
57 (p_item_property_id => p_item_property_id
58 );
59 --
60 hr_utility.set_location(' Leaving:'|| l_proc, 40);
61 return l_legislation_code;
62 end return_legislation_code;
63 --
64 -- ----------------------------------------------------------------------------
65 -- |-----------------------< chk_non_updateable_args >------------------------|
66 -- ----------------------------------------------------------------------------
67 -- {Start Of Comments}
68 --
69 -- Description:
70 -- This procedure is used to ensure that non updateable attributes have
71 -- not been updated. If an attribute has been updated an error is generated.
72 --
73 -- Pre Conditions:
74 -- g_old_rec has been populated with details of the values currently in
75 -- the database.
76 --
77 -- In Arguments:
78 -- p_rec has been populated with the updated values the user would like the
79 -- record set to.
80 --
81 -- Post Success:
82 -- Processing continues if all the non updateable attributes have not
83 -- changed.
84 --
85 -- Post Failure:
86 -- An application error is raised if any of the non updatable attributes
87 -- have been altered.
88 --
89 -- {End Of Comments}
90 -- ----------------------------------------------------------------------------
91 Procedure chk_non_updateable_args
92 (p_rec in hr_ipt_shd.g_rec_type
93 ) IS
94 --
95 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
96 l_error EXCEPTION;
97 l_argument varchar2(30);
98 --
99 Begin
100 --
101 -- Only proceed with the validation if a row exists for the current
102 -- record in the HR Schema.
103 --
104 IF NOT hr_ipt_shd.api_updating
105 (p_item_property_id => p_rec.item_property_id
106 ,p_language => p_rec.language
107 ) THEN
108 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
109 fnd_message.set_token('PROCEDURE ', l_proc);
110 fnd_message.set_token('STEP ', '5');
111 fnd_message.raise_error;
112 END IF;
113 --
114 -- No non-updateable arguments
115 --
116 EXCEPTION
117 WHEN l_error THEN
118 hr_api.argument_changed_error
119 (p_api_name => l_proc
120 ,p_argument => l_argument);
121 WHEN OTHERS THEN
122 RAISE;
123 End chk_non_updateable_args;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------< chk_source_lang >----------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure chk_source_lang
129 (p_item_property_id in number
130 ,p_language in varchar2
131 ,p_source_lang in varchar2
132 ) is
133 --
134 cursor csr_language is
135 select l.installed_flag
136 from fnd_languages l
137 where l.language_code = p_source_lang;
138 --
139 l_proc varchar2(72) := g_package || 'chk_source_lang';
140 l_api_updating boolean;
141 l_installed_flag varchar2(30);
142 --
143 Begin
144 hr_utility.set_location('Entering:'||l_proc, 10);
145 --
146 l_api_updating := hr_ipt_shd.api_updating
147 (p_item_property_id => p_item_property_id
148 ,p_language => p_language
149 );
150 hr_utility.set_location(l_proc,20);
151 --
152 -- Only proceed with SQL validation if absolutely necessary
153 --
154 if ( ( l_api_updating
155 and nvl(hr_ipt_shd.g_old_rec.source_lang,hr_api.g_varchar2) <>
156 nvl(p_source_lang,hr_api.g_varchar2))
157 or (NOT l_api_updating)) then
158 --
159 hr_utility.set_location(l_proc,30);
160 --
161 -- Check value has been passed
162 --
163 hr_api.mandatory_arg_error
164 (p_api_name => l_proc
165 ,p_argument => 'source_lang'
166 ,p_argument_value => p_source_lang
167 );
168 --
169 hr_utility.set_location(l_proc,40);
170 --
171 -- Check source language exists and is base or installed language
172 --
173 open csr_language;
174 fetch csr_language into l_installed_flag;
175 if csr_language%notfound then
176 close csr_language;
177 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
178 fnd_message.set_token('PROCEDURE', l_proc);
179 fnd_message.set_token('STEP','10');
180 fnd_message.raise_error;
181 end if;
182 close csr_language;
183 --
184 /* 1653358: Not necessary
185 if nvl(l_installed_flag,hr_api.g_varchar2) not in ('I','B') then
186 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
187 fnd_message.set_token('PROCEDURE', l_proc);
188 fnd_message.set_token('STEP','20');
189 fnd_message.raise_error;
190 end if;
191 */
192 --
193 end if;
194 --
195 hr_utility.set_location('Leaving:'||l_proc, 100);
196 End chk_source_lang;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |------------------------------< chk_default_value >-----------------------|
200 -- ----------------------------------------------------------------------------
201 Procedure chk_default_value
202 (p_item_property_id in number
203 ,p_language in varchar2
204 ,p_default_value in varchar2
205 ) is
206 --
207 l_proc varchar2(72) := g_package || 'chk_default_value';
208 l_api_updating boolean;
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 10);
212 --
213 hr_utility.set_location('Leaving:'||l_proc, 100);
214 End chk_default_value;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |------------------------< chk_information_prompt >------------------------|
218 -- ----------------------------------------------------------------------------
219 Procedure chk_information_prompt
220 (p_item_property_id in number
221 ,p_language in varchar2
222 ,p_information_prompt in varchar2
223 ) is
224 --
225 cursor csr_item_property is
226 select itp.information_formula_id
227 from hr_item_properties_b itp
228 where itp.item_property_id = p_item_property_id;
229 --
230 l_proc varchar2(72) := g_package || 'chk_information_prompt';
231 l_api_updating boolean;
232 l_information_formula_id number;
233 --
234 Begin
235 hr_utility.set_location('Entering:'||l_proc, 10);
236 --
237 -- Only proceed with SQL validation if absolutely necessary
238 --
239 if ( ( l_api_updating
240 and nvl(hr_ipt_shd.g_old_rec.information_prompt,hr_api.g_varchar2) <>
241 nvl(p_information_prompt,hr_api.g_varchar2))
242 or (NOT l_api_updating)) then
243 --
244 hr_utility.set_location(l_proc,30);
245 --
246 open csr_item_property;
247 fetch csr_item_property into l_information_formula_id;
248 if csr_item_property%notfound then
249 close csr_item_property;
250 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
251 fnd_message.set_token('PROCEDURE', l_proc);
252 fnd_message.set_token('STEP','10');
253 fnd_message.raise_error;
254 end if;
255 close csr_item_property;
256 --
257 -- Check information prompt has been specified if information formula has,
258 -- and has not been specified if information formula has not
259 --
260 if l_information_formula_id is null then
261 if p_information_prompt is not null then
262 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
263 fnd_message.set_token('PROCEDURE', l_proc);
264 fnd_message.set_token('STEP','20');
265 fnd_message.raise_error;
266 end if;
267 elsif l_information_formula_id is not null then
268 if p_information_prompt is null then
269 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
270 fnd_message.set_token('PROCEDURE', l_proc);
271 fnd_message.set_token('STEP','30');
272 fnd_message.raise_error;
273 end if;
274 end if;
275 end if;
276 --
277 hr_utility.set_location('Leaving:'||l_proc, 100);
278 End chk_information_prompt;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |-------------------------------< chk_label >------------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure chk_label
284 (p_item_property_id in number
285 ,p_language in varchar2
286 ,p_label in varchar2
287 ,p_item_property_id_actual in varchar2
288 ) is
289 --
290 cursor csr_item_property is
291 select itp.form_item_id
292 ,itp.template_item_id
293 ,itp.template_item_context_id
294 from hr_item_properties_b itp
295 where itp.item_property_id = p_item_property_id_actual;
296 --
297 l_proc varchar2(72) := g_package || 'chk_label';
298 l_api_updating boolean;
299 l_form_item_id number;
300 l_template_item_id number;
301 l_template_item_context_id number;
302 l_item_type varchar2(30);
303 --
304 Begin
305 hr_utility.set_location('Entering:'||l_proc, 10);
306 --
307 l_api_updating := hr_ipt_shd.api_updating
308 (p_item_property_id => p_item_property_id
309 ,p_language => p_language
310 );
311 hr_utility.set_location(l_proc,20);
312 --
313 -- Only proceed with SQL validation if absolutely necessary
314 --
315 if ( ( l_api_updating
316 and nvl(hr_ipt_shd.g_old_rec.label,hr_api.g_varchar2) <>
317 nvl(p_label,hr_api.g_varchar2))
318 or (NOT l_api_updating)) then
319 --
320 hr_utility.set_location(l_proc,30);
321 --
322 -- Check item is of appropriate type if label is specified
323 --
324 if p_label is not null then
325 --
326 open csr_item_property;
327 fetch csr_item_property into l_form_item_id, l_template_item_id, l_template_item_context_id;
328 if csr_item_property%notfound then
329 close csr_item_property;
330 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
334 end if;
331 fnd_message.set_token('PROCEDURE', l_proc||' '||to_char(p_item_property_id));
332 fnd_message.set_token('STEP','10');
333 fnd_message.raise_error;
335 close csr_item_property;
336 --
337 l_item_type := hr_itp_bus.return_item_type
338 (p_form_item_id => l_form_item_id
339 ,p_template_item_id => l_template_item_id
340 ,p_template_item_context_id => l_template_item_context_id
341 );
342 if nvl(l_item_type,hr_api.g_varchar2) not in ('BUTTON','CHECKBOX','RADIO_BUTTON') then
343 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
344 fnd_message.set_token('PROCEDURE', l_proc);
345 fnd_message.set_token('STEP','20');
346 fnd_message.raise_error;
347 end if;
348 --
349 end if;
350 --
351 end if;
352 --
353 hr_utility.set_location('Leaving:'||l_proc, 100);
354 End chk_label;
355 --
356 -- ----------------------------------------------------------------------------
357 -- |----------------------------< chk_prompt_text >---------------------------|
358 -- ----------------------------------------------------------------------------
359 Procedure chk_prompt_text
360 (p_item_property_id in number
361 ,p_language in varchar2
362 ,p_prompt_text in varchar2
363 ,p_item_property_id_actual in varchar2
364 ) is
365 --
366 cursor csr_item_property is
367 select itp.form_item_id
368 ,itp.template_item_id
369 ,itp.template_item_context_id
370 from hr_item_properties_b itp
371 where itp.item_property_id = p_item_property_id_actual;
372 --
373 l_proc varchar2(72) := g_package || 'chk_prompt_text';
374 l_api_updating boolean;
375 l_form_item_id number;
376 l_template_item_id number;
377 l_template_item_context_id number;
378 l_item_type varchar2(30);
379 --
380 Begin
381 hr_utility.set_location('Entering:'||l_proc, 10);
382 --
383 l_api_updating := hr_ipt_shd.api_updating
384 (p_item_property_id => p_item_property_id
385 ,p_language => p_language
386 );
387 hr_utility.set_location(l_proc,20);
388 --
389 -- Only proceed with SQL validation if absolutely necessary
390 --
391 if ( ( l_api_updating
392 and nvl(hr_ipt_shd.g_old_rec.prompt_text,hr_api.g_varchar2) <>
393 nvl(p_prompt_text,hr_api.g_varchar2))
394 or (NOT l_api_updating)) then
395 --
396 hr_utility.set_location(l_proc,30);
397 --
398 if p_prompt_text is not null then
399 --
400 hr_utility.set_location(l_proc,40);
401 --
402 open csr_item_property;
403 fetch csr_item_property into l_form_item_id, l_template_item_id, l_template_item_context_id;
404 if csr_item_property%notfound then
405 close csr_item_property;
406 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
407 fnd_message.set_token('PROCEDURE', l_proc||' '||to_char(p_item_property_id));
408 fnd_message.set_token('STEP','10');
409 fnd_message.raise_error;
410 end if;
411 close csr_item_property;
412 --
413 l_item_type := hr_itp_bus.return_item_type
414 (p_form_item_id => l_form_item_id
415 ,p_template_item_id => l_template_item_id
416 ,p_template_item_context_id => l_template_item_context_id
417 );
418 if nvl(l_item_type,hr_api.g_varchar2) not in ('BUTTON','CHART_ITEM','CHECKBOX','DISPLAY_ITEM','IMAGE','LIST','OLE_OBJECT','RADIO_BUTTON','TEXT_ITEM','USER_AREA','VBX_CONTROL') then
419 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
420 fnd_message.set_token('PROCEDURE', l_proc);
421 fnd_message.set_token('STEP','20');
422 fnd_message.raise_error;
423 end if;
424 --
425 end if;
426 --
427 end if;
428 --
429 hr_utility.set_location('Leaving:'||l_proc, 100);
430 End chk_prompt_text;
431 --
432 -- ----------------------------------------------------------------------------
433 -- |---------------------------< chk_tooltip_text >---------------------------|
434 -- ----------------------------------------------------------------------------
435 Procedure chk_tooltip_text
436 (p_item_property_id in number
437 ,p_language in varchar2
438 ,p_tooltip_text in varchar2
439 ,p_item_property_id_actual in varchar2
440 ) is
441 --
442 cursor csr_item_property is
443 select itp.form_item_id
444 ,itp.template_item_id
445 ,itp.template_item_context_id
446 from hr_item_properties_b itp
447 where itp.item_property_id = p_item_property_id_actual;
448 --
449 l_proc varchar2(72) := g_package || 'chk_tooltip_text';
450 l_api_updating boolean;
451 l_form_item_id number;
452 l_template_item_id number;
453 l_template_item_context_id number;
454 l_item_type varchar2(30);
455 --
456 Begin
457 hr_utility.set_location('Entering:'||l_proc, 10);
458 --
462 );
459 l_api_updating := hr_ipt_shd.api_updating
460 (p_item_property_id => p_item_property_id
461 ,p_language => p_language
463 hr_utility.set_location(l_proc,20);
464 --
465 -- Only proceed with SQL validation if absolutely necessary
466 --
467 if ( ( l_api_updating
468 and nvl(hr_ipt_shd.g_old_rec.tooltip_text,hr_api.g_varchar2) <>
469 nvl(p_tooltip_text,hr_api.g_varchar2))
470 or (NOT l_api_updating)) then
471 --
472 hr_utility.set_location(l_proc,30);
473 --
474 if p_tooltip_text is not null then
475 --
476 hr_utility.set_location(l_proc,40);
477 --
478 open csr_item_property;
479 fetch csr_item_property into l_form_item_id, l_template_item_id, l_template_item_context_id;
480 if csr_item_property%notfound then
481 close csr_item_property;
482 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
483 fnd_message.set_token('PROCEDURE', l_proc||' '||to_char(p_item_property_id));
484 fnd_message.set_token('STEP','10');
485 fnd_message.raise_error;
486 end if;
487 close csr_item_property;
488 --
489 l_item_type := hr_itp_bus.return_item_type
490 (p_form_item_id => l_form_item_id
491 ,p_template_item_id => l_template_item_id
492 ,p_template_item_context_id => l_template_item_context_id
493 );
494 if nvl(l_item_type,hr_api.g_varchar2) not in ('BUTTON','CHART_ITEM','CHECKBOX','DISPLAY_ITEM','IMAGE','LIST','OLE_OBJECT','RADIO_BUTTON','TEXT_ITEM','USER_AREA','VBX_CONTROL') then
495 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
496 fnd_message.set_token('PROCEDURE', l_proc);
497 fnd_message.set_token('STEP','20');
498 fnd_message.raise_error;
499 end if;
500 --
501 end if;
502 --
503 end if;
504 --
505 hr_utility.set_location('Leaving:'||l_proc, 100);
506 End chk_tooltip_text;
507 --
508 -- ----------------------------------------------------------------------------
509 -- |------------------------------< chk_delete >------------------------------|
510 -- ----------------------------------------------------------------------------
511 Procedure chk_delete
512 (p_rec in hr_ipt_shd.g_rec_type
513 ) is
514 --
515 l_proc varchar2(72) := g_package||'chk_delete';
516 --
517 Begin
518 hr_utility.set_location('Entering:'||l_proc, 5);
519 --
520 -- No additional validation required
521 --
522 null;
523 --
524 hr_utility.set_location(' Leaving:'||l_proc, 10);
525 End chk_delete;
526 --
527 -- ----------------------------------------------------------------------------
528 -- |---------------------------< insert_validate >----------------------------|
529 -- ----------------------------------------------------------------------------
530 Procedure insert_validate
531 (p_rec in hr_ipt_shd.g_rec_type
532 ,p_item_property_id in number
533 ) is
534 --
535 l_proc varchar2(72) := g_package||'insert_validate';
536 --
537 Begin
538 hr_utility.set_location('Entering:'||l_proc, 5);
539 --
540 -- Call all supporting business operations
541 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
542 --
543 chk_source_lang
544 (p_item_property_id => p_rec.item_property_id
545 ,p_language => p_rec.language
546 ,p_source_lang => p_rec.source_lang
547 );
548 --
549 chk_default_value
550 (p_item_property_id => p_rec.item_property_id
551 ,p_language => p_rec.language
552 ,p_default_value => p_rec.default_value
553 );
554 --
555 chk_information_prompt
556 (p_item_property_id => p_rec.item_property_id
557 ,p_language => p_rec.language
558 ,p_information_prompt => p_rec.information_prompt
559 );
560 --
561 chk_label
562 (p_item_property_id => p_rec.item_property_id
563 ,p_language => p_rec.language
564 ,p_label => p_rec.label
565 ,p_item_property_id_actual => p_item_property_id
566 );
567 --
568 chk_prompt_text
569 (p_item_property_id => p_rec.item_property_id
570 ,p_language => p_rec.language
571 ,p_prompt_text => p_rec.prompt_text
572 ,p_item_property_id_actual => p_item_property_id
573 );
574 --
575 chk_tooltip_text
576 (p_item_property_id => p_rec.item_property_id
577 ,p_language => p_rec.language
578 ,p_tooltip_text => p_rec.tooltip_text
579 ,p_item_property_id_actual => p_item_property_id
580 );
581 --
582 hr_utility.set_location(' Leaving:'||l_proc, 10);
583 End insert_validate;
584 --
585 -- ----------------------------------------------------------------------------
586 -- |---------------------------< update_validate >----------------------------|
587 -- ----------------------------------------------------------------------------
591 --
588 Procedure update_validate
589 (p_rec in hr_ipt_shd.g_rec_type
590 ) is
592 l_proc varchar2(72) := g_package||'update_validate';
593 --
594 Begin
595 hr_utility.set_location('Entering:'||l_proc, 5);
596 --
597 -- Call all supporting business operations
598 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
599 --
600 chk_non_updateable_args
601 (p_rec => p_rec
602 );
603 --
604 chk_source_lang
605 (p_item_property_id => p_rec.item_property_id
606 ,p_language => p_rec.language
607 ,p_source_lang => p_rec.source_lang
608 );
609 --
610 chk_default_value
611 (p_item_property_id => p_rec.item_property_id
612 ,p_language => p_rec.language
613 ,p_default_value => p_rec.default_value
614 );
615 --
616 chk_information_prompt
617 (p_item_property_id => p_rec.item_property_id
618 ,p_language => p_rec.language
619 ,p_information_prompt => p_rec.information_prompt
620 );
621 --
622 chk_label
623 (p_item_property_id => p_rec.item_property_id
624 ,p_language => p_rec.language
625 ,p_label => p_rec.label
626 ,p_item_property_id_actual => p_rec.item_property_id
627 );
628 --
629 chk_prompt_text
630 (p_item_property_id => p_rec.item_property_id
631 ,p_language => p_rec.language
632 ,p_prompt_text => p_rec.prompt_text
633 ,p_item_property_id_actual => p_rec.item_property_id
634 );
635 --
636 chk_tooltip_text
637 (p_item_property_id => p_rec.item_property_id
638 ,p_language => p_rec.language
639 ,p_tooltip_text => p_rec.tooltip_text
640 ,p_item_property_id_actual => p_rec.item_property_id
641 );
642 --
643 hr_utility.set_location(' Leaving:'||l_proc, 10);
644 End update_validate;
645 --
646 -- ----------------------------------------------------------------------------
647 -- |---------------------------< delete_validate >----------------------------|
648 -- ----------------------------------------------------------------------------
649 Procedure delete_validate
650 (p_rec in hr_ipt_shd.g_rec_type
651 ) is
652 --
653 l_proc varchar2(72) := g_package||'delete_validate';
654 --
655 Begin
656 hr_utility.set_location('Entering:'||l_proc, 5);
657 --
658 -- Call all supporting business operations
659 --
660 chk_delete
661 (p_rec => p_rec
662 );
663 --
664 hr_utility.set_location(' Leaving:'||l_proc, 10);
665 End delete_validate;
666 --
667 end hr_ipt_bus;