[Home] [Help]
PACKAGE BODY: APPS.PER_ECO_BUS
Source
1 Package Body per_eco_bus as
2 /* $Header: peecorhi.pkb 115.7 2002/12/05 10:37:50 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_eco_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_constituency_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |--------------------------< chk_election_id >---------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 -- Description:
21 -- - Validates that a election id exists in table per_elections.
22 -- - Checks that the election_id is not null
23 --
24 -- Pre-conditions:
25 -- None.
26 --
27 -- In Arguments:
28 -- p_election_id
29 --
30 --
31 -- Post Success:
32 -- If a row does exist in per_elections for the given election id then
33 -- processing continues.
34 --
35 -- Post Failure:
36 -- If a row does not exist in per_elections for the given election id
37 -- then an application error will be raised and processing is terminated.
38 --
39 -- Access Status:
40 -- Internal Table Handler Use Only.
41 --
42 -- {End Of Comments}
43 -- ----------------------------------------------------------------------------
44 procedure chk_election_id
45 (p_election_id in per_election_constituencys.election_id%TYPE
46 ,p_election_constituency_id in per_election_constituencys.election_constituency_id%TYPE
47 ,p_object_version_number in per_election_constituencys.object_version_number%TYPE
48 )
49 is
50 --
51 l_proc varchar2(72) := g_package||'chk_election_id';
52 --
53 l_api_updating boolean;
54 l_election_id number;
55 --
56 cursor csr_valid_election_id is
57 select election_id
58 from per_elections pe
59 where pe.election_id = p_election_id;
60
61 begin
62 hr_utility.set_location('Entering:'|| l_proc, 10);
63 --
64 -- Check mandatory parameters have been set
65 --
66 hr_api.mandatory_arg_error
67 (p_api_name => l_proc
68 ,p_argument => 'election_id'
69 ,p_argument_value => p_election_id
70 );
71 --
72 hr_utility.set_location(l_proc, 20);
73 --
74 -- Check if inserting or updating with modified values
75 --
76 l_api_updating := per_eco_shd.api_updating
77 (p_election_constituency_id => p_election_constituency_id
78 ,p_object_version_number => p_object_version_number
79 );
80 --
81 if ((l_api_updating and per_eco_shd.g_old_rec.election_id <> p_election_id)
82 or
83 (NOT l_api_updating))
84 then
85 hr_utility.set_location(l_proc, 30);
86 --
87 -- Check that the Election ID is linked to a
88 -- valid election_id on per_elections
89 --
90 open csr_valid_election_id;
91 fetch csr_valid_election_id into l_election_id;
92 if csr_valid_election_id%notfound then
93 --
94 close csr_valid_election_id;
95 fnd_message.set_name('PER', 'PER_289099_ECO_ELEC_ID_INVALID');
96 hr_utility.raise_error;
97 --
98 else
99 close csr_valid_election_id;
100
101 end if;
102 end if;
103 --
104 hr_utility.set_location(' Leaving:'|| l_proc, 40);
105 end chk_election_id;
106 --
107 -- ---------------------------------------------------------------------------
108 -- |-------------------< chk_duplicate_constituency >-----------------------|
109 -- ---------------------------------------------------------------------------
110 --
111 -- Description:
112 -- - Validates that a constituency does not already exist for this election.
113 --
114 -- Pre-conditions:
115 -- None.
116 --
117 -- In Arguments:
118 -- p_election_id
119 -- p_constituency_id
120 --
121 -- Post Success:
122 -- If a constituency does not exist for this election then processing continues.
123 --
124 -- Post Failure:
125 -- If a constituency already exists for the election then
126 -- an application error will be raised and processing is terminated.
127 --
128 -- Access Status:
129 -- Internal Table Handler Use Only.
130 --
131 -- {End Of Comments}
132 -- ----------------------------------------------------------------------------
133 procedure chk_duplicate_constituency
134 (p_election_id in per_election_constituencys.election_id%TYPE
135 ,p_constituency_id in per_election_constituencys.constituency_id%TYPE
136 ,p_election_constituency_id in per_election_constituencys.election_constituency_id%TYPE
137 )
138 is
139 --
140 l_proc varchar2(72) := g_package||'chk_duplicate_constituency';
141 --
142 l_constituency_id number;
143 --
144 cursor csr_valid_constituency is
145 select election_constituency_id
146 from per_election_constituencys
147 where election_id = p_election_id
148 and constituency_id = p_constituency_id;
149 --
150 begin
151
152 hr_utility.set_location('Entering:'|| l_proc, 10);
153 --
154 -- Check mandatory parameters have been set
155 --
156 hr_api.mandatory_arg_error
157 (p_api_name => l_proc
158 ,p_argument => 'election_id'
159 ,p_argument_value => p_election_id
160 );
161 --
162 hr_api.mandatory_arg_error
163 (p_api_name => l_proc
164 ,p_argument => 'constituency_id'
165 ,p_argument_value => p_constituency_id
166 );
167 --
168 hr_utility.set_location(l_proc, 20);
169 --
170 -- Check that the candidate has not been entered for this election before
171 --
172 open csr_valid_constituency;
173 fetch csr_valid_constituency into l_constituency_id;
174 if csr_valid_constituency%found then
175 --
176 if p_election_constituency_id is null or
177 p_election_constituency_id <> l_constituency_id then
178 hr_utility.set_location(l_proc, 30);
179 fnd_message.set_name('PER', 'HR_289258_ECO_DUP_CONSTITUENCY');
180 hr_utility.raise_error;
181 --
182 end if;
183 end if;
184 --
185 close csr_valid_constituency;
186 --
187 hr_utility.set_location(' Leaving:'|| l_proc, 50);
188 end chk_duplicate_constituency;
189 --
190 -- ---------------------------------------------------------------------------
191 -- |---------------------------< chk_can_delete >---------------------------|
192 -- ---------------------------------------------------------------------------
193 --
194 -- Description:
195 --
196 -- Pre-conditions:
197 -- None.
198 --
199 -- In Arguments:
200 -- p_election_id
201 --
202 --
203 -- Post Success:
204 --
205 -- Post Failure:
206 --
207 -- Access Status:
208 -- Internal Table Handler Use Only.
209 --
210 -- {End Of Comments}
211 -- ----------------------------------------------------------------------------
212 procedure chk_can_delete
213 (p_election_constituency_id in per_election_constituencys.election_constituency_id%TYPE
214 ,p_election_id in per_election_constituencys.election_id%TYPE
215 ,p_object_version_number in per_election_constituencys.object_version_number%TYPE
216 )
217 is
218 --
219 l_proc varchar2(72) := g_package||'chk_can_exists';
220 --
221 l_api_updating boolean;
222 l_election_id_a number;
223 l_election_id_b number;
224 --
225 --
226 cursor csr_valid_can_exists is
227 select pec.election_id
228 from per_election_candidates pec
229 where pec.election_id = p_election_id;
230 --
231 begin
232 hr_utility.set_location(l_proc, 20);
233 --
234 hr_utility.set_location(l_proc, 30);
235 --
236 -- Check that the Election ID is not linked to a
237 -- valid candidate on per_election_candidates
238 --
239 open csr_valid_can_exists;
240 fetch csr_valid_can_exists into l_election_id_a;
241 if csr_valid_can_exists%found then
242 --
243 close csr_valid_can_exists;
244 fnd_message.set_name('PER', 'PER_289109_ECO_ID_CAN_EXISTS');
245 hr_utility.raise_error;
246 --
247 end if;
248 close csr_valid_can_exists;
249 --
250 hr_utility.set_location(' Leaving:'|| l_proc, 40);
251 end chk_can_delete;
252 --
253 -- ---------------------------------------------------------------------------
254 -- |------------------------< chk_constituency_id >-------------------------|
255 -- ---------------------------------------------------------------------------
256 --
257 -- Description:
258 -- - Validates that a constituency id exists in table
259 -- HR_ALL_ORGANIZATION_UNITS.
260 -- - Validates that the constituency compares with that in
261 -- table HR_ORGANIZATION_INFORMATION
262 --
263 -- Pre-conditions:
264 -- None.
265 --
266 -- In Arguments:
267 -- p_constituency_id
268 --
269 --
270 -- Post Success:
271 -- If a row does exist in HR_ALL_ORGANIZATION_UNITS for the given
272 -- constituency id then processing continues.
273 --
274 -- Post Failure:
275 -- If a row does not exist in HR_ALL_ORGANIZATION_UNITS for the given
276 -- constituency id then an application error will be raised and
277 -- processing is terminated.
278 --
279 -- Access Status:
280 -- Internal Table Handler Use Only.
281 --
282 -- {End Of Comments}
283 -- ----------------------------------------------------------------------------
284 procedure chk_constituency_id
285 (p_constituency_id in per_election_constituencys.election_id%TYPE
286 ,p_election_constituency_id in per_election_constituencys.election_constituency_id%TYPE
287 ,p_object_version_number in per_election_constituencys.object_version_number%TYPE
288 )
289 is
290 --
291 l_proc varchar2(72) := g_package||'chk_constituency_id';
292 --
293 l_api_updating boolean;
294 l_constituency_id number;
295 --
296 cursor csr_valid_const_id is
297 select haou.organization_id
298 from hr_all_organization_units haou
299 where haou.organization_id = p_constituency_id
300 and exists(select 1
301 from hr_organization_information hoi
302 where hoi.org_information_context='CLASS'
303 and hoi.org_information1='CONSTITUENCY'
304 and hoi.org_information2='Y');
305 --
306 begin
307 hr_utility.set_location('Entering:'|| l_proc, 10);
308 --
309 -- Check mandatory parameters have been set
310 --
311 hr_api.mandatory_arg_error
312 (p_api_name => l_proc
313 ,p_argument => 'constituency_id'
314 ,p_argument_value => p_constituency_id
315 );
316 --
317 hr_utility.set_location(l_proc, 20);
318 --
319 -- Check if inserting or updating with modified values
320 --
321 l_api_updating := per_eco_shd.api_updating
322 (p_election_constituency_id => p_election_constituency_id
323 ,p_object_version_number => p_object_version_number
324 );
325 --
326 if ((l_api_updating and per_eco_shd.g_old_rec.constituency_id <> p_constituency_id)
327 or
328 (NOT l_api_updating))
329 then
330 hr_utility.set_location(l_proc, 30);
331 --
332 -- Check that the Constituency ID is linked to a
333 -- valid representative on hr_organiztion_information
334 --
335 open csr_valid_const_id;
336 fetch csr_valid_const_id into l_constituency_id;
337 if csr_valid_const_id%notfound then
338 --
339 close csr_valid_const_id;
340 fnd_message.set_name('PER', 'PER_289100_ECO_CONST_INVALID');
341 hr_utility.raise_error;
342 --
343 end if;
344 --
345 close csr_valid_const_id;
346 end if;
347 --
348 hr_utility.set_location(' Leaving:'|| l_proc, 40);
349 end chk_constituency_id;
350 --
351 -- ---------------------------------------------------------------------------
352 -- |----------------------< set_security_group_id >--------------------------|
353 -- ---------------------------------------------------------------------------
354 --
355 Procedure set_security_group_id
356 (p_election_constituency_id in number
357 ) is
358 --
359 -- Declare cursor
360 --
361 cursor csr_sec_grp is
362 select pbg.security_group_id
363 from per_business_groups pbg
364 , per_election_constituencys eco
365 where eco.election_constituency_id = p_election_constituency_id
366 and pbg.business_group_id = eco.business_group_id;
367 --
368 -- Declare local variables
369 --
370 l_security_group_id number;
371 l_proc varchar2(72) := g_package||'set_security_group_id';
372 --
373 begin
374 --
375 hr_utility.set_location('Entering:'|| l_proc, 10);
376 --
377 -- Ensure that all the mandatory parameter are not null
378 --
379 hr_api.mandatory_arg_error
380 (p_api_name => l_proc
381 ,p_argument => 'election_constituency_id'
382 ,p_argument_value => p_election_constituency_id
383 );
384 --
385 open csr_sec_grp;
386 fetch csr_sec_grp into l_security_group_id;
387 --
388 if csr_sec_grp%notfound then
389 --
390 close csr_sec_grp;
391 --
392 -- The primary key is invalid therefore we must error
393 --
394 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
395 fnd_message.raise_error;
396 --
397 end if;
398 close csr_sec_grp;
399 --
400 -- Set the security_group_id in CLIENT_INFO
401 --
402 hr_api.set_security_group_id
403 (p_security_group_id => l_security_group_id
404 );
405 --
406 hr_utility.set_location(' Leaving:'|| l_proc, 20);
407 --
408 end set_security_group_id;
409 --
410 -- ---------------------------------------------------------------------------
411 -- |---------------------< return_legislation_code >-------------------------|
412 -- ---------------------------------------------------------------------------
413 --
414 Function return_legislation_code
415 (p_election_constituency_id in number
416 )
417 Return Varchar2 Is
418 --
419 -- Declare cursor
420 --
421 cursor csr_leg_code is
422 select pbg.legislation_code
423 from per_business_groups pbg
424 , per_election_constituencys eco
425 where eco.election_constituency_id = p_election_constituency_id
426 and pbg.business_group_id = eco.business_group_id;
427 --
428 -- Declare local variables
429 --
430 l_legislation_code varchar2(150);
431 l_proc varchar2(72) := g_package||'return_legislation_code';
432 --
433 Begin
434 --
435 hr_utility.set_location('Entering:'|| l_proc, 10);
436 --
437 -- Ensure that all the mandatory parameter are not null
438 --
439 hr_api.mandatory_arg_error
440 (p_api_name => l_proc
441 ,p_argument => 'election_constituency_id'
442 ,p_argument_value => p_election_constituency_id
443 );
444 --
445 if ( nvl(per_eco_bus.g_election_constituency_id, hr_api.g_number)
446 = p_election_constituency_id) then
447 --
448 -- The legislation code has already been found with a previous
449 -- call to this function. Just return the value in the global
450 -- variable.
451 --
452 l_legislation_code := per_eco_bus.g_legislation_code;
453 hr_utility.set_location(l_proc, 20);
457 -- or this is the first call to this function.
454 else
455 --
456 -- The ID is different to the last call to this function
458 --
459 open csr_leg_code;
460 fetch csr_leg_code into l_legislation_code;
461 --
462 if csr_leg_code%notfound then
463 --
464 -- The primary key is invalid therefore we must error
465 --
466 close csr_leg_code;
467 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
468 fnd_message.raise_error;
469 end if;
470 hr_utility.set_location(l_proc,30);
471 --
472 -- Set the global variables so the values are
473 -- available for the next call to this function.
474 --
475 close csr_leg_code;
476 per_eco_bus.g_election_constituency_id:= p_election_constituency_id;
477 per_eco_bus.g_legislation_code := l_legislation_code;
478 end if;
479 hr_utility.set_location(' Leaving:'|| l_proc, 40);
480 return l_legislation_code;
481 end return_legislation_code;
482 --
483 -- ----------------------------------------------------------------------------
484 -- |------------------------------< chk_df >----------------------------------|
485 -- ----------------------------------------------------------------------------
486 --
487 -- Description:
488 -- Validates all the Descriptive Flexfield values.
489 --
490 -- Prerequisites:
491 -- All other columns have been validated. Must be called as the
492 -- last step from insert_validate and update_validate.
493 --
494 -- In Arguments:
495 -- p_rec
496 --
497 -- Post Success:
498 -- If the Descriptive Flexfield structure column and data values are
499 -- all valid this procedure will end normally and processing will
500 -- continue.
501 --
502 -- Post Failure:
503 -- If the Descriptive Flexfield structure column value or any of
504 -- the data values are invalid then an application error is raised as
505 -- a PL/SQL exception.
506 --
507 -- Access Status:
508 -- Internal Row Handler Use Only.
509 --
510 -- ----------------------------------------------------------------------------
511 procedure chk_df
512 (p_rec in per_eco_shd.g_rec_type
513 ) is
514 --
515 l_proc varchar2(72) := g_package || 'chk_df';
516 --
517 begin
518 hr_utility.set_location('Entering:'||l_proc,10);
519 --
520 if ((p_rec.election_constituency_id is not null) and (
521 nvl(per_eco_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
522 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
523 nvl(per_eco_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
524 nvl(p_rec.attribute1, hr_api.g_varchar2) or
525 nvl(per_eco_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
526 nvl(p_rec.attribute2, hr_api.g_varchar2) or
527 nvl(per_eco_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
528 nvl(p_rec.attribute3, hr_api.g_varchar2) or
529 nvl(per_eco_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
530 nvl(p_rec.attribute4, hr_api.g_varchar2) or
531 nvl(per_eco_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
532 nvl(p_rec.attribute5, hr_api.g_varchar2) or
533 nvl(per_eco_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
534 nvl(p_rec.attribute6, hr_api.g_varchar2) or
535 nvl(per_eco_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
536 nvl(p_rec.attribute7, hr_api.g_varchar2) or
537 nvl(per_eco_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
538 nvl(p_rec.attribute8, hr_api.g_varchar2) or
539 nvl(per_eco_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
540 nvl(p_rec.attribute9, hr_api.g_varchar2) or
541 nvl(per_eco_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
542 nvl(p_rec.attribute10, hr_api.g_varchar2) or
543 nvl(per_eco_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
544 nvl(p_rec.attribute11, hr_api.g_varchar2) or
545 nvl(per_eco_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
546 nvl(p_rec.attribute12, hr_api.g_varchar2) or
547 nvl(per_eco_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
548 nvl(p_rec.attribute13, hr_api.g_varchar2) or
549 nvl(per_eco_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
550 nvl(p_rec.attribute14, hr_api.g_varchar2) or
551 nvl(per_eco_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
552 nvl(p_rec.attribute15, hr_api.g_varchar2) or
553 nvl(per_eco_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
554 nvl(p_rec.attribute16, hr_api.g_varchar2) or
555 nvl(per_eco_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
556 nvl(p_rec.attribute17, hr_api.g_varchar2) or
557 nvl(per_eco_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
558 nvl(p_rec.attribute18, hr_api.g_varchar2) or
559 nvl(per_eco_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
560 nvl(p_rec.attribute19, hr_api.g_varchar2) or
561 nvl(per_eco_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
562 nvl(p_rec.attribute20, hr_api.g_varchar2) or
563 nvl(per_eco_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
564 nvl(p_rec.attribute21, hr_api.g_varchar2) or
565 nvl(per_eco_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
566 nvl(p_rec.attribute22, hr_api.g_varchar2) or
567 nvl(per_eco_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
568 nvl(p_rec.attribute23, hr_api.g_varchar2) or
572 nvl(p_rec.attribute25, hr_api.g_varchar2) or
569 nvl(per_eco_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
570 nvl(p_rec.attribute24, hr_api.g_varchar2) or
571 nvl(per_eco_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
573 nvl(per_eco_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
574 nvl(p_rec.attribute26, hr_api.g_varchar2) or
575 nvl(per_eco_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
576 nvl(p_rec.attribute27, hr_api.g_varchar2) or
577 nvl(per_eco_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
578 nvl(p_rec.attribute28, hr_api.g_varchar2) or
579 nvl(per_eco_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
580 nvl(p_rec.attribute29, hr_api.g_varchar2) or
581 nvl(per_eco_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
582 nvl(p_rec.attribute30, hr_api.g_varchar2) ))
583 or (p_rec.election_constituency_id is null) then
584 --
585 -- Only execute the validation if absolutely necessary:
586 -- a) During update, the structure column value or any
587 -- of the attribute values have actually changed.
588 -- b) During insert.
589 --
590 hr_dflex_utility.ins_or_upd_descflex_attribs
591 (p_appl_short_name => 'PER'
592 ,p_descflex_name => 'PER_ELECTION_CONSTITUENCYS'
593 ,p_attribute_category => p_rec.ATTRIBUTE_CATEGORY
594 ,p_attribute1_name => 'ATTRIBUTE1'
595 ,p_attribute1_value => p_rec.attribute1
596 ,p_attribute2_name => 'ATTRIBUTE2'
597 ,p_attribute2_value => p_rec.attribute2
598 ,p_attribute3_name => 'ATTRIBUTE3'
599 ,p_attribute3_value => p_rec.attribute3
600 ,p_attribute4_name => 'ATTRIBUTE4'
601 ,p_attribute4_value => p_rec.attribute4
602 ,p_attribute5_name => 'ATTRIBUTE5'
603 ,p_attribute5_value => p_rec.attribute5
604 ,p_attribute6_name => 'ATTRIBUTE6'
605 ,p_attribute6_value => p_rec.attribute6
606 ,p_attribute7_name => 'ATTRIBUTE7'
607 ,p_attribute7_value => p_rec.attribute7
608 ,p_attribute8_name => 'ATTRIBUTE8'
609 ,p_attribute8_value => p_rec.attribute8
610 ,p_attribute9_name => 'ATTRIBUTE9'
611 ,p_attribute9_value => p_rec.attribute9
612 ,p_attribute10_name => 'ATTRIBUTE10'
613 ,p_attribute10_value => p_rec.attribute10
614 ,p_attribute11_name => 'ATTRIBUTE11'
615 ,p_attribute11_value => p_rec.attribute11
616 ,p_attribute12_name => 'ATTRIBUTE12'
617 ,p_attribute12_value => p_rec.attribute12
618 ,p_attribute13_name => 'ATTRIBUTE13'
619 ,p_attribute13_value => p_rec.attribute13
620 ,p_attribute14_name => 'ATTRIBUTE14'
621 ,p_attribute14_value => p_rec.attribute14
622 ,p_attribute15_name => 'ATTRIBUTE15'
623 ,p_attribute15_value => p_rec.attribute15
624 ,p_attribute16_name => 'ATTRIBUTE16'
625 ,p_attribute16_value => p_rec.attribute16
626 ,p_attribute17_name => 'ATTRIBUTE17'
627 ,p_attribute17_value => p_rec.attribute17
628 ,p_attribute18_name => 'ATTRIBUTE18'
629 ,p_attribute18_value => p_rec.attribute18
630 ,p_attribute19_name => 'ATTRIBUTE19'
631 ,p_attribute19_value => p_rec.attribute19
632 ,p_attribute20_name => 'ATTRIBUTE20'
633 ,p_attribute20_value => p_rec.attribute20
634 ,p_attribute21_name => 'ATTRIBUTE21'
635 ,p_attribute21_value => p_rec.attribute21
636 ,p_attribute22_name => 'ATTRIBUTE22'
637 ,p_attribute22_value => p_rec.attribute22
638 ,p_attribute23_name => 'ATTRIBUTE23'
639 ,p_attribute23_value => p_rec.attribute23
640 ,p_attribute24_name => 'ATTRIBUTE24'
641 ,p_attribute24_value => p_rec.attribute24
642 ,p_attribute25_name => 'ATTRIBUTE25'
643 ,p_attribute25_value => p_rec.attribute25
644 ,p_attribute26_name => 'ATTRIBUTE26'
645 ,p_attribute26_value => p_rec.attribute26
646 ,p_attribute27_name => 'ATTRIBUTE27'
647 ,p_attribute27_value => p_rec.attribute27
648 ,p_attribute28_name => 'ATTRIBUTE28'
649 ,p_attribute28_value => p_rec.attribute28
650 ,p_attribute29_name => 'ATTRIBUTE29'
651 ,p_attribute29_value => p_rec.attribute29
652 ,p_attribute30_name => 'ATTRIBUTE30'
653 ,p_attribute30_value => p_rec.attribute30
654 );
655 end if;
656 --
657 hr_utility.set_location(' Leaving:'||l_proc,20);
658 end chk_df;
659 --
660 -- ----------------------------------------------------------------------------
661 -- |-----------------------< chk_non_updateable_args >------------------------|
662 -- ----------------------------------------------------------------------------
666 -- This procedure is used to ensure that non updateable attributes have
663 -- {Start Of Comments}
664 --
665 -- Description:
667 -- not been updated. If an attribute has been updated an error is generated.
668 --
669 -- Pre Conditions:
670 -- g_old_rec has been populated with details of the values currently in
671 -- the database.
672 --
673 -- In Arguments:
674 -- p_rec has been populated with the updated values the user would like the
675 -- record set to.
676 --
677 -- Post Success:
678 -- Processing continues if all the non updateable attributes have not
679 -- changed.
680 --
681 -- Post Failure:
682 -- An application error is raised if any of the non updatable attributes
683 -- have been altered.
684 --
685 -- {End Of Comments}
686 -- ----------------------------------------------------------------------------
687 Procedure chk_non_updateable_args
688 (p_effective_date in date
689 ,p_rec in per_eco_shd.g_rec_type
690 ) IS
691 --
692 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
693 l_error EXCEPTION;
694 l_argument varchar2(30);
695 --
696 Begin
697 --
698 -- Only proceed with the validation if a row exists for the current
699 -- record in the HR Schema.
700 --
701 IF NOT per_eco_shd.api_updating
702 (p_election_constituency_id => p_rec.election_constituency_id
703 ,p_object_version_number => p_rec.object_version_number
704 ) THEN
705 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
706 fnd_message.set_token('PROCEDURE ', l_proc);
707 fnd_message.set_token('STEP ', '5');
708 fnd_message.raise_error;
709 END IF;
710 --
711 -- EDIT_HERE: Add checks to ensure non-updateable args have
712 -- not been updated.
713 --
714 EXCEPTION
715 WHEN l_error THEN
716 hr_api.argument_changed_error
717 (p_api_name => l_proc
718 ,p_argument => l_argument);
719 WHEN OTHERS THEN
720 RAISE;
721 End chk_non_updateable_args;
722 --
723 -- ----------------------------------------------------------------------------
724 -- |---------------------------< insert_validate >----------------------------|
725 -- ----------------------------------------------------------------------------
726 Procedure insert_validate
727 (p_effective_date in date
728 ,p_rec in per_eco_shd.g_rec_type
729 ) is
730 --
731 l_proc varchar2(72) := g_package||'insert_validate';
732 --
733 Begin
734 hr_utility.set_location('Entering:'||l_proc, 5);
735 --
736 -- Call all supporting business operations
737 --
738 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
739 --
740 hr_utility.set_location('Entering: chk_election_id',10);
741
742 chk_election_id
743 (p_election_id => p_rec.election_id
744 ,p_election_constituency_id => p_rec.election_constituency_id
745 ,p_object_version_number => p_rec.object_version_number
746 );
747
748 hr_utility.set_location('Entering: chk_constituency_id', 15);
749
750 chk_constituency_id
751 (p_constituency_id => p_rec.constituency_id
752 ,p_election_constituency_id => p_rec.election_constituency_id
753 ,p_object_version_number => p_rec.object_version_number
754 );
755
756 hr_utility.set_location('Entering: chk_duplicate_constituency', 15);
757 chk_duplicate_constituency
758 (p_election_id => p_rec.election_id
759 ,p_constituency_id => p_rec.constituency_id
760 ,p_election_constituency_id => p_rec.election_constituency_id
761 );
762 --
763 --
764 per_eco_bus.chk_df(p_rec);
765 --
766 hr_utility.set_location(' Leaving:'||l_proc, 20);
767 End insert_validate;
768 --
769 -- ----------------------------------------------------------------------------
770 -- |---------------------------< update_validate >----------------------------|
771 -- ----------------------------------------------------------------------------
772 Procedure update_validate
773 (p_effective_date in date
774 ,p_rec in per_eco_shd.g_rec_type
775 ) is
776 --
777 l_proc varchar2(72) := g_package||'update_validate';
778 --
779 Begin
780 hr_utility.set_location('Entering:'||l_proc, 5);
781 --
782 -- Call all supporting business operations
783 --
784 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
785 --
786 chk_non_updateable_args
787 (p_effective_date => p_effective_date
788 ,p_rec => p_rec
789 );
790 --
791 hr_utility.set_location('Entering: chk_election_id',10);
792
793 chk_election_id
794 (p_election_id => p_rec.election_id
795 ,p_election_constituency_id => p_rec.election_constituency_id
796 ,p_object_version_number => p_rec.object_version_number
797 );
798
799 hr_utility.set_location('Entering: chk_constituency_id', 15);
800
801 chk_constituency_id
802 (p_constituency_id => p_rec.constituency_id
803 ,p_election_constituency_id => p_rec.election_constituency_id
804 ,p_object_version_number => p_rec.object_version_number
805 );
806
807 hr_utility.set_location('Entering: chk_duplicate_constituency', 15);
808
809 chk_duplicate_constituency
810 (p_election_id => p_rec.election_id
811 ,p_constituency_id => p_rec.constituency_id
812 ,p_election_constituency_id => p_rec.election_constituency_id
813 );
814 --
815 per_eco_bus.chk_df(p_rec);
816 --
817 hr_utility.set_location(' Leaving:'||l_proc, 20);
818 End update_validate;
819 --
820 -- ----------------------------------------------------------------------------
821 -- |---------------------------< delete_validate >----------------------------|
822 -- ----------------------------------------------------------------------------
823 Procedure delete_validate
824 (p_rec in per_eco_shd.g_rec_type
825 ) is
826 --
827 l_proc varchar2(72) := g_package||'delete_validate';
828 --
829 Begin
830 hr_utility.set_location('Entering:'||l_proc, 5);
831 --
832 -- Call all supporting business operations
833 --
834 per_eco_bus.chk_can_delete
835 (p_election_constituency_id => p_rec.election_constituency_id
836 ,p_election_id => p_rec.election_id
837 ,p_object_version_number => p_rec.object_version_number
838 );
839 --
840 hr_utility.set_location(' Leaving:'||l_proc, 20);
841 End delete_validate;
842 --
843 end per_eco_bus;