[Home] [Help]
PACKAGE BODY: APPS.HR_CNP_BUS
Source
1 Package Body hr_cnp_bus as
2 /* $Header: hrcnprhi.pkb 120.1 2011/04/28 12:03:13 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_cnp_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_canvas_property_id number default null;
15 --
16 -- The following two global variables are only to be
17 -- used by the return_canvas_type function.
18 --
19 g_canvas_type varchar2(30) default null;
20 g_form_canvas_id number default null;
21 g_template_canvas_id number default null;
22 --
23 --
24 -- ---------------------------------------------------------------------------
25 -- |----------------------< set_security_group_id >--------------------------|
26 -- ---------------------------------------------------------------------------
27 --
28 Procedure set_security_group_id
29 (p_canvas_property_id in number
30 ) is
31 --
32 l_proc varchar2(72) := g_package||'set_security_group_id';
33 --
34 begin
35 --
36 hr_utility.set_location('Entering:'|| l_proc, 10);
37 --
38 -- No business group context. Security group is not applicable.
39 --
40 null;
41 --
42 hr_utility.set_location(' Leaving:'|| l_proc, 20);
43 --
44 end set_security_group_id;
45 --
46 -- ---------------------------------------------------------------------------
47 -- |---------------------< return_legislation_code >-------------------------|
48 -- ---------------------------------------------------------------------------
49 --
50 Function return_legislation_code
51 (p_canvas_property_id in number
52 )
53 Return Varchar2 Is
54 --
55 -- Declare cursor
56 --
57 cursor csr_leg_code is
58 select tmp.legislation_code
59 from hr_form_templates_b tmp
60 ,hr_template_windows_b twn
61 ,hr_template_canvases_b tcn
62 ,hr_canvas_properties cnp
63 where tmp.form_template_id = twn.form_template_id
64 and twn.template_window_id = tcn.template_window_id
65 and tcn.template_canvas_id = cnp.template_canvas_id
66 and cnp.canvas_property_id = p_canvas_property_id;
67 --
68 -- Declare local variables
69 --
70 l_legislation_code varchar2(150);
71 l_proc varchar2(72) := g_package||'return_legislation_code';
72 --
73 Begin
74 --
75 hr_utility.set_location('Entering:'|| l_proc, 10);
76 --
77 -- Ensure that all the mandatory parameter are not null
78 --
79 hr_api.mandatory_arg_error
80 (p_api_name => l_proc
81 ,p_argument => 'canvas_property_id'
82 ,p_argument_value => p_canvas_property_id
83 );
84 --
85 if ( nvl(hr_cnp_bus.g_canvas_property_id, hr_api.g_number)
86 = p_canvas_property_id) then
87 --
88 -- The legislation code has already been found with a previous
89 -- call to this function. Just return the value in the global
90 -- variable.
91 --
92 l_legislation_code := hr_cnp_bus.g_legislation_code;
93 hr_utility.set_location(l_proc, 20);
94 else
95 --
96 -- The ID is different to the last call to this function
97 -- or this is the first call to this function.
98 --
99 open csr_leg_code;
100 fetch csr_leg_code into l_legislation_code;
101 --
102 if csr_leg_code%notfound then
103 --
104 -- Legislation code not found, which may be correct for certain canvas
105 -- properties.
106 --
107 l_legislation_code := null;
108 end if;
109 hr_utility.set_location(l_proc,30);
110 --
111 -- Set the global variables so the values are
112 -- available for the next call to this function.
113 --
114 close csr_leg_code;
115 hr_cnp_bus.g_canvas_property_id := p_canvas_property_id;
116 hr_cnp_bus.g_legislation_code := l_legislation_code;
117 end if;
118 hr_utility.set_location(' Leaving:'|| l_proc, 40);
119 return l_legislation_code;
120 end return_legislation_code;
121 --
122 -- ---------------------------------------------------------------------------
123 -- |-------------------------< return_canvas_type >--------------------------|
127 -- Returns the canvas type for the specific unique key value
124 -- ---------------------------------------------------------------------------
125 --
126 -- Description:
128 --
129 -- Prerequisites:
130 -- None
131 --
132 -- In Arguments:
133 -- p_form_canvas_id
134 -- p_template_canvas_id
135 --
136 -- Post Success:
137 -- The canvas type will be returned
138 --
139 -- Post Failure:
140 -- An error is raised if the value does not exist
141 --
142 -- Access Status:
143 -- Internal Row Handler Use Only.
144 --
145 -- ----------------------------------------------------------------------------
146 Function return_canvas_type
147 (p_form_canvas_id in number default hr_api.g_number
148 ,p_template_canvas_id in number default hr_api.g_number
149 )
150 Return Varchar2 Is
151 --
152 -- Declare cursors
153 --
154 cursor csr_form_canvas is
155 select fcn.canvas_type
156 from hr_form_canvases_b fcn
157 where fcn.form_canvas_id = p_form_canvas_id;
158 --
159 cursor csr_template_canvas is
160 select fcn.canvas_type
161 from hr_form_canvases_b fcn
162 ,hr_template_canvases_b tcn
163 where fcn.form_canvas_id = tcn.form_canvas_id
164 and tcn.template_canvas_id = p_template_canvas_id;
165 --
166 -- Declare local variables
167 --
168 l_canvas_type varchar2(30);
169 l_proc varchar2(72) := g_package||'return_canvas_type';
170 --
171 Begin
172 --
173 hr_utility.set_location('Entering:'|| l_proc, 10);
174 --
175 if ( nvl(hr_cnp_bus.g_form_canvas_id, hr_api.g_number) = nvl(p_form_canvas_id, hr_api.g_number)
176 and nvl(hr_cnp_bus.g_template_canvas_id, hr_api.g_number) = nvl(p_template_canvas_id, hr_api.g_number)
177 ) then
178 --
179 -- The canvas has already been found with a previous
180 -- call to this function. Just return the value in the global
181 -- variable.
182 --
183 l_canvas_type := hr_cnp_bus.g_canvas_type;
184 hr_utility.set_location(l_proc, 20);
185 else
186 --
187 -- The IDs are different to the last call to this function
188 -- or this is the first call to this function.
189 --
190 if (nvl(p_form_canvas_id, hr_api.g_number) <> hr_api.g_number) then
191 --
192 open csr_form_canvas;
193 fetch csr_form_canvas into l_canvas_type;
194 --
195 if csr_form_canvas%notfound then
196 --
197 -- The form canvas id is invalid therefore we must error
198 --
199 close csr_form_canvas;
200 hr_cnp_shd.constraint_error('HR_CANVAS_PROPERTIES_FK1');
201 end if;
202 hr_utility.set_location(l_proc,30);
203 close csr_form_canvas;
204 --
205 elsif (nvl(p_template_canvas_id, hr_api.g_number) <> hr_api.g_number) then
206 --
207 open csr_template_canvas;
208 fetch csr_template_canvas into l_canvas_type;
209 --
210 if csr_template_canvas%notfound then
211 --
212 -- The template canvas id is invalid therefore we must error
213 --
214 close csr_template_canvas;
215 hr_cnp_shd.constraint_error('HR_CANVAS_PROPERTIES_FK2');
216 end if;
217 hr_utility.set_location(l_proc,40);
218 close csr_template_canvas;
219 --
220 end if;
221 --
222 -- Set the global variables so the values are
223 -- available for the next call to this function.
224 --
225 hr_cnp_bus.g_form_canvas_id := p_form_canvas_id;
226 hr_cnp_bus.g_template_canvas_id := p_template_canvas_id;
227 hr_cnp_bus.g_canvas_type := l_canvas_type;
228 end if;
229 hr_utility.set_location(' Leaving:'|| l_proc, 50);
230 return l_canvas_type;
231 end return_canvas_type;
232 --
233 -- ----------------------------------------------------------------------------
234 -- |-----------------------------< chk_ddf >----------------------------------|
235 -- ----------------------------------------------------------------------------
236 --
237 -- Description:
238 -- Validates all the Developer Descriptive Flexfield values.
239 --
240 -- Prerequisites:
241 -- All other columns have been validated. Must be called as the
242 -- last step from insert_validate and update_validate.
243 --
244 -- In Arguments:
245 -- p_rec
246 --
247 -- Post Success:
248 -- If the Developer Descriptive Flexfield structure column and data values
249 -- are all valid this procedure will end normally and processing will
250 -- continue.
251 --
252 -- Post Failure:
253 -- If the Developer Descriptive Flexfield structure column value or any of
254 -- the data values are invalid then an application error is raised as
255 -- a PL/SQL exception.
256 --
257 -- Access Status:
258 -- Internal Row Handler Use Only.
259 --
260 -- ----------------------------------------------------------------------------
261 procedure chk_ddf
262 (p_rec in hr_cnp_shd.g_rec_type
263 ) is
264 --
265 l_proc varchar2(72) := g_package || 'chk_ddf';
266 --
267 begin
268 hr_utility.set_location('Entering:'||l_proc,10);
269 --
270 if ((p_rec.canvas_property_id is not null) and (
271 nvl(hr_cnp_shd.g_old_rec.information_category, hr_api.g_varchar2) <>
272 nvl(p_rec.information_category, hr_api.g_varchar2) or
273 nvl(hr_cnp_shd.g_old_rec.information1, hr_api.g_varchar2) <>
274 nvl(p_rec.information1, hr_api.g_varchar2) or
275 nvl(hr_cnp_shd.g_old_rec.information2, hr_api.g_varchar2) <>
276 nvl(p_rec.information2, hr_api.g_varchar2) or
277 nvl(hr_cnp_shd.g_old_rec.information3, hr_api.g_varchar2) <>
278 nvl(p_rec.information3, hr_api.g_varchar2) or
279 nvl(hr_cnp_shd.g_old_rec.information4, hr_api.g_varchar2) <>
280 nvl(p_rec.information4, hr_api.g_varchar2) or
281 nvl(hr_cnp_shd.g_old_rec.information5, hr_api.g_varchar2) <>
282 nvl(p_rec.information5, hr_api.g_varchar2) or
283 nvl(hr_cnp_shd.g_old_rec.information6, hr_api.g_varchar2) <>
284 nvl(p_rec.information6, hr_api.g_varchar2) or
285 nvl(hr_cnp_shd.g_old_rec.information7, hr_api.g_varchar2) <>
286 nvl(p_rec.information7, hr_api.g_varchar2) or
287 nvl(hr_cnp_shd.g_old_rec.information8, hr_api.g_varchar2) <>
288 nvl(p_rec.information8, hr_api.g_varchar2) or
289 nvl(hr_cnp_shd.g_old_rec.information9, hr_api.g_varchar2) <>
290 nvl(p_rec.information9, hr_api.g_varchar2) or
291 nvl(hr_cnp_shd.g_old_rec.information10, hr_api.g_varchar2) <>
292 nvl(p_rec.information10, hr_api.g_varchar2) or
293 nvl(hr_cnp_shd.g_old_rec.information11, hr_api.g_varchar2) <>
294 nvl(p_rec.information11, hr_api.g_varchar2) or
295 nvl(hr_cnp_shd.g_old_rec.information12, hr_api.g_varchar2) <>
296 nvl(p_rec.information12, hr_api.g_varchar2) or
297 nvl(hr_cnp_shd.g_old_rec.information13, hr_api.g_varchar2) <>
298 nvl(p_rec.information13, hr_api.g_varchar2) or
299 nvl(hr_cnp_shd.g_old_rec.information14, hr_api.g_varchar2) <>
300 nvl(p_rec.information14, hr_api.g_varchar2) or
301 nvl(hr_cnp_shd.g_old_rec.information15, hr_api.g_varchar2) <>
302 nvl(p_rec.information15, hr_api.g_varchar2) or
303 nvl(hr_cnp_shd.g_old_rec.information16, hr_api.g_varchar2) <>
304 nvl(p_rec.information16, hr_api.g_varchar2) or
305 nvl(hr_cnp_shd.g_old_rec.information17, hr_api.g_varchar2) <>
306 nvl(p_rec.information17, hr_api.g_varchar2) or
307 nvl(hr_cnp_shd.g_old_rec.information18, hr_api.g_varchar2) <>
308 nvl(p_rec.information18, hr_api.g_varchar2) or
309 nvl(hr_cnp_shd.g_old_rec.information19, hr_api.g_varchar2) <>
310 nvl(p_rec.information19, hr_api.g_varchar2) or
311 nvl(hr_cnp_shd.g_old_rec.information20, hr_api.g_varchar2) <>
312 nvl(p_rec.information20, hr_api.g_varchar2) or
313 nvl(hr_cnp_shd.g_old_rec.information21, hr_api.g_varchar2) <>
314 nvl(p_rec.information21, hr_api.g_varchar2) or
315 nvl(hr_cnp_shd.g_old_rec.information22, hr_api.g_varchar2) <>
316 nvl(p_rec.information22, hr_api.g_varchar2) or
317 nvl(hr_cnp_shd.g_old_rec.information23, hr_api.g_varchar2) <>
318 nvl(p_rec.information23, hr_api.g_varchar2) or
319 nvl(hr_cnp_shd.g_old_rec.information24, hr_api.g_varchar2) <>
320 nvl(p_rec.information24, hr_api.g_varchar2) or
321 nvl(hr_cnp_shd.g_old_rec.information25, hr_api.g_varchar2) <>
322 nvl(p_rec.information25, hr_api.g_varchar2) or
323 nvl(hr_cnp_shd.g_old_rec.information26, hr_api.g_varchar2) <>
324 nvl(p_rec.information26, hr_api.g_varchar2) or
325 nvl(hr_cnp_shd.g_old_rec.information27, hr_api.g_varchar2) <>
326 nvl(p_rec.information27, hr_api.g_varchar2) or
327 nvl(hr_cnp_shd.g_old_rec.information28, hr_api.g_varchar2) <>
328 nvl(p_rec.information28, hr_api.g_varchar2) or
329 nvl(hr_cnp_shd.g_old_rec.information29, hr_api.g_varchar2) <>
330 nvl(p_rec.information29, hr_api.g_varchar2) or
331 nvl(hr_cnp_shd.g_old_rec.information30, hr_api.g_varchar2) <>
332 nvl(p_rec.information30, hr_api.g_varchar2) )
333 or (p_rec.canvas_property_id is null) ) then
334 --
335 -- Only execute the validation if absolutely necessary:
336 -- a) During update, the structure column value or any
337 -- of the attribute values have actually changed.
338 -- b) During insert.
339 --
340 hr_dflex_utility.ins_or_upd_descflex_attribs
341 (p_appl_short_name => 'PER'
342 ,p_descflex_name => 'HR_CANVAS_PROPERTIES'
343 ,p_attribute_category => p_rec.information_category
344 ,p_attribute1_name => 'INFORMATION1'
345 ,p_attribute1_value => p_rec.information1
346 ,p_attribute2_name => 'INFORMATION2'
347 ,p_attribute2_value => p_rec.information2
348 ,p_attribute3_name => 'INFORMATION3'
349 ,p_attribute3_value => p_rec.information3
350 ,p_attribute4_name => 'INFORMATION4'
351 ,p_attribute4_value => p_rec.information4
352 ,p_attribute5_name => 'INFORMATION5'
353 ,p_attribute5_value => p_rec.information5
354 ,p_attribute6_name => 'INFORMATION6'
355 ,p_attribute6_value => p_rec.information6
356 ,p_attribute7_name => 'INFORMATION7'
357 ,p_attribute7_value => p_rec.information7
358 ,p_attribute8_name => 'INFORMATION8'
359 ,p_attribute8_value => p_rec.information8
360 ,p_attribute9_name => 'INFORMATION9'
361 ,p_attribute9_value => p_rec.information9
362 ,p_attribute10_name => 'INFORMATION10'
363 ,p_attribute10_value => p_rec.information10
364 ,p_attribute11_name => 'INFORMATION11'
365 ,p_attribute11_value => p_rec.information11
366 ,p_attribute12_name => 'INFORMATION12'
367 ,p_attribute12_value => p_rec.information12
368 ,p_attribute13_name => 'INFORMATION13'
369 ,p_attribute13_value => p_rec.information13
370 ,p_attribute14_name => 'INFORMATION14'
371 ,p_attribute14_value => p_rec.information14
372 ,p_attribute15_name => 'INFORMATION15'
373 ,p_attribute15_value => p_rec.information15
374 ,p_attribute16_name => 'INFORMATION16'
375 ,p_attribute16_value => p_rec.information16
376 ,p_attribute17_name => 'INFORMATION17'
377 ,p_attribute17_value => p_rec.information17
378 ,p_attribute18_name => 'INFORMATION18'
379 ,p_attribute18_value => p_rec.information18
380 ,p_attribute19_name => 'INFORMATION19'
381 ,p_attribute19_value => p_rec.information19
382 ,p_attribute20_name => 'INFORMATION20'
383 ,p_attribute20_value => p_rec.information20
384 ,p_attribute21_name => 'INFORMATION21'
385 ,p_attribute21_value => p_rec.information21
386 ,p_attribute22_name => 'INFORMATION22'
387 ,p_attribute22_value => p_rec.information22
388 ,p_attribute23_name => 'INFORMATION23'
389 ,p_attribute23_value => p_rec.information23
390 ,p_attribute24_name => 'INFORMATION24'
391 ,p_attribute24_value => p_rec.information24
392 ,p_attribute25_name => 'INFORMATION25'
393 ,p_attribute25_value => p_rec.information25
394 ,p_attribute26_name => 'INFORMATION26'
395 ,p_attribute26_value => p_rec.information26
396 ,p_attribute27_name => 'INFORMATION27'
397 ,p_attribute27_value => p_rec.information27
398 ,p_attribute28_name => 'INFORMATION28'
399 ,p_attribute28_value => p_rec.information28
400 ,p_attribute29_name => 'INFORMATION29'
401 ,p_attribute29_value => p_rec.information29
402 ,p_attribute30_name => 'INFORMATION30'
403 ,p_attribute30_value => p_rec.information30
404 );
405 end if;
406 --
407 hr_utility.set_location(' Leaving:'||l_proc,20);
408 end chk_ddf;
409 --
410 -- ----------------------------------------------------------------------------
411 -- |-----------------------< chk_non_updateable_args >------------------------|
412 -- ----------------------------------------------------------------------------
413 -- {Start Of Comments}
414 --
415 -- Description:
416 -- This procedure is used to ensure that non updateable attributes have
417 -- not been updated. If an attribute has been updated an error is generated.
418 --
419 -- Pre Conditions:
420 -- g_old_rec has been populated with details of the values currently in
421 -- the database.
422 --
423 -- In Arguments:
424 -- p_rec has been populated with the updated values the user would like the
425 -- record set to.
426 --
427 -- Post Success:
428 -- Processing continues if all the non updateable attributes have not
429 -- changed.
430 --
431 -- Post Failure:
432 -- An application error is raised if any of the non updatable attributes
433 -- have been altered.
434 --
435 -- {End Of Comments}
436 -- ----------------------------------------------------------------------------
437 Procedure chk_non_updateable_args
438 (p_effective_date in date
439 ,p_rec in hr_cnp_shd.g_rec_type
440 ) IS
441 --
442 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
443 l_error EXCEPTION;
444 l_argument varchar2(30);
445 --
446 Begin
447 --
448 -- Only proceed with the validation if a row exists for the current
449 -- record in the HR Schema.
450 --
451 IF NOT hr_cnp_shd.api_updating
452 (p_canvas_property_id => p_rec.canvas_property_id
453 ,p_object_version_number => p_rec.object_version_number
454 ) THEN
455 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
456 fnd_message.set_token('PROCEDURE ', l_proc);
457 fnd_message.set_token('STEP ', '5');
458 fnd_message.raise_error;
459 END IF;
460 --
461 IF (nvl(p_rec.form_canvas_id,hr_api.g_number) <>
462 nvl(hr_cnp_shd.g_old_rec.form_canvas_id,hr_api.g_number)
463 ) THEN
464 l_argument := 'form_canvas_id';
465 RAISE l_error;
466 END IF;
467 --
468 IF (nvl(p_rec.template_canvas_id,hr_api.g_number) <>
469 nvl(hr_cnp_shd.g_old_rec.template_canvas_id,hr_api.g_number)
470 ) THEN
471 l_argument := 'template_canvas_id';
472 RAISE l_error;
473 END IF;
474 --
475 EXCEPTION
476 WHEN l_error THEN
477 hr_api.argument_changed_error
478 (p_api_name => l_proc
479 ,p_argument => l_argument);
480 WHEN OTHERS THEN
481 RAISE;
482 End chk_non_updateable_args;
483 --
484 -- ----------------------------------------------------------------------------
485 -- |---------------------< chk_form_and_template_canvas >---------------------|
486 -- ----------------------------------------------------------------------------
487 Procedure chk_form_and_template_canvas
488 (p_effective_date in date
489 ,p_canvas_property_id in number
490 ,p_form_canvas_id in number
491 ,p_template_canvas_id in number
492 ) is
493 --
494 l_proc varchar2(72) := g_package || 'chk_form_and_template_canvas';
495 l_api_updating boolean;
496 --
497 Begin
498 hr_utility.set_location('Entering:'||l_proc, 10);
499 --
500 -- One and only one of form_canvas_id and template_canvas_id must be given
501 --
502 if not ( ( p_form_canvas_id is not null
503 and p_template_canvas_id is null)
504 or ( p_form_canvas_id is null
505 and p_template_canvas_id is not null)) then
506 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
507 fnd_message.set_token('PROCEDURE', l_proc);
508 fnd_message.set_token('STEP','10');
509 fnd_message.raise_error;
510 end if;
511 --
512 hr_utility.set_location('Leaving:'||l_proc, 100);
513 End chk_form_and_template_canvas;
514 --
515 -- ----------------------------------------------------------------------------
516 -- |--------------------------< chk_form_canvas_id >--------------------------|
517 -- ----------------------------------------------------------------------------
518 Procedure chk_form_canvas_id
519 (p_effective_date in date
520 ,p_canvas_property_id in number
521 ,p_object_version_number in number
522 ,p_form_canvas_id in number
523 ) is
524 --
525 l_proc varchar2(72) := g_package || 'chk_form_canvas_id';
526 l_api_updating boolean;
527 l_canvas_type varchar2(30);
528 --
529 Begin
530 hr_utility.set_location('Entering:'||l_proc, 10);
531 --
532 l_api_updating := hr_cnp_shd.api_updating
533 (p_canvas_property_id => p_canvas_property_id
534 ,p_object_version_number => p_object_version_number
535 );
536 hr_utility.set_location(l_proc,20);
537 --
538 -- Only proceed with SQL validation if absolutely necessary
539 --
540 if ( ( l_api_updating
541 and nvl(hr_cnp_shd.g_old_rec.form_canvas_id,hr_api.g_number) <>
542 nvl(p_form_canvas_id,hr_api.g_number))
543 or (NOT l_api_updating)) then
544 --
545 hr_utility.set_location(l_proc,30);
546 --
547 if (p_form_canvas_id is not null) then
548 --
549 hr_utility.set_location(l_proc,40);
550 --
551 -- Associated canvas must be of type CONTENT or TAB
552 --
553 l_canvas_type := return_canvas_type
554 (p_form_canvas_id => p_form_canvas_id
555 );
556 --
557 /*
558 if (nvl(l_canvas_type,hr_api.g_varchar2) NOT in ('CONTENT','TAB','TAB_STACKED')) then
559 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
560 fnd_message.set_token('PROCEDURE', l_proc);
561 fnd_message.set_token('STEP','10');
562 fnd_message.raise_error;
563 end if;
564 */
565 --
566 end if;
567 --
568 end if;
569 --
570 hr_utility.set_location('Leaving:'||l_proc, 100);
571 End chk_form_canvas_id;
572 --
573 -- ----------------------------------------------------------------------------
574 -- |------------------------< chk_template_canvas_id >------------------------|
575 -- ----------------------------------------------------------------------------
576 Procedure chk_template_canvas_id
577 (p_effective_date in date
578 ,p_canvas_property_id in number
579 ,p_object_version_number in number
580 ,p_template_canvas_id in number
581 ) is
582 --
586 --
583 l_proc varchar2(72) := g_package || 'chk_template_canvas_id';
584 l_api_updating boolean;
585 l_canvas_type varchar2(30);
587 Begin
588 hr_utility.set_location('Entering:'||l_proc, 10);
589 --
590 l_api_updating := hr_cnp_shd.api_updating
591 (p_canvas_property_id => p_canvas_property_id
592 ,p_object_version_number => p_object_version_number
593 );
594 hr_utility.set_location(l_proc,20);
595 --
596 -- Only proceed with SQL validation if absolutely necessary
597 --
598 if ( ( l_api_updating
599 and nvl(hr_cnp_shd.g_old_rec.template_canvas_id,hr_api.g_number) <>
600 nvl(p_template_canvas_id,hr_api.g_number))
601 or (NOT l_api_updating)) then
602 --
603 hr_utility.set_location(l_proc,30);
604 --
605 if (p_template_canvas_id is not null) then
606 --
607 hr_utility.set_location(l_proc,40);
608 --
609 -- Associated canvas must be of type CONTENT or TAB
610 --
611 l_canvas_type := return_canvas_type
612 (p_template_canvas_id => p_template_canvas_id
613 );
614 /*
615 if (nvl(l_canvas_type,hr_api.g_varchar2) NOT in ('CONTENT','TAB')) then
616 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
617 fnd_message.set_token('PROCEDURE', l_proc);
618 fnd_message.set_token('STEP','10');
619 fnd_message.raise_error;
620 end if;
621 */
622 --
623 end if;
624 --
625 end if;
626 --
627 hr_utility.set_location('Leaving:'||l_proc, 100);
628 End chk_template_canvas_id;
629 --
630 -- ----------------------------------------------------------------------------
631 -- |------------------------------< chk_height >------------------------------|
632 -- ----------------------------------------------------------------------------
633 Procedure chk_height
634 (p_effective_date in date
635 ,p_canvas_property_id in number
636 ,p_height in number
637 ) is
638 --
639 l_proc varchar2(72) := g_package || 'chk_height';
640 l_api_updating boolean;
641 --
642 Begin
643 hr_utility.set_location('Entering:'||l_proc, 10);
644 --
645 -- Height must be greater than or equal to zero, if given
646 --
647 if (p_height is not null) then
648 --
649 hr_utility.set_location(l_proc,30);
650 --
651 if (p_height < 0) then
652 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
653 fnd_message.set_token('PROCEDURE', l_proc);
654 fnd_message.set_token('STEP','10');
655 fnd_message.raise_error;
656 end if;
657 --
658 end if;
659 --
660 hr_utility.set_location('Leaving:'||l_proc, 100);
661 End chk_height;
662 --
663 -- ----------------------------------------------------------------------------
664 -- |-----------------------------< chk_visible >------------------------------|
665 -- ----------------------------------------------------------------------------
666 Procedure chk_visible
667 (p_effective_date in date
668 ,p_canvas_property_id in number
669 ,p_object_version_number in number
670 ,p_visible in number
671 ) is
672 --
673 l_proc varchar2(72) := g_package || 'chk_visible';
674 l_api_updating boolean;
675 --
676 Begin
677 hr_utility.set_location('Entering:'||l_proc, 10);
678 --
679 -- Check mandatory arguments have been set
680 --
681 hr_api.mandatory_arg_error
682 (p_api_name => l_proc
683 ,p_argument => 'effective_date'
684 ,p_argument_value => p_effective_date
685 );
686 --
687 l_api_updating := hr_cnp_shd.api_updating
688 (p_canvas_property_id => p_canvas_property_id
689 ,p_object_version_number => p_object_version_number
690 );
691 hr_utility.set_location(l_proc,20);
692 --
693 -- Only proceed with SQL validation if absolutely necessary
694 --
695 if ( ( l_api_updating
696 and nvl(hr_cnp_shd.g_old_rec.visible,hr_api.g_number) <>
697 nvl(p_visible,hr_api.g_number))
698 or (NOT l_api_updating)) then
699 --
700 hr_utility.set_location(l_proc,30);
701 --
702 if (p_visible is not null) then
703 --
704 hr_utility.set_location(l_proc,40);
705 --
706 -- Must exist in hr_standard_lookups where lookup_type is
707 -- PROPERTY_TRUE_OR_FALSE
708 --
709 if hr_api.not_exists_in_hrstanlookups
710 (p_effective_date => p_effective_date
711 ,p_lookup_type => 'PROPERTY_TRUE_OR_FALSE'
712 ,p_lookup_code => p_visible
713 ) then
714 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
715 fnd_message.set_token('PROCEDURE', l_proc);
716 fnd_message.set_token('STEP','10');
717 fnd_message.raise_error;
718 end if;
719 --
720 end if;
721 --
722 end if;
723 --
724 hr_utility.set_location('Leaving:'||l_proc, 100);
725 End chk_visible;
726 --
727 -- ----------------------------------------------------------------------------
728 -- |------------------------------< chk_width >-------------------------------|
729 -- ----------------------------------------------------------------------------
730 Procedure chk_width
731 (p_effective_date in date
732 ,p_canvas_property_id in number
733 ,p_width in number
734 ) is
735 --
736 l_proc varchar2(72) := g_package || 'chk_width';
737 l_api_updating boolean;
738 --
739 Begin
740 hr_utility.set_location('Entering:'||l_proc, 10);
741 --
742 -- Width must be greater than or equal to zero, if given
743 --
744 if (p_width is not null) then
745 --
746 hr_utility.set_location(l_proc,30);
747 --
748 if (p_width < 0) then
749 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
750 fnd_message.set_token('PROCEDURE', l_proc);
751 fnd_message.set_token('STEP','10');
752 fnd_message.raise_error;
753 end if;
754 --
755 end if;
756 --
757 hr_utility.set_location('Leaving:'||l_proc, 100);
758 End chk_width;
759 --
760 -- ----------------------------------------------------------------------------
761 -- |-----------------------------< chk_x_position >---------------------------|
762 -- ----------------------------------------------------------------------------
763 Procedure chk_x_position
764 (p_effective_date in date
765 ,p_canvas_property_id in number
766 ,p_x_position in number
767 ) is
768 --
769 l_proc varchar2(72) := g_package || 'chk_x_position';
770 l_api_updating boolean;
771 --
772 Begin
773 hr_utility.set_location('Entering:'||l_proc, 10);
774 --
775 -- X position must be greater than or equal to zero,if given
776 --
777 if (p_x_position is not null) then
778 --
779 hr_utility.set_location(l_proc,30);
780 --
781 if (p_x_position < 0) then
782 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
783 fnd_message.set_token('PROCEDURE', l_proc);
784 fnd_message.set_token('STEP','10');
785 fnd_message.raise_error;
786 end if;
787 --
788 end if;
789 --
790 hr_utility.set_location('Leaving:'||l_proc, 100);
791 End chk_x_position;
792 --
793 -- ----------------------------------------------------------------------------
794 -- |-----------------------------< chk_y_position >---------------------------|
795 -- ----------------------------------------------------------------------------
796 Procedure chk_y_position
797 (p_effective_date in date
798 ,p_canvas_property_id in number
799 ,p_y_position in number
800 ) is
801 --
802 l_proc varchar2(72) := g_package || 'chk_y_position';
803 l_api_updating boolean;
804 --
805 Begin
806 hr_utility.set_location('Entering:'||l_proc, 10);
807 --
811 --
808 -- Y position must be greater than or equal to zero, if given
809 --
810 if (p_y_position is not null) then
812 hr_utility.set_location(l_proc,30);
813 --
814 if (p_y_position < 0) then
815 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
816 fnd_message.set_token('PROCEDURE', l_proc);
817 fnd_message.set_token('STEP','10');
818 fnd_message.raise_error;
819 end if;
820 --
821 end if;
822 --
823 hr_utility.set_location('Leaving:'||l_proc, 100);
824 End chk_y_position;
825 --
826 -- ----------------------------------------------------------------------------
827 -- |---------------------< chk_canvas_type_dependencies >---------------------|
828 -- ----------------------------------------------------------------------------
829 Procedure chk_canvas_type_dependencies
830 (p_effective_date in date
831 ,p_rec in hr_cnp_shd.g_rec_type
832 ) is
833 --
834 cursor csr_form_window is
835 select fwn.height
836 ,fwn.width
837 from hr_form_windows fwn
838 ,hr_form_canvases_b fcn
839 where fwn.form_window_id = fcn.form_window_id
840 and fcn.form_canvas_id = p_rec.form_canvas_id;
841 --
842 cursor csr_template_window is
843 select nvl(twn.height,fwn.height)
844 ,nvl(twn.width,fwn.width)
845 from hr_form_windows fwn
846 ,hr_template_windows twn
847 ,hr_template_canvases_b tcn
848 where fwn.form_window_id = twn.form_window_id
849 and twn.template_window_id = tcn.template_window_id
850 and tcn.template_canvas_id = p_rec.template_canvas_id;
851 --
852 l_proc varchar2(72) := g_package || 'chk_canvas_type_dependencies';
853 l_api_updating boolean;
854 l_canvas_type varchar2(30);
855 l_window_height number;
856 l_window_width number;
857 --
858 Begin
859 hr_utility.set_location('Entering:'||l_proc, 10);
860 --
861 l_canvas_type := return_canvas_type
862 (p_form_canvas_id => p_rec.form_canvas_id
863 ,p_template_canvas_id => p_rec.template_canvas_id
864 );
865 hr_utility.set_location(l_proc,30);
866 --
867 -- Content canvases must be the same height and width as their window
868 --
869 if (l_canvas_type = 'CONTENT') then
870 --
871 if (p_rec.form_canvas_id is not null) then
872 open csr_form_window;
873 fetch csr_form_window into l_window_height,l_window_width;
874 close csr_form_window;
875 elsif (p_rec.template_canvas_id is not null) then
876 open csr_template_window;
877 fetch csr_template_window into l_window_height,l_window_width;
878 close csr_template_window;
879 end if;
880 --
881 if (nvl(p_rec.height,hr_api.g_number) <> nvl(l_window_height,hr_api.g_number)) then
882 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
883 fnd_message.set_token('PROCEDURE', l_proc);
884 fnd_message.set_token('STEP','10');
885 fnd_message.raise_error;
886 end if;
887 --
888 if (nvl(p_rec.width,hr_api.g_number) <> nvl(l_window_width,hr_api.g_number)) then
889 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
890 fnd_message.set_token('PROCEDURE', l_proc);
891 fnd_message.set_token('STEP','20');
892 fnd_message.raise_error;
893 end if;
894 --
895 end if;
896 --
897 -- Visible is only applicable for TAB or STACKED canvases
898 --
899 if (p_rec.visible is not null) then
900 if (nvl(l_canvas_type,hr_api.g_varchar2) not in ('TAB','STACKED')) then
901 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
902 fnd_message.set_token('PROCEDURE', l_proc);
903 fnd_message.set_token('STEP','30');
904 fnd_message.raise_error;
905 end if;
906 end if;
907 --
908 -- X position is only applicable for TAB or STACKED canvases
909 --
910 if (p_rec.x_position is not null) then
911 if (nvl(l_canvas_type,hr_api.g_varchar2) not in ('TAB','STACKED')) then
912 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
913 fnd_message.set_token('PROCEDURE', l_proc);
914 fnd_message.set_token('STEP','40');
915 fnd_message.raise_error;
916 end if;
917 end if;
918 --
919 -- Y position is only applicable for TAB or STACKED canvases
920 --
921 if (p_rec.y_position is not null) then
922 if (nvl(l_canvas_type,hr_api.g_varchar2) not in ('TAB','STACKED')) then
923 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
924 fnd_message.set_token('PROCEDURE', l_proc);
925 fnd_message.set_token('STEP','50');
926 fnd_message.raise_error;
927 end if;
928 end if;
929 --
930 hr_utility.set_location('Leaving:'||l_proc, 100);
931 End chk_canvas_type_dependencies;
932 --
933 -- ----------------------------------------------------------------------------
934 -- |------------------------------< chk_delete >------------------------------|
935 -- ----------------------------------------------------------------------------
936 Procedure chk_delete
937 (p_rec in hr_cnp_shd.g_rec_type
938 ) is
939 --
940 l_proc varchar2(72) := g_package||'chk_delete';
941 --
942 Begin
943 hr_utility.set_location('Entering:'||l_proc, 5);
944 --
945 -- No additional validation required
946 --
947 null;
948 --
949 hr_utility.set_location(' Leaving:'||l_proc, 10);
953 -- |---------------------------< insert_validate >----------------------------|
950 End chk_delete;
951 --
952 -- ----------------------------------------------------------------------------
954 -- ----------------------------------------------------------------------------
955 Procedure insert_validate
956 (p_effective_date in date
957 ,p_rec in hr_cnp_shd.g_rec_type
958 ) is
959 --
960 l_proc varchar2(72) := g_package||'insert_validate';
961 --
962 Begin
963 hr_utility.set_location('Entering:'||l_proc, 5);
964 --
965 -- Check mandatory arguments have been set
966 --
967 hr_api.mandatory_arg_error
968 (p_api_name => l_proc
969 ,p_argument => 'effective_date'
970 ,p_argument_value => p_effective_date
971 );
972 --
973 -- Call all supporting business operations
974 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
975 --
976 chk_form_and_template_canvas
977 (p_effective_date => p_effective_date
978 ,p_canvas_property_id => p_rec.canvas_property_id
979 ,p_form_canvas_id => p_rec.form_canvas_id
980 ,p_template_canvas_id => p_rec.template_canvas_id
981 );
982 --
983 chk_form_canvas_id
984 (p_effective_date => p_effective_date
985 ,p_canvas_property_id => p_rec.canvas_property_id
986 ,p_object_version_number => p_rec.object_version_number
987 ,p_form_canvas_id => p_rec.form_canvas_id
988 );
989 --
990 chk_template_canvas_id
991 (p_effective_date => p_effective_date
992 ,p_canvas_property_id => p_rec.canvas_property_id
993 ,p_object_version_number => p_rec.object_version_number
994 ,p_template_canvas_id => p_rec.template_canvas_id
995 );
996 --
997 chk_height
998 (p_effective_date => p_effective_date
999 ,p_canvas_property_id => p_rec.canvas_property_id
1000 ,p_height => p_rec.height
1001 );
1002 --
1003 chk_visible
1004 (p_effective_date => p_effective_date
1005 ,p_canvas_property_id => p_rec.canvas_property_id
1006 ,p_object_version_number => p_rec.object_version_number
1007 ,p_visible => p_rec.visible
1008 );
1009 --
1010 chk_width
1011 (p_effective_date => p_effective_date
1012 ,p_canvas_property_id => p_rec.canvas_property_id
1013 ,p_width => p_rec.width
1014 );
1015 --
1016 chk_x_position
1017 (p_effective_date => p_effective_date
1018 ,p_canvas_property_id => p_rec.canvas_property_id
1019 ,p_x_position => p_rec.x_position
1020 );
1021 --
1022 chk_y_position
1023 (p_effective_date => p_effective_date
1024 ,p_canvas_property_id => p_rec.canvas_property_id
1025 ,p_y_position => p_rec.y_position
1026 );
1027 --
1028 chk_canvas_type_dependencies
1029 (p_effective_date => p_effective_date
1030 ,p_rec => p_rec
1031 );
1032 --
1033 chk_ddf
1034 (p_rec => p_rec
1035 );
1036 --
1037 hr_utility.set_location(' Leaving:'||l_proc, 10);
1038 End insert_validate;
1039 --
1040 -- ----------------------------------------------------------------------------
1041 -- |---------------------------< update_validate >----------------------------|
1042 -- ----------------------------------------------------------------------------
1043 Procedure update_validate
1044 (p_effective_date in date
1045 ,p_rec in hr_cnp_shd.g_rec_type
1046 ) is
1047 --
1048 l_proc varchar2(72) := g_package||'update_validate';
1049 --
1050 Begin
1051 hr_utility.set_location('Entering:'||l_proc, 5);
1052 --
1053 -- Check mandatory arguments have been set
1054 --
1055 hr_api.mandatory_arg_error
1056 (p_api_name => l_proc
1057 ,p_argument => 'effective_date'
1058 ,p_argument_value => p_effective_date
1059 );
1060 --
1061 -- Call all supporting business operations
1062 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
1063 --
1064 chk_non_updateable_args
1065 (p_effective_date => p_effective_date
1066 ,p_rec => p_rec
1067 );
1068 --
1069 chk_form_and_template_canvas
1070 (p_effective_date => p_effective_date
1071 ,p_canvas_property_id => p_rec.canvas_property_id
1072 ,p_form_canvas_id => p_rec.form_canvas_id
1073 ,p_template_canvas_id => p_rec.template_canvas_id
1074 );
1075 --
1076 chk_form_canvas_id
1077 (p_effective_date => p_effective_date
1078 ,p_canvas_property_id => p_rec.canvas_property_id
1079 ,p_object_version_number => p_rec.object_version_number
1080 ,p_form_canvas_id => p_rec.form_canvas_id
1081 );
1082 --
1083 chk_template_canvas_id
1084 (p_effective_date => p_effective_date
1085 ,p_canvas_property_id => p_rec.canvas_property_id
1086 ,p_object_version_number => p_rec.object_version_number
1087 ,p_template_canvas_id => p_rec.template_canvas_id
1088 );
1089 --
1090 chk_height
1091 (p_effective_date => p_effective_date
1092 ,p_canvas_property_id => p_rec.canvas_property_id
1096 chk_visible
1093 ,p_height => p_rec.height
1094 );
1095 --
1097 (p_effective_date => p_effective_date
1098 ,p_canvas_property_id => p_rec.canvas_property_id
1099 ,p_object_version_number => p_rec.object_version_number
1100 ,p_visible => p_rec.visible
1101 );
1102 --
1103 chk_width
1104 (p_effective_date => p_effective_date
1105 ,p_canvas_property_id => p_rec.canvas_property_id
1106 ,p_width => p_rec.width
1107 );
1108 --
1109 chk_x_position
1110 (p_effective_date => p_effective_date
1111 ,p_canvas_property_id => p_rec.canvas_property_id
1112 ,p_x_position => p_rec.x_position
1113 );
1114 --
1115 chk_y_position
1116 (p_effective_date => p_effective_date
1117 ,p_canvas_property_id => p_rec.canvas_property_id
1118 ,p_y_position => p_rec.y_position
1119 );
1120 --
1121 chk_canvas_type_dependencies
1122 (p_effective_date => p_effective_date
1123 ,p_rec => p_rec
1124 );
1125 --
1126 chk_ddf
1127 (p_rec => p_rec
1128 );
1129 --
1130 hr_utility.set_location(' Leaving:'||l_proc, 10);
1131 End update_validate;
1132 --
1133 -- ----------------------------------------------------------------------------
1134 -- |---------------------------< delete_validate >----------------------------|
1135 -- ----------------------------------------------------------------------------
1136 Procedure delete_validate
1137 (p_rec in hr_cnp_shd.g_rec_type
1138 ) is
1139 --
1140 l_proc varchar2(72) := g_package||'delete_validate';
1141 --
1142 Begin
1143 hr_utility.set_location('Entering:'||l_proc, 5);
1144 --
1145 -- Call all supporting business operations
1146 --
1147 chk_delete
1151 hr_utility.set_location(' Leaving:'||l_proc, 10);
1148 (p_rec => p_rec
1149 );
1150 --
1152 End delete_validate;
1153 --
1154 end hr_cnp_bus;