DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ECA_BUS

Source


1 Package Body per_eca_bus as
2 /* $Header: peecarhi.pkb 115.6 2002/12/05 10:25:53 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_eca_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_election_candidate_id       number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_election_candidate_id                in number
22 ) is
23 --
24 -- Declare cursor
25 --
26 cursor csr_sec_grp is
27 select pbg.security_group_id
28 from per_business_groups pbg
29  , per_election_candidates eca
30 where eca.election_candidate_id = p_election_candidate_id
31 and pbg.business_group_id = eca.business_group_id;
32 --
33 -- Declare local variables
34 --
35 l_security_group_id number;
36 l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
37 --
38 begin
39 --
40 hr_utility.set_location('Entering:'|| l_proc, 10);
41 --
42 -- Ensure that all the mandatory parameter are not null
43 --
44 hr_api.mandatory_arg_error
45 (p_api_name           => l_proc
46 ,p_argument           => 'election_candidate_id'
47 ,p_argument_value     => p_election_candidate_id
48 );
49 --
50 open csr_sec_grp;
51 fetch csr_sec_grp into l_security_group_id;
52 --
53 if csr_sec_grp%notfound then
54 --
55 close csr_sec_grp;
56 --
57 -- The primary key is invalid therefore we must error
58 --
59 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60 fnd_message.raise_error;
61 --
62 end if;
63 close csr_sec_grp;
64 --
65 -- Set the security_group_id in CLIENT_INFO
66 --
67 hr_api.set_security_group_id
68 (p_security_group_id => l_security_group_id
69 );
70 --
71 hr_utility.set_location(' Leaving:'|| l_proc, 20);
72 --
73 end set_security_group_id;
74 --
75 --  ---------------------------------------------------------------------------
76 --  |---------------------< return_legislation_code >-------------------------|
77 --  ---------------------------------------------------------------------------
78 --
79 Function return_legislation_code
80 (p_election_candidate_id                in     number
81 )
82 Return Varchar2 Is
83 --
84 -- Declare cursor
85 --
86 cursor csr_leg_code is
87 select pbg.legislation_code
88 from per_business_groups pbg
89  , per_election_candidates eca
90 where eca.election_candidate_id = p_election_candidate_id
91 and pbg.business_group_id = eca.business_group_id;
92 --
96 l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
93 -- Declare local variables
94 --
95 l_legislation_code  varchar2(150);
97 --
98 Begin
99 --
100 hr_utility.set_location('Entering:'|| l_proc, 10);
101 --
102 -- Ensure that all the mandatory parameter are not null
103 --
104 hr_api.mandatory_arg_error
105 (p_api_name           => l_proc
106 ,p_argument           => 'election_candidate_id'
107 ,p_argument_value     => p_election_candidate_id
108 );
109 --
110 if ( nvl(per_eca_bus.g_election_candidate_id, hr_api.g_number)
111 = p_election_candidate_id) then
112 --
113 -- The legislation code has already been found with a previous
114 -- call to this function. Just return the value in the global
115 -- variable.
116 --
117 l_legislation_code := per_eca_bus.g_legislation_code;
118 hr_utility.set_location(l_proc, 20);
119 else
120 --
121 -- The ID is different to the last call to this function
122 -- or this is the first call to this function.
123 --
124 open csr_leg_code;
125 fetch csr_leg_code into l_legislation_code;
126 --
127 if csr_leg_code%notfound then
128 --
129 -- The primary key is invalid therefore we must error
130 --
131 close csr_leg_code;
132 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133 fnd_message.raise_error;
134 end if;
135 hr_utility.set_location(l_proc,30);
136 --
137 -- Set the global variables so the values are
138 -- available for the next call to this function.
139 --
140 close csr_leg_code;
141 per_eca_bus.g_election_candidate_id:= p_election_candidate_id;
142 per_eca_bus.g_legislation_code  := l_legislation_code;
143 end if;
144 hr_utility.set_location(' Leaving:'|| l_proc, 40);
145 return l_legislation_code;
146 end return_legislation_code;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------< chk_non_updateable_args >------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 --   This procedure is used to ensure that non updateable attributes have
155 --   not been updated. If an attribute has been updated an error is generated.
156 --
157 -- Pre Conditions:
158 --   g_old_rec has been populated with details of the values currently in
159 --   the database.
160 --
161 -- In Arguments:
162 --   p_rec has been populated with the updated values the user would like the
163 --   record set to.
164 --
165 -- Post Success:
166 --   Processing continues if all the non updateable attributes have not
167 --   changed.
168 --
169 -- Post Failure:
170 --   An application error is raised if any of the non updatable attributes
171 --   have been altered.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure chk_non_updateable_args
176 (p_rec in per_eca_shd.g_rec_type
177 ) IS
178 --
179 l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
180 l_error    EXCEPTION;
181 l_argument varchar2(30);
182 --
183 Begin
184 --
185 -- Only proceed with the validation if a row exists for the current
186 -- record in the HR Schema.
187 --
188 IF NOT per_eca_shd.api_updating
189 (p_election_candidate_id                => p_rec.election_candidate_id
190 ,p_object_version_number                => p_rec.object_version_number
191 ) THEN
192 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
193 fnd_message.set_token('PROCEDURE ', l_proc);
194 fnd_message.set_token('STEP ', '5');
195 fnd_message.raise_error;
196 END IF;
197 --
198 -- EDIT_HERE: Add checks to ensure non-updateable args have
199 --            not been updated.
200 --
201 EXCEPTION
202 WHEN l_error THEN
203 hr_api.argument_changed_error
204 (p_api_name => l_proc
205 ,p_argument => l_argument);
206 WHEN OTHERS THEN
207 RAISE;
208 End chk_non_updateable_args;
209 
210 --  ---------------------------------------------------------------------------
211 --  |---------------------------<  chk_delete >----------------------------|
212 --  ---------------------------------------------------------------------------
213 --
214 --  Description:
215 --    - Check if the role_id is null before delete
216 --
217 --  Pre-conditions:
218 --    None.
219 --
220 --  In Arguments:
221 --    p_role_id
222 --
223 --  Post Success:
224 --    If role id is null then  processing continues.
225 --
226 --  Post Failure:
227 --    If role id is not null then an application error will be
228 --    raised and processing is terminated.
229 --
230 --  Access Status:
231 --    Internal Table Handler Use Only.
232 --
233 -- {End Of Comments}
234 -- ----------------------------------------------------------------------------
235 procedure chk_delete
236 (p_election_candidate_id in    number
237 )
238 is
239 --
240 l_proc              varchar2(72)  :=  g_package||'chk_delete';
241 --
242 l_election_candidate_id number;
243 --
244 cursor csr_valid_del is
245 select election_candidate_id
246 from per_election_candidates
247 where election_candidate_id = p_election_candidate_id
248 and role_id is null;
249 --
250 begin
251 hr_utility.set_location('Entering:'|| l_proc, 10);
252 --
253 -- Check mandatory parameters have been set
254 --
258 ,p_argument_value => p_election_candidate_id
255 hr_api.mandatory_arg_error
256 (p_api_name       => l_proc
257 ,p_argument       => 'election_candidate_id'
259 );
260 --
261 hr_utility.set_location(l_proc, 20);
262 --
263 open csr_valid_del;
264 fetch csr_valid_del into l_election_candidate_id;
265 if csr_valid_del%notfound then
266 --
267 close csr_valid_del;
268 hr_utility.set_message(800,'PER_289105_ECA_CANNOT_BE_DELET');
269 hr_utility.raise_error;
270 --
271 end if;
272 close csr_valid_del;    --
273 --  end if;
274 --
275 hr_utility.set_location(' Leaving:'|| l_proc, 50);
276 end chk_delete;
277 
278 --
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------< delete_validate >----------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure delete_validate
284 (p_rec                          in per_eca_shd.g_rec_type
285 ) is
286 --
287 l_proc  varchar2(72) := g_package||'delete_validate';
288 --
289 Begin
290 hr_utility.set_location('Entering:'||l_proc, 5);
291 --
292 -- Call all supporting business operations
293 chk_delete(p_election_candidate_id => p_rec.election_candidate_id);
294 
295 --
296 hr_utility.set_location(' Leaving:'||l_proc, 10);
297 End delete_validate;
298 --
299 --  |---------------------------<  chk_person_id >----------------------------|
300 --  ---------------------------------------------------------------------------
301 --
302 --  Description:
303 --    - Validates that a person id exists in table per_people_f.
304 --
305 --  Pre-conditions:
306 --    None.
307 --
308 --  In Arguments:
309 --    p_person_id
310 --
311 --  Post Success:
312 --    If a row does exist in per_all_people_f for the given person id then
313 --    processing continues.
314 --
315 --  Post Failure:
316 --    If a row does not exist in per_all_people_f for the given person id then
317 --    an application error will be raised and processing is terminated.
318 --
319 --  Access Status:
320 --    Internal Table Handler Use Only.
321 --
322 -- {End Of Comments}
323 -- ----------------------------------------------------------------------------
324 procedure chk_person_id
325 (p_person_id                 in     per_election_candidates.person_id%TYPE
326 )
327 is
328 --
329 l_proc              varchar2(72)  :=  g_package||'chk_person_id';
330 --
331 l_api_updating      boolean;
332 l_person_id number;
333 --
334 cursor csr_valid_pers is
335 select person_id
336 from per_all_people_f
337 where person_id = p_person_id;
338 --
339 begin
340 hr_utility.set_location('Entering:'|| l_proc, 10);
341 --
342 -- Check mandatory parameters have been set
343 --
344 hr_api.mandatory_arg_error
345 (p_api_name       => l_proc
346 ,p_argument       => 'person_id'
347 ,p_argument_value => p_person_id
348 );
349 --
350 hr_utility.set_location(l_proc, 20);
351 --
352 -- Check that the Person ID is linked to a
353 -- valid person on PER_PEOPLE_F
354 --
355 open csr_valid_pers;
356 fetch csr_valid_pers into l_person_id;
357 if csr_valid_pers%notfound then
358 --
359 close csr_valid_pers;
360 hr_utility.set_message(800, 'PER_289101_ECA_PERSON_INVALID');
361 hr_utility.raise_error;
362 --
363 end if;
364 close csr_valid_pers;
365 --
366 hr_utility.set_location(' Leaving:'|| l_proc, 50);
367 end chk_person_id;
368 --
369 --  ---------------------------------------------------------------------------
370 --  |---------------------------<  chk_election_id >----------------------------|
371 --  ---------------------------------------------------------------------------
372 --
373 --  Description:
374 --    - Validates that a election id exists in table PER_ELECTIONS
375 --
376 --  Pre-conditions:
377 --    None.
378 --
379 --  In Arguments:
380 --    p_election_id
381 --
382 --  Post Success:
383 --    If a row does exist in PER_ELECTIONS for the given election id then
384 --    processing continues.
385 --
386 --  Post Failure:
387 --    If a row does not exist in PER_ELECTIONS for the given election id then
388 --    an application error will be raised and processing is terminated.
389 --
390 --  Access Status:
391 --    Internal Table Handler Use Only.
392 --
393 -- {End Of Comments}
394 -- ----------------------------------------------------------------------------
395 procedure chk_election_id
396 (p_election_id           in     per_election_candidates.election_id%TYPE
397 )
398 is
399 --
400 l_proc              varchar2(72)  :=  g_package||'chk_election_id';
401 --
402 l_election_id number;
403 --
404 cursor csr_valid_eid is
405 select election_id
406 from per_elections
407 where election_id = p_election_id;
408 --
409 begin
410 hr_utility.set_location('Entering:'|| l_proc, 10);
411 --
412 -- Check mandatory parameters have been set
413 --
414 hr_api.mandatory_arg_error
415 (p_api_name       => l_proc
416 ,p_argument       => 'election_id'
417 ,p_argument_value => p_election_id
418 );
419 hr_utility.set_location(l_proc, 20);
420 --
421 -- Check that the Election ID is  exists in PER_ELECTIONS
422 --
423 open csr_valid_eid;
424 fetch csr_valid_eid into l_election_id;
425 if csr_valid_eid%notfound then
426 --
430 --
427 close csr_valid_eid;
428 hr_utility.set_message(800, 'PER_289103_ECA_ELEC_ID_INVALID');
429 hr_utility.raise_error;
431 end if;
432 close csr_valid_eid;
433 --
434 hr_utility.set_location(' Leaving:'|| l_proc, 50);
435 end chk_election_id;
436 --
437 --  ---------------------------------------------------------------------------
438 --  |---------------------<  chk_duplicate_candidate >------------------------|
439 --  ---------------------------------------------------------------------------
440 --
441 --  Description:
442 --    - Validates that a candidate exists already for this election process
443 --
444 --  Pre-conditions:
445 --    None.
446 --
447 --  In Arguments:
448 --    p_election_id
449 --    p_person_id
450 --
451 --  Post Success:
452 --    If a candidate does not exist for this election then processing continues.
453 --
454 --  Post Failure:
455 --    If a candidate already exists for the election then
456 --    an application error will be raised and processing is terminated.
457 --
458 --  Access Status:
459 --    Internal Table Handler Use Only.
460 --
461 -- {End Of Comments}
462 -- ----------------------------------------------------------------------------
463 procedure chk_duplicate_candidate
464 (p_election_id           in     per_election_candidates.election_id%TYPE
465 ,p_person_id		 in	per_election_candidates.person_id%TYPE
466 ,p_election_candidate_id in     per_election_candidates.election_candidate_id%TYPE
467 )
468 is
469 --
470 l_proc              varchar2(72)  :=  g_package||'chk_duplicate_candidate';
471 --
472 l_candidate_id number;
473 --
474 cursor csr_valid_candidate is
475 select election_candidate_id
476 from per_election_candidates
477 where election_id = p_election_id
478 and person_id     = p_person_id;
479 --
480 begin
481 
482 hr_utility.set_location('Entering:'|| l_proc, 10);
483 --
484 -- Check mandatory parameters have been set
485 --
486 hr_api.mandatory_arg_error
487 (p_api_name       => l_proc
488 ,p_argument       => 'election_id'
489 ,p_argument_value => p_election_id
490 );
491 --
492 hr_api.mandatory_arg_error
493 (p_api_name       => l_proc
494 ,p_argument       => 'person_id'
495 ,p_argument_value => p_person_id
496 );
497 --
498 hr_utility.set_location(l_proc, 20);
499 --
500 -- Check that the candidate has not been entered for this election before
501 --
502 open csr_valid_candidate;
503 fetch csr_valid_candidate into l_candidate_id;
504 if csr_valid_candidate%found then
505 if p_election_candidate_id is null or
506    p_election_candidate_id <> l_candidate_id then
507 hr_utility.set_location(l_proc, 30);
508 --
509 fnd_message.set_name('PER', 'HR_289257_ECA_DUP_CANDIDATE');
510 hr_utility.raise_error;
511 --
512 end if;
513 end if;
514 close csr_valid_candidate;
515 --
516 hr_utility.set_location(' Leaving:'|| l_proc, 50);
517 end chk_duplicate_candidate;
518 --
519 --  ---------------------------------------------------------------------------
520 --  |---------------------------<  chk_role_id >----------------------------|
521 --  ---------------------------------------------------------------------------
522 --
523 --  Description:
524 --    - Validates that a role id exists in table PER_ROLES
525 --
526 --  Pre-conditions:
527 --    None.
528 --
529 --  In Arguments:
530 --    p_role_id
531 --
532 --  Post Success:
533 --    If a row does exist in PER_ROLES for the given role id then
534 --    processing continues.
535 --
536 --  Post Failure:
537 --    If a row does not exist in PER_ROLES for the given role id then
538 --    an application error will be raised and processing is terminated.
539 --
540 --  Access Status:
541 --    Internal Table Handler Use Only.
542 --
543 -- {End Of Comments}
544 -- ----------------------------------------------------------------------------
545 procedure chk_role_id
546 (p_role_id               in     per_election_candidates.role_id%TYPE
547 )
548 is
549 --
550 l_proc              varchar2(72)  :=  g_package||'chk_role_id';
551 --
552 l_role_id number;
553 --
554 cursor csr_valid_rid is
555 select role_id
556 from per_roles
557 where role_id = p_role_id;
558 --
559 begin
560 hr_utility.set_location('Entering:'|| l_proc, 10);
561 --
562 -- Check mandatory parameters have been set
563 --
564 hr_api.mandatory_arg_error
565 (p_api_name       => l_proc
566 ,p_argument       => 'role_id'
567 ,p_argument_value => p_role_id
568 );
569 hr_utility.set_location(l_proc, 20);
570 --
571 --
572 -- Check that the Role ID is  exists in PER_ROLES
573 --
574 open csr_valid_rid;
575 fetch csr_valid_rid into l_role_id;
576 if csr_valid_rid%notfound then
577 --
578 close csr_valid_rid;
579 hr_utility.set_message(800, 'PER_289104_ECA_ROLE_ID_INVALID');
580 hr_utility.raise_error;
581 --
582 end if;
583 close csr_valid_rid;    --
584 --
585 hr_utility.set_location(' Leaving:'|| l_proc, 50);
586 end chk_role_id;
587 
588 --
589 -- ----------------------------------------------------------------------------
590 -- |------------------------------< chk_df >----------------------------------|
591 -- ----------------------------------------------------------------------------
592 --
593 -- Description:
594 --   Validates all the Descriptive Flexfield values.
595 --
599 --
596 -- Prerequisites:
597 --   All other columns have been validated.  Must be called as the
598 --   last step from insert_validate and update_validate.
600 -- In Arguments:
601 --   p_rec
602 --
603 -- Post Success:
604 --   If the Descriptive Flexfield structure column and data values are
605 --   all valid this procedure will end normally and processing will
606 --   continue.
607 --
608 -- Post Failure:
609 --   If the Descriptive Flexfield structure column value or any of
610 --   the data values are invalid then an application error is raised as
611 --   a PL/SQL exception.
612 --
613 -- Access Status:
614 --   Internal Row Handler Use Only.
615 --
616 -- ----------------------------------------------------------------------------
617 procedure chk_df
618 (p_rec in per_eca_shd.g_rec_type
619 ) is
620 --
621 l_proc   varchar2(72) := g_package || 'chk_df';
622 --
623 begin
624 hr_utility.set_location('Entering:'||l_proc,10);
625 --
626 if ((p_rec.election_candidate_id is not null)  and (
627 nvl(per_eca_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
628 nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
629 nvl(per_eca_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
630 nvl(p_rec.attribute1, hr_api.g_varchar2)  or
631 nvl(per_eca_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
632 nvl(p_rec.attribute2, hr_api.g_varchar2)  or
633 nvl(per_eca_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
634 nvl(p_rec.attribute3, hr_api.g_varchar2)  or
635 nvl(per_eca_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
636 nvl(p_rec.attribute4, hr_api.g_varchar2)  or
637 nvl(per_eca_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
638 nvl(p_rec.attribute5, hr_api.g_varchar2)  or
639 nvl(per_eca_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
640 nvl(p_rec.attribute6, hr_api.g_varchar2)  or
641 nvl(per_eca_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
642 nvl(p_rec.attribute7, hr_api.g_varchar2)  or
643 nvl(per_eca_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
644 nvl(p_rec.attribute8, hr_api.g_varchar2)  or
645 nvl(per_eca_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
646 nvl(p_rec.attribute9, hr_api.g_varchar2)  or
647 nvl(per_eca_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
648 nvl(p_rec.attribute10, hr_api.g_varchar2)  or
649 nvl(per_eca_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
650 nvl(p_rec.attribute11, hr_api.g_varchar2)  or
651 nvl(per_eca_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
652 nvl(p_rec.attribute12, hr_api.g_varchar2)  or
653 nvl(per_eca_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
654 nvl(p_rec.attribute13, hr_api.g_varchar2)  or
655 nvl(per_eca_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
656 nvl(p_rec.attribute14, hr_api.g_varchar2)  or
657 nvl(per_eca_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
658 nvl(p_rec.attribute15, hr_api.g_varchar2)  or
659 nvl(per_eca_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
660 nvl(p_rec.attribute16, hr_api.g_varchar2)  or
661 nvl(per_eca_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
662 nvl(p_rec.attribute17, hr_api.g_varchar2)  or
663 nvl(per_eca_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
664 nvl(p_rec.attribute18, hr_api.g_varchar2)  or
665 nvl(per_eca_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
666 nvl(p_rec.attribute19, hr_api.g_varchar2)  or
667 nvl(per_eca_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
668 nvl(p_rec.attribute20, hr_api.g_varchar2)  or
669 nvl(per_eca_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
670 nvl(p_rec.attribute21, hr_api.g_varchar2)  or
671 nvl(per_eca_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
672 nvl(p_rec.attribute22, hr_api.g_varchar2)  or
673 nvl(per_eca_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
674 nvl(p_rec.attribute23, hr_api.g_varchar2)  or
675 nvl(per_eca_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
676 nvl(p_rec.attribute24, hr_api.g_varchar2)  or
677 nvl(per_eca_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
678 nvl(p_rec.attribute25, hr_api.g_varchar2)  or
679 nvl(per_eca_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
680 nvl(p_rec.attribute26, hr_api.g_varchar2)  or
681 nvl(per_eca_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
682 nvl(p_rec.attribute27, hr_api.g_varchar2)  or
683 nvl(per_eca_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
684 nvl(p_rec.attribute28, hr_api.g_varchar2)  or
685 nvl(per_eca_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
686 nvl(p_rec.attribute29, hr_api.g_varchar2)  or
687 nvl(per_eca_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
688 nvl(p_rec.attribute30, hr_api.g_varchar2) ))
689 or (p_rec.election_candidate_id is null)  then
690 --
691 -- Only execute the validation if absolutely necessary:
692 -- a) During update, the structure column value or any
693 --    of the attribute values have actually changed.
694 -- b) During insert.
695 --
696 hr_dflex_utility.ins_or_upd_descflex_attribs
697 (p_appl_short_name                 => 'PER'
698 ,p_descflex_name                   => 'PER_ELECTION_CANDIDATES'
699 ,p_attribute_category              => p_rec.attribute_category
700 ,p_attribute1_name                 => 'ATTRIBUTE1'
701 ,p_attribute1_value                => p_rec.attribute1
702 ,p_attribute2_name                 => 'ATTRIBUTE2'
703 ,p_attribute2_value                => p_rec.attribute2
704 ,p_attribute3_name                 => 'ATTRIBUTE3'
705 ,p_attribute3_value                => p_rec.attribute3
706 ,p_attribute4_name                 => 'ATTRIBUTE4'
707 ,p_attribute4_value                => p_rec.attribute4
708 ,p_attribute5_name                 => 'ATTRIBUTE5'
709 ,p_attribute5_value                => p_rec.attribute5
710 ,p_attribute6_name                 => 'ATTRIBUTE6'
711 ,p_attribute6_value                => p_rec.attribute6
712 ,p_attribute7_name                 => 'ATTRIBUTE7'
716 ,p_attribute9_name                 => 'ATTRIBUTE9'
713 ,p_attribute7_value                => p_rec.attribute7
714 ,p_attribute8_name                 => 'ATTRIBUTE8'
715 ,p_attribute8_value                => p_rec.attribute8
717 ,p_attribute9_value                => p_rec.attribute9
718 ,p_attribute10_name                => 'ATTRIBUTE10'
719 ,p_attribute10_value               => p_rec.attribute10
720 ,p_attribute11_name                => 'ATTRIBUTE11'
721 ,p_attribute11_value               => p_rec.attribute11
722 ,p_attribute12_name                => 'ATTRIBUTE12'
723 ,p_attribute12_value               => p_rec.attribute12
724 ,p_attribute13_name                => 'ATTRIBUTE13'
725 ,p_attribute13_value               => p_rec.attribute13
726 ,p_attribute14_name                => 'ATTRIBUTE14'
727 ,p_attribute14_value               => p_rec.attribute14
728 ,p_attribute15_name                => 'ATTRIBUTE15'
729 ,p_attribute15_value               => p_rec.attribute15
730 ,p_attribute16_name                => 'ATTRIBUTE16'
731 ,p_attribute16_value               => p_rec.attribute16
732 ,p_attribute17_name                => 'ATTRIBUTE17'
733 ,p_attribute17_value               => p_rec.attribute17
734 ,p_attribute18_name                => 'ATTRIBUTE18'
735 ,p_attribute18_value               => p_rec.attribute18
736 ,p_attribute19_name                => 'ATTRIBUTE19'
737 ,p_attribute19_value               => p_rec.attribute19
738 ,p_attribute20_name                => 'ATTRIBUTE20'
739 ,p_attribute20_value               => p_rec.attribute20
740 ,p_attribute21_name                => 'ATTRIBUTE21'
741 ,p_attribute21_value               => p_rec.attribute21
742 ,p_attribute22_name                => 'ATTRIBUTE22'
743 ,p_attribute22_value               => p_rec.attribute22
744 ,p_attribute23_name                => 'ATTRIBUTE23'
745 ,p_attribute23_value               => p_rec.attribute23
746 ,p_attribute24_name                => 'ATTRIBUTE24'
747 ,p_attribute24_value               => p_rec.attribute24
748 ,p_attribute25_name                => 'ATTRIBUTE25'
749 ,p_attribute25_value               => p_rec.attribute25
750 ,p_attribute26_name                => 'ATTRIBUTE26'
751 ,p_attribute26_value               => p_rec.attribute26
752 ,p_attribute27_name                => 'ATTRIBUTE27'
753 ,p_attribute27_value               => p_rec.attribute27
754 ,p_attribute28_name                => 'ATTRIBUTE28'
755 ,p_attribute28_value               => p_rec.attribute28
756 ,p_attribute29_name                => 'ATTRIBUTE29'
757 ,p_attribute29_value               => p_rec.attribute29
758 ,p_attribute30_name                => 'ATTRIBUTE30'
759 ,p_attribute30_value               => p_rec.attribute30
760 );
761 end if;
762 --
763 hr_utility.set_location(' Leaving:'||l_proc,20);
764 end chk_df;
765 --
766 
767 --
768 -- ----------------------------------------------------------------------------
769 -- |-----------------------------< chk_ddf >----------------------------------|
770 -- ----------------------------------------------------------------------------
771 --
772 -- Description:
773 --   Validates all the Developer Descriptive Flexfield values.
774 --
775 -- Prerequisites:
776 --   All other columns have been validated.  Must be called as the
777 --   last step from insert_validate and update_validate.
778 --
779 -- In Arguments:
780 --   p_rec
781 --
782 -- Post Success:
783 --   If the Developer Descriptive Flexfield structure column and data values
784 --   are all valid this procedure will end normally and processing will
785 --   continue.
786 --
787 -- Post Failure:
788 --   If the Developer Descriptive Flexfield structure column value or any of
789 --   the data values are invalid then an application error is raised as
790 --   a PL/SQL exception.
791 --
792 -- Access Status:
793 --   Internal Row Handler Use Only.
794 --
795 -- ----------------------------------------------------------------------------
796 procedure chk_ddf
797 (p_rec in per_eca_shd.g_rec_type
798 ) is
799 --
800 l_proc   varchar2(72) := g_package || 'chk_ddf';
801 --
802 begin
803 hr_utility.set_location('Entering:'||l_proc,10);
804 --
805 if ((p_rec.election_candidate_id is not null)  and (
806 nvl(per_eca_shd.g_old_rec.candidate_info_category, hr_api.g_varchar2) <>
807 nvl(p_rec.candidate_info_category, hr_api.g_varchar2)  or
808 nvl(per_eca_shd.g_old_rec.candidate_information1, hr_api.g_varchar2) <>
809 nvl(p_rec.candidate_information1, hr_api.g_varchar2)  or
810 nvl(per_eca_shd.g_old_rec.candidate_information2, hr_api.g_varchar2) <>
811 nvl(p_rec.candidate_information2, hr_api.g_varchar2)  or
812 nvl(per_eca_shd.g_old_rec.candidate_information3, hr_api.g_varchar2) <>
813 nvl(p_rec.candidate_information3, hr_api.g_varchar2)  or
814 nvl(per_eca_shd.g_old_rec.candidate_information4, hr_api.g_varchar2) <>
815 nvl(p_rec.candidate_information4, hr_api.g_varchar2)  or
816 nvl(per_eca_shd.g_old_rec.candidate_information5, hr_api.g_varchar2) <>
817 nvl(p_rec.candidate_information5, hr_api.g_varchar2)  or
818 nvl(per_eca_shd.g_old_rec.candidate_information6, hr_api.g_varchar2) <>
819 nvl(p_rec.candidate_information6, hr_api.g_varchar2)  or
820 nvl(per_eca_shd.g_old_rec.candidate_information7, hr_api.g_varchar2) <>
821 nvl(p_rec.candidate_information7, hr_api.g_varchar2)  or
822 nvl(per_eca_shd.g_old_rec.candidate_information8, hr_api.g_varchar2) <>
823 nvl(p_rec.candidate_information8, hr_api.g_varchar2)  or
824 nvl(per_eca_shd.g_old_rec.candidate_information9, hr_api.g_varchar2) <>
825 nvl(p_rec.candidate_information9, hr_api.g_varchar2)  or
826 nvl(per_eca_shd.g_old_rec.candidate_information10, hr_api.g_varchar2) <>
827 nvl(p_rec.candidate_information10, hr_api.g_varchar2)  or
828 nvl(per_eca_shd.g_old_rec.candidate_information11, hr_api.g_varchar2) <>
829 nvl(p_rec.candidate_information11, hr_api.g_varchar2)  or
833 nvl(p_rec.candidate_information13, hr_api.g_varchar2)  or
830 nvl(per_eca_shd.g_old_rec.candidate_information12, hr_api.g_varchar2) <>
831 nvl(p_rec.candidate_information12, hr_api.g_varchar2)  or
832 nvl(per_eca_shd.g_old_rec.candidate_information13, hr_api.g_varchar2) <>
834 nvl(per_eca_shd.g_old_rec.candidate_information14, hr_api.g_varchar2) <>
835 nvl(p_rec.candidate_information14, hr_api.g_varchar2)  or
836 nvl(per_eca_shd.g_old_rec.candidate_information15, hr_api.g_varchar2) <>
837 nvl(p_rec.candidate_information15, hr_api.g_varchar2)  or
838 nvl(per_eca_shd.g_old_rec.candidate_information16, hr_api.g_varchar2) <>
839 nvl(p_rec.candidate_information16, hr_api.g_varchar2)  or
840 nvl(per_eca_shd.g_old_rec.candidate_information17, hr_api.g_varchar2) <>
841 nvl(p_rec.candidate_information17, hr_api.g_varchar2)  or
842 nvl(per_eca_shd.g_old_rec.candidate_information18, hr_api.g_varchar2) <>
843 nvl(p_rec.candidate_information18, hr_api.g_varchar2)  or
844 nvl(per_eca_shd.g_old_rec.candidate_information19, hr_api.g_varchar2) <>
845 nvl(p_rec.candidate_information19, hr_api.g_varchar2)  or
846 nvl(per_eca_shd.g_old_rec.candidate_information20, hr_api.g_varchar2) <>
847 nvl(p_rec.candidate_information20, hr_api.g_varchar2)  or
848 nvl(per_eca_shd.g_old_rec.candidate_information21, hr_api.g_varchar2) <>
849 nvl(p_rec.candidate_information21, hr_api.g_varchar2)  or
850 nvl(per_eca_shd.g_old_rec.candidate_information22, hr_api.g_varchar2) <>
851 nvl(p_rec.candidate_information22, hr_api.g_varchar2)  or
852 nvl(per_eca_shd.g_old_rec.candidate_information23, hr_api.g_varchar2) <>
853 nvl(p_rec.candidate_information23, hr_api.g_varchar2)  or
854 nvl(per_eca_shd.g_old_rec.candidate_information24, hr_api.g_varchar2) <>
855 nvl(p_rec.candidate_information24, hr_api.g_varchar2)  or
856 nvl(per_eca_shd.g_old_rec.candidate_information25, hr_api.g_varchar2) <>
857 nvl(p_rec.candidate_information25, hr_api.g_varchar2)  or
858 nvl(per_eca_shd.g_old_rec.candidate_information26, hr_api.g_varchar2) <>
859 nvl(p_rec.candidate_information26, hr_api.g_varchar2)  or
860 nvl(per_eca_shd.g_old_rec.candidate_information27, hr_api.g_varchar2) <>
861 nvl(p_rec.candidate_information27, hr_api.g_varchar2)  or
862 nvl(per_eca_shd.g_old_rec.candidate_information28, hr_api.g_varchar2) <>
863 nvl(p_rec.candidate_information28, hr_api.g_varchar2)  or
864 nvl(per_eca_shd.g_old_rec.candidate_information29, hr_api.g_varchar2) <>
865 nvl(p_rec.candidate_information29, hr_api.g_varchar2)  or
866 nvl(per_eca_shd.g_old_rec.candidate_information30, hr_api.g_varchar2) <>
867 nvl(p_rec.candidate_information30, hr_api.g_varchar2) ))
868 or (p_rec.election_candidate_id is null)  then
869 --
870 -- Only execute the validation if absolutely necessary:
871 -- a) During update, the structure column value or any
872 --    of the attribute values have actually changed.
873 -- b) During insert.
874 --
875 hr_dflex_utility.ins_or_upd_descflex_attribs
876 (p_appl_short_name                 => 'PER'
877 ,p_descflex_name                   => 'Candidates Developer DF'
878 ,p_attribute_category              => p_rec.candidate_info_category
879 ,p_attribute1_name                 => 'CANDIDATE_INFORMATION1'
880 ,p_attribute1_value                => p_rec.candidate_information1
881 ,p_attribute2_name                 => 'CANDIDATE_INFORMATION2'
882 ,p_attribute2_value                => p_rec.candidate_information2
883 ,p_attribute3_name                 => 'CANDIDATE_INFORMATION3'
884 ,p_attribute3_value                => p_rec.candidate_information3
885 ,p_attribute4_name                 => 'CANDIDATE_INFORMATION4'
886 ,p_attribute4_value                => p_rec.candidate_information4
887 ,p_attribute5_name                 => 'CANDIDATE_INFORMATION5'
888 ,p_attribute5_value                => p_rec.candidate_information5
889 ,p_attribute6_name                 => 'CANDIDATE_INFORMATION6'
890 ,p_attribute6_value                => p_rec.candidate_information6
891 ,p_attribute7_name                 => 'CANDIDATE_INFORMATION7'
892 ,p_attribute7_value                => p_rec.candidate_information7
893 ,p_attribute8_name                 => 'CANDIDATE_INFORMATION8'
894 ,p_attribute8_value                => p_rec.candidate_information8
895 ,p_attribute9_name                 => 'CANDIDATE_INFORMATION9'
896 ,p_attribute9_value                => p_rec.candidate_information9
897 ,p_attribute10_name                => 'CANDIDATE_INFORMATION10'
898 ,p_attribute10_value               => p_rec.candidate_information10
899 ,p_attribute11_name                => 'CANDIDATE_INFORMATION11'
900 ,p_attribute11_value               => p_rec.candidate_information11
901 ,p_attribute12_name                => 'CANDIDATE_INFORMATION12'
902 ,p_attribute12_value               => p_rec.candidate_information12
903 ,p_attribute13_name                => 'CANDIDATE_INFORMATION13'
904 ,p_attribute13_value               => p_rec.candidate_information13
905 ,p_attribute14_name                => 'CANDIDATE_INFORMATION14'
906 ,p_attribute14_value               => p_rec.candidate_information14
907 ,p_attribute15_name                => 'CANDIDATE_INFORMATION15'
908 ,p_attribute15_value               => p_rec.candidate_information15
909 ,p_attribute16_name                => 'CANDIDATE_INFORMATION16'
910 ,p_attribute16_value               => p_rec.candidate_information16
911 ,p_attribute17_name                => 'CANDIDATE_INFORMATION17'
912 ,p_attribute17_value               => p_rec.candidate_information17
913 ,p_attribute18_name                => 'CANDIDATE_INFORMATION18'
914 ,p_attribute18_value               => p_rec.candidate_information18
915 ,p_attribute19_name                => 'CANDIDATE_INFORMATION19'
916 ,p_attribute19_value               => p_rec.candidate_information19
917 ,p_attribute20_name                => 'CANDIDATE_INFORMATION20'
918 ,p_attribute20_value               => p_rec.candidate_information20
919 ,p_attribute21_name                => 'CANDIDATE_INFORMATION21'
920 ,p_attribute21_value               => p_rec.candidate_information21
921 ,p_attribute22_name                => 'CANDIDATE_INFORMATION22'
925 ,p_attribute24_name                => 'CANDIDATE_INFORMATION24'
922 ,p_attribute22_value               => p_rec.candidate_information22
923 ,p_attribute23_name                => 'CANDIDATE_INFORMATION23'
924 ,p_attribute23_value               => p_rec.candidate_information23
926 ,p_attribute24_value               => p_rec.candidate_information24
927 ,p_attribute25_name                => 'CANDIDATE_INFORMATION25'
928 ,p_attribute25_value               => p_rec.candidate_information25
929 ,p_attribute26_name                => 'CANDIDATE_INFORMATION26'
930 ,p_attribute26_value               => p_rec.candidate_information26
931 ,p_attribute27_name                => 'CANDIDATE_INFORMATION27'
932 ,p_attribute27_value               => p_rec.candidate_information27
933 ,p_attribute28_name                => 'CANDIDATE_INFORMATION28'
934 ,p_attribute28_value               => p_rec.candidate_information28
935 ,p_attribute29_name                => 'CANDIDATE_INFORMATION29'
936 ,p_attribute29_value               => p_rec.candidate_information29
937 ,p_attribute30_name                => 'CANDIDATE_INFORMATION30'
938 ,p_attribute30_value               => p_rec.candidate_information30
939 );
940 end if;
941 --
942 hr_utility.set_location(' Leaving:'||l_proc,20);
943 end chk_ddf;
944 --
945 -- ----------------------------------------------------------------------------
946 -- |---------------------------< insert_validate >----------------------------|
947 -- ----------------------------------------------------------------------------
948 Procedure insert_validate
949 (p_rec                   in per_eca_shd.g_rec_type
950 ) is
951 --
952 l_proc                varchar2(72) := g_package||'insert_validate';
953 --
954 --
955 Begin
956 hr_utility.set_location('Entering:'||l_proc, 5);
957 --
958 -- Validate PERSON_ID
959 --
960 per_eca_bus.chk_person_id
961 (p_person_id              =>  p_rec.person_id
962 );
963 
964 --
965 -- Validate business_group_id
966 --
967 hr_api.validate_bus_grp_id(p_rec.business_group_id);
968 --
969 -- Validate election_id
970 --
971 per_eca_bus.chk_election_id
972 (p_election_id           => p_rec.election_id
973 );
974 --
975 -- Validate duplicate candidate for an election
976 --
977 chk_duplicate_candidate
978   (p_election_id	=> p_rec.election_id
979   ,p_person_id		=> p_rec.person_id
980   ,p_election_candidate_id => p_rec.election_candidate_id
981   );
982 --
983 -- Validate role_id
984 --
985 if p_rec.role_id is not null then
986 per_eca_bus.chk_role_id
987 (p_role_id               => p_rec.role_id
988 );
989 end if;
990 
991 --
992 -- Validate DFs
993   per_eca_bus.chk_ddf(p_rec);
994 --
995 -- Validate DDFs
996   per_eca_bus.chk_df(p_rec);
997 --
998 hr_utility.set_location(' Leaving:'||l_proc, 10);
999 End insert_validate;
1000 --
1001 -- ----------------------------------------------------------------------------
1002 -- |---------------------------< update_validate >----------------------------|
1003 -- ----------------------------------------------------------------------------
1004 Procedure update_validate
1005 (p_rec                   in per_eca_shd.g_rec_type
1006 ) is
1007 --
1008 l_proc                varchar2(72) := g_package||'insert_validate';
1009 --
1010 --
1011 Begin
1012 hr_utility.set_location('Entering:'||l_proc, 5);
1013 --
1014 -- Validate PERSON_ID
1015 --
1016 per_eca_bus.chk_person_id
1017 (p_person_id              =>  p_rec.person_id
1018 );
1019 
1020 --
1021 -- Validate business_group_id
1022 --
1023 hr_api.validate_bus_grp_id(p_rec.business_group_id);
1024 --
1025 -- Validate election_id
1026 --
1027 per_eca_bus.chk_election_id
1028 (p_election_id           => p_rec.election_id
1029 );
1030 --
1031 -- Validate duplicate candidate for an election
1032 --
1033 chk_duplicate_candidate
1034   (p_election_id        => p_rec.election_id
1035   ,p_person_id          => p_rec.person_id
1036   ,p_election_candidate_id => p_rec.election_candidate_id
1037   );
1038 --
1039 -- Validate role_id
1040 --
1041 if p_rec.role_id is not null then
1042 per_eca_bus.chk_role_id
1043 (p_role_id               => p_rec.role_id
1044 );
1045 end if;
1046 
1047 --
1048 --
1049 -- Validate DFs
1050   per_eca_bus.chk_df(p_rec);
1051 --
1052 -- Validate DDFs
1053   per_eca_bus.chk_ddf(p_rec);
1054 --
1055 hr_utility.set_location(' Leaving:'||l_proc, 10);
1056 End update_validate;
1057 end per_eca_bus;