[Home] [Help]
PACKAGE BODY: APPS.OTA_RUD_BUS
Source
1 Package Body ota_rud_bus as
2 /* $Header: otrudrhi.pkb 120.2 2005/09/08 06:34:32 pgupta noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_rud_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_resource_usage_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_resource_usage_id in number
22 ,p_associated_column1 in varchar2 default null
23 ) is
24 --
25 -- Declare cursor
26 --
27 cursor csr_sec_grp is
28 select pbg.security_group_id,
29 pbg.legislation_code
30 from per_business_groups_perf pbg
31 , ota_resource_usages rud
32 , ota_offerings off
33 where rud.resource_usage_id = p_resource_usage_id
34 and rud.offering_id = off.offering_id
35 and pbg.business_group_id = off.business_group_id;
36 --
37 -- Declare local variables
38 --
39 l_security_group_id number;
40 l_proc varchar2(72) := g_package||'set_security_group_id';
41 l_legislation_code varchar2(150);
42 --
43 begin
44 --
45 hr_utility.set_location('Entering:'|| l_proc, 10);
46 --
47 -- Ensure that all the mandatory parameter are not null
48 --
49 hr_api.mandatory_arg_error
50 (p_api_name => l_proc
51 ,p_argument => 'resource_usage_id'
52 ,p_argument_value => p_resource_usage_id
53 );
54 --
55 open csr_sec_grp;
56 fetch csr_sec_grp into l_security_group_id
57 , l_legislation_code;
58 --
59 if csr_sec_grp%notfound then
60 --
61 close csr_sec_grp;
62 --
66 hr_multi_message.add
63 -- The primary key is invalid therefore we must error
64 --
65 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
67 (p_associated_column1
68 => nvl(p_associated_column1,'RESOURCE_USAGE_ID')
69 );
70 --
71 else
72 close csr_sec_grp;
73 --
74 -- Set the security_group_id in CLIENT_INFO
75 --
76 hr_api.set_security_group_id
77 (p_security_group_id => l_security_group_id
78 );
79 --
80 -- Set the sessions legislation context in HR_SESSION_DATA
81 --
82 hr_api.set_legislation_context(l_legislation_code);
83 end if;
84 --
85 hr_utility.set_location(' Leaving:'|| l_proc, 20);
86 --
87 end set_security_group_id;
88 --
89 -- ---------------------------------------------------------------------------
90 -- |---------------------< return_legislation_code >-------------------------|
91 -- ---------------------------------------------------------------------------
92 --
93 Function return_legislation_code
94 (p_resource_usage_id in number
95 )
96 Return Varchar2 Is
97 --
98 -- Declare cursor
99 --
100 cursor csr_leg_code is
101 select pbg.legislation_code
102 from per_business_groups_perf pbg
103 , ota_resource_usages rud
104 , ota_suppliable_resources tsr
105 where rud.resource_usage_id = p_resource_usage_id
106 and rud.supplied_resource_id = tsr.supplied_Resource_id
107 and pbg.business_group_id = tsr.business_group_id;
108 --
109 -- Declare local variables
110 --
111 l_legislation_code varchar2(150);
112 l_proc varchar2(72) := g_package||'return_legislation_code';
113 --
114 Begin
115 --
116 hr_utility.set_location('Entering:'|| l_proc, 10);
117 --
118 -- Ensure that all the mandatory parameter are not null
119 --
120 hr_api.mandatory_arg_error
121 (p_api_name => l_proc
122 ,p_argument => 'resource_usage_id'
123 ,p_argument_value => p_resource_usage_id
124 );
125 --
126 if ( nvl(ota_rud_bus.g_resource_usage_id, hr_api.g_number)
127 = p_resource_usage_id) then
128 --
129 -- The legislation code has already been found with a previous
130 -- call to this function. Just return the value in the global
131 -- variable.
132 --
133 l_legislation_code := ota_rud_bus.g_legislation_code;
134 hr_utility.set_location(l_proc, 20);
135 else
136 --
137 -- The ID is different to the last call to this function
138 -- or this is the first call to this function.
139 --
140 open csr_leg_code;
141 fetch csr_leg_code into l_legislation_code;
142 --
143 if csr_leg_code%notfound then
144 --
145 -- The primary key is invalid therefore we must error
146 --
147 close csr_leg_code;
148 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
149 fnd_message.raise_error;
150 end if;
151 hr_utility.set_location(l_proc,30);
152 --
153 -- Set the global variables so the values are
154 -- available for the next call to this function.
155 --
156 close csr_leg_code;
157 ota_rud_bus.g_resource_usage_id := p_resource_usage_id;
158 ota_rud_bus.g_legislation_code := l_legislation_code;
159 end if;
160 hr_utility.set_location(' Leaving:'|| l_proc, 40);
161 return l_legislation_code;
162 end return_legislation_code;
163 --
164 -- ----------------------------------------------------------------------------
165 -- ---------------------------< check_unique_key >----------------------------|
166 -- ----------------------------------------------------------------------------
167 --
168 -- A specific resource cannot be entered against the same course
169 -- more than once.
170 --
171 procedure check_unique_key
172 (p_supplied_resource_id in number
173 ,p_offering_id in number
174 ) is
175 --
176 l_proc varchar2 (72) := g_package || 'check_unique_key';
177 l_ok varchar2 (3);
178 --
179 cursor c1 is
180 select 'No'
181 from ota_resource_usages rud
182 where rud.supplied_resource_id = p_supplied_resource_id
183 and rud.offering_id = p_offering_id;
184 --
185 begin
186 --
187 hr_utility.set_location ('Entering:' || l_proc, 5);
188 --
189 open c1;
190 fetch c1
191 into l_ok;
192 if (c1%found) then
193 ota_rud_shd.constraint_error ('OTA_RESOURCE_USAGES_PK');
194 end if;
195 close c1;
196 --
197 hr_utility.set_location (' leaving:' || l_proc, 10);
198 --
199 end check_unique_key;
200 --
201 -- ----------------------------------------------------------------------------
202 -- --------------------------< check_start_end_dates >------------------------|
203 -- ----------------------------------------------------------------------------
204 --
205 -- The start date must be less than, or equal to, the end date.
206 --
207 procedure check_start_end_dates
208 (
209 p_start_date in date
210 ,p_end_date in date
211 ) is
212 --
216 begin
213 l_proc varchar2 (72) := g_package || 'check_start_end_dates';
214 --
215 --
217 --
218 hr_utility.set_location ('entering:' || l_proc, 5);
219 --
220 if (p_start_date
221 > nvl (p_end_date, to_date ('31-12-4712', 'DD-MM-YYYY'))) then
222 ota_rud_shd.constraint_error ('OTA_RUD_DATES');
223 end if;
224 --
225 hr_utility.set_location (' leaving:' || l_proc, 5);
226 --
227 end check_start_end_dates;
228 --
229 -- ----------------------------------------------------------------------------
230 -- --------------------------------< check_off >------------------------------|
231 -- ----------------------------------------------------------------------------
232 --
233 procedure check_off
234 (p_offering_id in number
235 ,p_start_date in date
236 ,p_end_date in date
237 ) is
238 --
239 l_proc varchar2 (72) := g_package || 'check_off';
240 l_off_start_date date;
241 l_off_end_date date;
242 --
243 cursor c1 is
244 select
245 off.start_date
246 ,off.end_date
247 from
248 ota_offerings off
249 where
250 off.offering_id = p_offering_id;
251 --
252 begin
253 --
254 hr_utility.set_location ('Entering:' || l_proc, 5);
255 --
256 -- valid Offering ?
257 --
258 open c1;
259 fetch c1
260 into l_off_start_date,
261 l_off_end_date;
262 if (c1%notfound) then
263 ota_rud_shd.constraint_error ('OTA_RESOURCE_USAGES_FK2');
264 end if;
265 close c1;
266 --
267 -- Start date in range ?
268 --
269 if (p_start_date
270 not between l_off_start_date
271 and nvl (l_off_end_date, hr_general.end_of_time)) then
272 ota_rud_shd.constraint_error ('OTA_RUD_TAV_DATES');
273 end if;
274 --
275 -- End date in range ?
276 --
277 if ( (p_end_date is not null)
278 and (p_end_date
279 not between l_off_start_date
280 and nvl (l_off_end_date, hr_general.end_of_time))) then
281 ota_rud_shd.constraint_error ('OTA_RUD_TAV_DATES');
282 end if;
283 --
284 hr_utility.set_location (' leaving:' || l_proc, 5);
285 --
286 end check_off;
287 --
288 -- ----------------------------------------------------------------------------
289 -- --------------------------------< check_tsr >------------------------------|
290 -- ----------------------------------------------------------------------------
291 --
292 procedure check_tsr
293 (p_supplied_resource_id in number
294 ,p_start_date in date
295 ,p_end_date in date
296 ) is
297 --
298 --
299 l_proc varchar2 (72) := g_package || 'check_tsr';
300 l_tsr_start_date date;
301 l_tsr_end_date date;
302 --
303 cursor c1 is
304 select tsr.start_date,
305 tsr.end_date
306 from ota_suppliable_resources tsr
307 where tsr.supplied_resource_id = p_supplied_resource_id;
308 --
309 begin
310 --
311 hr_utility.set_location ('Entering:' || l_proc, 5);
312 --
313 -- valid resource ?
314 --
315 open c1;
316 fetch c1
317 into l_tsr_start_date,
318 l_tsr_end_date;
319 if (c1%notfound) then
320 ota_rud_shd.constraint_error ('OTA_RESOURCE_USAGES_FK1');
321 end if;
322 close c1;
323 --
324 -- Start date in range ?
325 --
326 if (p_start_date
327 not between l_tsr_start_date
328 and nvl (l_tsr_end_date, hr_general.end_of_time)) then
329 ota_rud_shd.constraint_error ('OTA_RUD_TSR_DATES');
330 end if;
331 --
332 -- End date in range ?
333 --
334 if ( (p_end_date is not null)
335 and (p_end_date
336 not between l_tsr_start_date
337 and nvl (l_tsr_end_date, hr_general.end_of_time))) then
338 ota_rud_shd.constraint_error ('OTA_RUD_TSR_DATES');
339 end if;
340 --
341 hr_utility.set_location (' leaving:' || l_proc, 10);
342 --
343 end check_tsr;
344 --
345 -- ----------------------------------------------------------------------------
346 -- -----------------------< check_off_tsr_bus_grp >---------------------------|
347 -- ----------------------------------------------------------------------------
348 --
349 -- The business group of the suppliable resource (if entered) and the
350 -- offering must be the same.
351 --
352 procedure check_off_tsr_bus_grp
353 (p_supplied_resource_id in number
354 ,p_offering_id in number
355 ) is
356 --
357 l_proc varchar2 (72) := g_package || 'check_off_tsr_bus_grp';
358 l_ok varchar2 (3);
359 --
360 cursor c1 is
361 select 'YES'
362 from ota_suppliable_resources tsr,
363 ota_offerings off
364 where tsr.supplied_resource_id = p_supplied_resource_id
365 and off.offering_id = p_offering_id
366 and tsr.business_group_id = off.business_group_id;
367 --
368 begin
369 --
373 fetch c1
370 hr_utility.set_location ('Entering:' || l_proc, 5);
371 --
372 open c1;
374 into l_ok;
375 if (c1%notfound) then
376 close c1;
377 ota_rud_shd.constraint_error ('OTA_RUD_BUSINESS_GROUPS');
378 end if;
379 close c1;
380 --
381 hr_utility.set_location (' Leaving:' || l_proc, 10);
382 --
383 end check_off_tsr_bus_grp;
384 --
385 -- ----------------------------------------------------------------------------
386 -- ---------------------------< check_resource_type >-------------------------|
387 -- ----------------------------------------------------------------------------
388 --
389 -- The resource type must be in the domain 'RESOURCE_TYPE'.
390 --
391 procedure check_resource_type
392 (p_resource_type in varchar2
393 ) is
394 --
395 l_proc varchar2 (72) := g_package || 'check_resource_type';
396 --
397 begin
398 --
399 hr_utility.set_location ('Entering:' || l_proc, 5);
400 --
401 ota_general.check_domain_value ('RESOURCE_TYPE', p_resource_type);
402 --
403 hr_utility.set_location (' Leaving:' || l_proc, 10);
404 --
405 end check_resource_type;
406 --
407 -- ----------------------------------------------------------------------------
408 -- --------------------------------< Check_role >-----------------------------|
409 -- ----------------------------------------------------------------------------
410 --
411 Procedure Check_role
412 (p_role_to_play in varchar2
413 ,p_resource_type in varchar2
414 ,p_supplied_resource_id in number
415 ) is
416 --
417 l_proc varchar2 (72) := g_package || 'Check_role';
418 l_res_type varchar2(30);
419 --
420 Cursor cur_res_type is
421 select
422 tsr.resource_type
423 from
424 ota_suppliable_resources tsr
425 where
426 tsr.supplied_resource_id = p_supplied_resource_id;
427
428 Begin
429 --
430 hr_utility.set_location ('Entering' || l_proc, 10);
431 --
432 If p_role_to_play is not null then
433 If p_resource_type is not null and p_resource_type <> 'T' then
434 ota_rud_shd.constraint_error ('OTA_RUD_RESOURCE_ROLE');
435 Else
436 --
437 open cur_res_type;
438 fetch cur_res_type into l_res_type;
439 close cur_res_type;
440 --
441 If l_res_type is not null and l_res_type <> 'T' then
442 ota_rud_shd.constraint_error ('OTA_RUD_RESOURCE_ROLE');
443 End If;
444 --
445 End If;
446 --
447 ota_general.check_domain_value ('TRAINER_PARTICIPATION', p_role_to_play);
448 --
449 End If;
450 hr_utility.set_location (' Leaving:' || l_proc, 10);
451 --
452 End Check_role;
453 --
454 -- ----------------------------------------------------------------------------
455 -- -----------------------------< check_usage_reason >------------------------|
456 -- ----------------------------------------------------------------------------
457 --
458 procedure check_usage_reason
459 (p_usage_reason in varchar2
460 ) is
461 --
462 l_proc varchar2 (72) := g_package || 'check_usage_reason';
463 --
464 begin
465 --
466 hr_utility.set_location ('Entering' || l_proc, 10);
467 --
468 ota_general.check_domain_value ('RESOURCE_USAGE_REASON', p_usage_reason);
469 --
470 hr_utility.set_location (' Leaving:' || l_proc, 10);
471 --
472 end check_usage_reason;
473 --
474 -- ----------------------------------------------------------------------------
475 -- ------------------------------< check_quantity >---------------------------|
476 -- ----------------------------------------------------------------------------
477 --
478 procedure check_quantity
479 (p_resource_type in varchar2
480 ,p_quantity in number
481 ) is
482 --
483 l_proc varchar2 (72) := g_package || 'check_quantity';
484 --
485 begin
486 --
487 hr_utility.set_location ('Entering' || l_proc, 10);
488 --
489 If p_resource_type = 'V' or p_resource_type = 'T' Then
490 --
491 If p_quantity is null or p_quantity <> 1 Then
492 --
493 fnd_message.set_name ( 'OTA', 'OTA_13265_TRB_QUANTITY_ENTERED');
494 fnd_message.raise_error;
495 --
496 End If;
497 ElsIf p_quantity < 1 Then
498 --
499 fnd_message.set_name ( 'OTA', 'OTA_443369_POSITIVE_WHL_NUMBER');
500 fnd_message.raise_error;
501 --
502 End If;
503 --
504 hr_utility.set_location ('Leaving:' || l_proc, 20);
505 --
506 Exception
507 --
508 when app_exception.application_exception then
509 if hr_multi_message.exception_add
510 (p_associated_column1 => 'OTA_RESOURCE_USAGES.QUANTITY'
511 )
512 Then
513 --
514 hr_utility.set_location(' Leaving:'|| l_proc, 30);
515 raise;
516 --
517 end if;
518 --
519 hr_utility.set_location(' Leaving:'|| l_proc, 40);
520 --
521 end check_quantity;
522
523 --
524 -- ----------------------------------------------------------------------------
525 -- ------------------------------< validity_checks >--------------------------|
526 -- ----------------------------------------------------------------------------
527 --
528 procedure validity_checks
529 (p_rec in ota_rud_shd.g_rec_type
530 ) is
531 --
532 l_proc varchar2 (72) := g_package || 'check_usage_reason';
533 l_resource_type ota_suppliable_resources.resource_type%Type;
534 --
535 Cursor Get_Resource_type is
536 select resource_type
537 from ota_suppliable_resources
538 where supplied_resource_id = p_rec.supplied_resource_id;
539 --
540 begin
541 --
542 hr_utility.set_location ('Entering' || l_proc, 10);
543 --
544 check_start_end_dates
545 (p_start_date => p_rec.start_date
546 ,p_end_date => p_rec.end_date
547 );
548 --
549 check_off
550 (p_offering_id => p_rec.offering_id
551 ,p_start_date => p_rec.start_date
552 ,p_end_date => p_rec.end_date
553 );
554 --
555 l_resource_type := p_rec.resource_type;
556 --
557 -- Get the resource_type using supplied_resource_id if resource_type is null
558 --
559 If l_resource_type is null Then
560 --
561 Open Get_Resource_type;
562 Fetch Get_Resource_type into l_resource_type;
563 Close Get_Resource_type;
564 --
565 End if;
566 --
567 check_quantity
568 (p_resource_type => l_resource_type
569 ,p_quantity => p_rec.quantity
570 );
571 --
572 -- specified resource ?
573 --
574 if (p_rec.supplied_resource_id is not null) then
575 if (p_rec.resource_type is not null) then
576 ota_rud_shd.constraint_error ('OTA_RUD_EXCLUSIVITY');
577 end if;
578 --
579 check_tsr
580 (p_supplied_resource_id => p_rec.supplied_resource_id
581 ,p_start_date => p_rec.start_date
582 ,p_end_date => p_rec.end_date
583 );
584 --
585 check_off_tsr_bus_grp
586 (p_offering_id => p_rec.offering_id
587 ,p_supplied_resource_id => p_rec.supplied_resource_id
588 );
589 --
590 -- Type of resource ?
591 --
592 elsif (p_rec.resource_type is not null) then
593 if (p_rec.supplied_resource_id is not null) then
594 ota_rud_shd.constraint_error ('OTA_RUD_EXCLUSIVITY');
595 end if;
596 --
597 check_resource_type
598 (p_resource_type => p_rec.resource_type
599 );
600 --
601 else
602 ota_rud_shd.constraint_error ('OTA_RUD_EXCLUSIVITY');
603 end if;
604 --
605 check_role
606 (p_role_to_play => p_rec.role_to_play
607 ,p_resource_type => p_rec.resource_type
608 ,p_supplied_resource_id => p_rec.supplied_resource_id
609 );
610 --
611 -- Required ?
612 --
613 if (p_rec.required_flag not in ('Y', 'N')) then
614 ota_rud_shd.constraint_error ('OTA_RUD_REQUIRED');
615 end if;
616 --
617 -- Reason
618 --
619 check_usage_reason
620 (p_usage_reason => p_rec.usage_reason
621 );
622 --
623 hr_utility.set_location (' Leaving:' || l_proc, 10);
624 --
625 end validity_checks;
626 --
627 -- ----------------------------------------------------------------------------
628 -- |-----------------------------< chk_ddf >----------------------------------|
629 -- ----------------------------------------------------------------------------
630 --
631 -- Description:
635 -- All other columns have been validated. Must be called as the
632 -- Validates all the Developer Descriptive Flexfield values.
633 --
634 -- Prerequisites:
636 -- last step from insert_validate and update_validate.
637 --
638 -- In Arguments:
639 -- p_rec
640 --
641 -- Post Success:
642 -- If the Developer Descriptive Flexfield structure column and data values
643 -- are all valid this procedure will end normally and processing will
644 -- continue.
645 --
646 -- Post Failure:
647 -- If the Developer Descriptive Flexfield structure column value or any of
648 -- the data values are invalid then an application error is raised as
649 -- a PL/SQL exception.
650 --
651 -- Access Status:
652 -- Internal Row Handler Use Only.
653 --
654 -- ----------------------------------------------------------------------------
655 procedure chk_ddf
656 (p_rec in ota_rud_shd.g_rec_type
657 ) is
658 --
659 l_proc varchar2(72) := g_package || 'chk_ddf';
660 --
661 begin
662 hr_utility.set_location('Entering:'||l_proc,10);
663 --
664 if ((p_rec.resource_usage_id is not null) and (
665 nvl(ota_rud_shd.g_old_rec.rud_information_category, hr_api.g_varchar2) <>
666 nvl(p_rec.rud_information_category, hr_api.g_varchar2) or
667 nvl(ota_rud_shd.g_old_rec.rud_information1, hr_api.g_varchar2) <>
668 nvl(p_rec.rud_information1, hr_api.g_varchar2) or
669 nvl(ota_rud_shd.g_old_rec.rud_information2, hr_api.g_varchar2) <>
670 nvl(p_rec.rud_information2, hr_api.g_varchar2) or
671 nvl(ota_rud_shd.g_old_rec.rud_information3, hr_api.g_varchar2) <>
672 nvl(p_rec.rud_information3, hr_api.g_varchar2) or
673 nvl(ota_rud_shd.g_old_rec.rud_information4, hr_api.g_varchar2) <>
674 nvl(p_rec.rud_information4, hr_api.g_varchar2) or
675 nvl(ota_rud_shd.g_old_rec.rud_information5, hr_api.g_varchar2) <>
676 nvl(p_rec.rud_information5, hr_api.g_varchar2) or
677 nvl(ota_rud_shd.g_old_rec.rud_information6, hr_api.g_varchar2) <>
678 nvl(p_rec.rud_information6, hr_api.g_varchar2) or
679 nvl(ota_rud_shd.g_old_rec.rud_information7, hr_api.g_varchar2) <>
680 nvl(p_rec.rud_information7, hr_api.g_varchar2) or
681 nvl(ota_rud_shd.g_old_rec.rud_information8, hr_api.g_varchar2) <>
682 nvl(p_rec.rud_information8, hr_api.g_varchar2) or
683 nvl(ota_rud_shd.g_old_rec.rud_information9, hr_api.g_varchar2) <>
684 nvl(p_rec.rud_information9, hr_api.g_varchar2) or
685 nvl(ota_rud_shd.g_old_rec.rud_information10, hr_api.g_varchar2) <>
686 nvl(p_rec.rud_information10, hr_api.g_varchar2) or
687 nvl(ota_rud_shd.g_old_rec.rud_information11, hr_api.g_varchar2) <>
688 nvl(p_rec.rud_information11, hr_api.g_varchar2) or
689 nvl(ota_rud_shd.g_old_rec.rud_information12, hr_api.g_varchar2) <>
690 nvl(p_rec.rud_information12, hr_api.g_varchar2) or
691 nvl(ota_rud_shd.g_old_rec.rud_information13, hr_api.g_varchar2) <>
692 nvl(p_rec.rud_information13, hr_api.g_varchar2) or
693 nvl(ota_rud_shd.g_old_rec.rud_information14, hr_api.g_varchar2) <>
694 nvl(p_rec.rud_information14, hr_api.g_varchar2) or
695 nvl(ota_rud_shd.g_old_rec.rud_information15, hr_api.g_varchar2) <>
696 nvl(p_rec.rud_information15, hr_api.g_varchar2) or
697 nvl(ota_rud_shd.g_old_rec.rud_information16, hr_api.g_varchar2) <>
698 nvl(p_rec.rud_information16, hr_api.g_varchar2) or
699 nvl(ota_rud_shd.g_old_rec.rud_information17, hr_api.g_varchar2) <>
700 nvl(p_rec.rud_information17, hr_api.g_varchar2) or
701 nvl(ota_rud_shd.g_old_rec.rud_information18, hr_api.g_varchar2) <>
702 nvl(p_rec.rud_information18, hr_api.g_varchar2) or
703 nvl(ota_rud_shd.g_old_rec.rud_information19, hr_api.g_varchar2) <>
704 nvl(p_rec.rud_information19, hr_api.g_varchar2) or
705 nvl(ota_rud_shd.g_old_rec.rud_information20, hr_api.g_varchar2) <>
706 nvl(p_rec.rud_information20, hr_api.g_varchar2) ))
707 or (p_rec.resource_usage_id is null) then
708 --
709 -- Only execute the validation if absolutely necessary:
710 -- a) During update, the structure column value or any
711 -- of the attribute values have actually changed.
712 -- b) During insert.
713 --
714 hr_dflex_utility.ins_or_upd_descflex_attribs
715 (p_appl_short_name => 'OTA'
716 ,p_descflex_name => 'OTA_RESOURCE_USAGES'
717 ,p_attribute_category => p_rec.rud_information_category
718 ,p_attribute1_name => 'RUD_INFORMATION1'
719 ,p_attribute1_value => p_rec.rud_information1
720 ,p_attribute2_name => 'RUD_INFORMATION2'
721 ,p_attribute2_value => p_rec.rud_information2
722 ,p_attribute3_name => 'RUD_INFORMATION3'
723 ,p_attribute3_value => p_rec.rud_information3
724 ,p_attribute4_name => 'RUD_INFORMATION4'
725 ,p_attribute4_value => p_rec.rud_information4
726 ,p_attribute5_name => 'RUD_INFORMATION5'
727 ,p_attribute5_value => p_rec.rud_information5
728 ,p_attribute6_name => 'RUD_INFORMATION6'
729 ,p_attribute6_value => p_rec.rud_information6
730 ,p_attribute7_name => 'RUD_INFORMATION7'
731 ,p_attribute7_value => p_rec.rud_information7
732 ,p_attribute8_name => 'RUD_INFORMATION8'
733 ,p_attribute8_value => p_rec.rud_information8
734 ,p_attribute9_name => 'RUD_INFORMATION9'
735 ,p_attribute9_value => p_rec.rud_information9
736 ,p_attribute10_name => 'RUD_INFORMATION10'
737 ,p_attribute10_value => p_rec.rud_information10
738 ,p_attribute11_name => 'RUD_INFORMATION11'
739 ,p_attribute11_value => p_rec.rud_information11
740 ,p_attribute12_name => 'RUD_INFORMATION12'
741 ,p_attribute12_value => p_rec.rud_information12
742 ,p_attribute13_name => 'RUD_INFORMATION13'
743 ,p_attribute13_value => p_rec.rud_information13
744 ,p_attribute14_name => 'RUD_INFORMATION14'
745 ,p_attribute14_value => p_rec.rud_information14
746 ,p_attribute15_name => 'RUD_INFORMATION15'
747 ,p_attribute15_value => p_rec.rud_information15
748 ,p_attribute16_name => 'RUD_INFORMATION16'
749 ,p_attribute16_value => p_rec.rud_information16
750 ,p_attribute17_name => 'RUD_INFORMATION17'
751 ,p_attribute17_value => p_rec.rud_information17
752 ,p_attribute18_name => 'RUD_INFORMATION18'
753 ,p_attribute18_value => p_rec.rud_information18
754 ,p_attribute19_name => 'RUD_INFORMATION19'
755 ,p_attribute19_value => p_rec.rud_information19
756 ,p_attribute20_name => 'RUD_INFORMATION20'
757 ,p_attribute20_value => p_rec.rud_information20
758 );
759 end if;
760 --
761 hr_utility.set_location(' Leaving:'||l_proc,20);
762 end chk_ddf;
763 --
764 -- ----------------------------------------------------------------------------
765 -- |-----------------------< chk_non_updateable_args >------------------------|
766 -- ----------------------------------------------------------------------------
767 -- {Start Of Comments}
768 --
769 -- Description:
770 -- This procedure is used to ensure that non updateable attributes have
771 -- not been updated. If an attribute has been updated an error is generated.
772 --
773 -- Pre Conditions:
774 -- g_old_rec has been populated with details of the values currently in
775 -- the database.
776 --
777 -- In Arguments:
778 -- p_rec has been populated with the updated values the user would like the
779 -- record set to.
780 --
781 -- Post Success:
782 -- Processing continues if all the non updateable attributes have not
783 -- changed.
784 --
785 -- Post Failure:
786 -- An application error is raised if any of the non updatable attributes
787 -- have been altered.
788 --
789 -- {End Of Comments}
790 -- ----------------------------------------------------------------------------
791 Procedure chk_non_updateable_args
792 (p_effective_date in date
793 ,p_rec in ota_rud_shd.g_rec_type
794 ) IS
795 --
796 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
797 --
798 Begin
799 --
800 -- Only proceed with the validation if a row exists for the current
801 -- record in the HR Schema.
802 --
803 IF NOT ota_rud_shd.api_updating
804 (p_resource_usage_id => p_rec.resource_usage_id
805 ,p_object_version_number => p_rec.object_version_number
806 ) THEN
807 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
808 fnd_message.set_token('PROCEDURE ', l_proc);
809 fnd_message.set_token('STEP ', '5');
810 fnd_message.raise_error;
811 END IF;
812 --
813 -- EDIT_HERE: Add checks to ensure non-updateable args have
814 -- not been updated.
815 --
816 End chk_non_updateable_args;
817 --
818 -- ----------------------------------------------------------------------------
819 -- |---------------------------< insert_validate >----------------------------|
820 -- ----------------------------------------------------------------------------
821 Procedure insert_validate
822 (p_effective_date in date
823 ,p_rec in ota_rud_shd.g_rec_type
824 ) is
825 --
826 l_proc varchar2(72) := g_package||'insert_validate';
827 --
828 Begin
829 hr_utility.set_location('Entering:'||l_proc, 5);
830 --
831 -- Call all supporting business operations
832 ota_off_bus.set_security_group_id(p_rec.offering_id);
833 --
834 CHECK_UNIQUE_KEY (
835 P_SUPPLIED_RESOURCE_ID => P_REC.SUPPLIED_RESOURCE_ID,
836 P_OFFERING_ID => P_REC.OFFERING_ID);
837 --
838 VALIDITY_CHECKS (
839 P_REC => P_REC);
840 -- Validate Dependent Attributes
841 --
842 --
843 ota_rud_bus.chk_ddf(p_rec);
844 --
845 hr_utility.set_location(' Leaving:'||l_proc, 10);
846 End insert_validate;
847 --
848 -- ----------------------------------------------------------------------------
849 -- |---------------------------< update_validate >----------------------------|
850 -- ----------------------------------------------------------------------------
851 Procedure update_validate
852 (p_effective_date in date
853 ,p_rec in ota_rud_shd.g_rec_type
854 ) is
855 --
856 l_proc varchar2(72) := g_package||'update_validate';
857 --
858 Begin
859 hr_utility.set_location('Entering:'||l_proc, 5);
860 --
861 -- Call all supporting business operations
862 ota_off_bus.set_security_group_id(p_rec.offering_id);
863 --
864 if ( (nvl (P_REC.SUPPLIED_RESOURCE_ID, 0)
865 <> nvl (ota_rud_shd.g_old_rec.SUPPLIED_RESOURCE_ID, 0))
866 or (nvl (P_REC.OFFERING_ID, 0)
867 <> nvl (ota_rud_shd.g_old_rec.OFFERING_ID, 0))) then
868 ota_rud_shd.constraint_error ('OTA_RUD_NON_TRANSFER');
869 end if;
870 --
871 VALIDITY_CHECKS (
872 p_rec => p_rec);
873 -- Validate Dependent Attributes
874 --
875 chk_non_updateable_args
876 (p_effective_date => p_effective_date
877 ,p_rec => p_rec
878 );
879 --
880 --
881 ota_rud_bus.chk_ddf(p_rec);
882 --
883 hr_utility.set_location(' Leaving:'||l_proc, 10);
884 End update_validate;
885 --
886 -- ----------------------------------------------------------------------------
887 -- |---------------------------< delete_validate >----------------------------|
888 -- ----------------------------------------------------------------------------
889 Procedure delete_validate
890 (p_rec in ota_rud_shd.g_rec_type
891 ) is
892 --
893 l_proc varchar2(72) := g_package||'delete_validate';
894 --
895 Begin
896 hr_utility.set_location('Entering:'||l_proc, 5);
897 --
898 -- Call all supporting business operations
899 --
900 hr_utility.set_location(' Leaving:'||l_proc, 10);
901 End delete_validate;
902 --
903 end ota_rud_bus;