DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_EGC_BUS

Source


1 Package Body hxc_egc_bus as
2 /* $Header: hxcegcrhi.pkb 120.2 2005/09/23 10:39:50 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_egc_bus.';  -- Global package name
9 g_debug    boolean	:= hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< chk_df >----------------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 --   Validates all the Descriptive Flexfield values.
17 --
18 -- Prerequisites:
19 --   All other columns have been validated.  Must be called as the
20 --   last step from insert_validate and update_validate.
21 --
22 -- In Arguments:
23 --   p_rec
24 --
25 -- Post Success:
26 --   If the Descriptive Flexfield structure column and data values are
27 --   all valid this procedure will end normally and processing will
28 --   continue.
29 --
30 -- Post Failure:
31 --   If the Descriptive Flexfield structure column value or any of
32 --   the data values are invalid then an application error is raised as
33 --   a PL/SQL exception.
34 --
35 -- Access Status:
36 --   Internal Row Handler Use Only.
37 --
38 -- ----------------------------------------------------------------------------
39 procedure chk_df
40   (p_rec in hxc_egc_shd.g_rec_type
41   ) is
42 --
43   l_proc   varchar2(72);
44 --
45 begin
46   g_debug:=hr_utility.debug_enabled;
47   if g_debug then
48 	l_proc := g_package || 'chk_df';
49 	hr_utility.set_location('Entering:'||l_proc,10);
50   end if;
51   --
52   if ((p_rec.entity_group_comp_id is not null)  and (
53     nvl(hxc_egc_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
54     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
55     nvl(hxc_egc_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
56     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
57     nvl(hxc_egc_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
58     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
59     nvl(hxc_egc_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
60     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
61     nvl(hxc_egc_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
62     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
66     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
63     nvl(hxc_egc_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
64     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
65     nvl(hxc_egc_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
67     nvl(hxc_egc_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
68     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
69     nvl(hxc_egc_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
70     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
71     nvl(hxc_egc_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
72     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
73     nvl(hxc_egc_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
74     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
75     nvl(hxc_egc_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
76     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
77     nvl(hxc_egc_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
78     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
79     nvl(hxc_egc_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
80     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
81     nvl(hxc_egc_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
82     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
83     nvl(hxc_egc_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
84     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
85     nvl(hxc_egc_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
86     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
87     nvl(hxc_egc_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
88     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
89     nvl(hxc_egc_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
90     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
91     nvl(hxc_egc_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
92     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
93     nvl(hxc_egc_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
94     nvl(p_rec.attribute20, hr_api.g_varchar2)  or
95     nvl(hxc_egc_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
96     nvl(p_rec.attribute21, hr_api.g_varchar2)  or
97     nvl(hxc_egc_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
98     nvl(p_rec.attribute22, hr_api.g_varchar2)  or
99     nvl(hxc_egc_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
100     nvl(p_rec.attribute23, hr_api.g_varchar2)  or
101     nvl(hxc_egc_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
102     nvl(p_rec.attribute24, hr_api.g_varchar2)  or
103     nvl(hxc_egc_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
104     nvl(p_rec.attribute25, hr_api.g_varchar2)  or
105     nvl(hxc_egc_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
106     nvl(p_rec.attribute26, hr_api.g_varchar2)  or
107     nvl(hxc_egc_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
108     nvl(p_rec.attribute27, hr_api.g_varchar2)  or
109     nvl(hxc_egc_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
110     nvl(p_rec.attribute28, hr_api.g_varchar2)  or
111     nvl(hxc_egc_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
112     nvl(p_rec.attribute29, hr_api.g_varchar2)  or
113     nvl(hxc_egc_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
114     nvl(p_rec.attribute30, hr_api.g_varchar2) ))
115     or (p_rec.entity_group_comp_id is null)  then
116     --
117     -- Only execute the validation if absolutely necessary:
118     -- a) During update, the structure column value or any
119     --    of the attribute values have actually changed.
120     -- b) During insert.
121     --
122     hr_dflex_utility.ins_or_upd_descflex_attribs
123       (p_appl_short_name                 => 'HXC'
124       ,p_descflex_name                   => 'OTC Entity Component Info'
125       ,p_attribute_category              => p_rec.entity_type
126       ,p_attribute1_name                 => 'ATTRIBUTE1'
127       ,p_attribute1_value                => p_rec.attribute1
128       ,p_attribute2_name                 => 'ATTRIBUTE2'
129       ,p_attribute2_value                => p_rec.attribute2
130       ,p_attribute3_name                 => 'ATTRIBUTE3'
131       ,p_attribute3_value                => p_rec.attribute3
132       ,p_attribute4_name                 => 'ATTRIBUTE4'
133       ,p_attribute4_value                => p_rec.attribute4
134       ,p_attribute5_name                 => 'ATTRIBUTE5'
135       ,p_attribute5_value                => p_rec.attribute5
136       ,p_attribute6_name                 => 'ATTRIBUTE6'
140       ,p_attribute8_name                 => 'ATTRIBUTE8'
137       ,p_attribute6_value                => p_rec.attribute6
138       ,p_attribute7_name                 => 'ATTRIBUTE7'
139       ,p_attribute7_value                => p_rec.attribute7
141       ,p_attribute8_value                => p_rec.attribute8
142       ,p_attribute9_name                 => 'ATTRIBUTE9'
143       ,p_attribute9_value                => p_rec.attribute9
144       ,p_attribute10_name                => 'ATTRIBUTE10'
145       ,p_attribute10_value               => p_rec.attribute10
146       ,p_attribute11_name                => 'ATTRIBUTE11'
147       ,p_attribute11_value               => p_rec.attribute11
148       ,p_attribute12_name                => 'ATTRIBUTE12'
149       ,p_attribute12_value               => p_rec.attribute12
150       ,p_attribute13_name                => 'ATTRIBUTE13'
151       ,p_attribute13_value               => p_rec.attribute13
152       ,p_attribute14_name                => 'ATTRIBUTE14'
153       ,p_attribute14_value               => p_rec.attribute14
154       ,p_attribute15_name                => 'ATTRIBUTE15'
155       ,p_attribute15_value               => p_rec.attribute15
156       ,p_attribute16_name                => 'ATTRIBUTE16'
157       ,p_attribute16_value               => p_rec.attribute16
158       ,p_attribute17_name                => 'ATTRIBUTE17'
159       ,p_attribute17_value               => p_rec.attribute17
160       ,p_attribute18_name                => 'ATTRIBUTE18'
161       ,p_attribute18_value               => p_rec.attribute18
162       ,p_attribute19_name                => 'ATTRIBUTE19'
163       ,p_attribute19_value               => p_rec.attribute19
164       ,p_attribute20_name                => 'ATTRIBUTE20'
165       ,p_attribute20_value               => p_rec.attribute20
166       ,p_attribute21_name                => 'ATTRIBUTE21'
167       ,p_attribute21_value               => p_rec.attribute21
168       ,p_attribute22_name                => 'ATTRIBUTE22'
169       ,p_attribute22_value               => p_rec.attribute22
170       ,p_attribute23_name                => 'ATTRIBUTE23'
171       ,p_attribute23_value               => p_rec.attribute23
172       ,p_attribute24_name                => 'ATTRIBUTE24'
173       ,p_attribute24_value               => p_rec.attribute24
174       ,p_attribute25_name                => 'ATTRIBUTE25'
175       ,p_attribute25_value               => p_rec.attribute25
176       ,p_attribute26_name                => 'ATTRIBUTE26'
177       ,p_attribute26_value               => p_rec.attribute26
178       ,p_attribute27_name                => 'ATTRIBUTE27'
179       ,p_attribute27_value               => p_rec.attribute27
180       ,p_attribute28_name                => 'ATTRIBUTE28'
181       ,p_attribute28_value               => p_rec.attribute28
182       ,p_attribute29_name                => 'ATTRIBUTE29'
183       ,p_attribute29_value               => p_rec.attribute29
184       ,p_attribute30_name                => 'ATTRIBUTE30'
185       ,p_attribute30_value               => p_rec.attribute30
186       );
187   end if;
188   --
189   if g_debug then
190 	hr_utility.set_location(' Leaving:'||l_proc,20);
191   end if;
192 end chk_df;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |-----------------------< chk_non_updateable_args >------------------------|
196 -- ----------------------------------------------------------------------------
197 --
198 -- Description:
199 --   This procedure is used to ensure that non updateable attributes have
200 --   not been updated. If an attribute has been updated an error is generated.
201 --
202 -- Pre Conditions:
203 --   g_old_rec has been populated with details of the values currently in
204 --   the database.
205 --
206 -- In Arguments:
207 --   p_rec has been populated with the updated values the user would like the
208 --   record set to.
212 --   changed.
209 --
210 -- Post Success:
211 --   Processing continues if all the non updateable attributes have not
213 --
214 -- Post Failure:
215 --   An application error is raised if any of the non updatable attributes
216 --   have been altered.
217 --
218 -- ----------------------------------------------------------------------------
219 Procedure chk_non_updateable_args
220   (p_effective_date               in date
221   ,p_rec in hxc_egc_shd.g_rec_type
222   ) IS
223 --
224   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
225   l_error    EXCEPTION;
226   l_argument varchar2(30);
227 --
228 Begin
229   --
230   -- Only proceed with the validation if a row exists for the current
231   -- record in the HR Schema.
232   --
233   IF NOT hxc_egc_shd.api_updating
234       (p_entity_group_comp_id                 => p_rec.entity_group_comp_id
235       ,p_object_version_number                => p_rec.object_version_number
236       ) THEN
237      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
238      fnd_message.set_token('PROCEDURE ', l_proc);
239      fnd_message.set_token('STEP ', '5');
240      fnd_message.raise_error;
241   END IF;
242   --
243   EXCEPTION
244     WHEN l_error THEN
245        hr_api.argument_changed_error
246          (p_api_name => l_proc
247          ,p_argument => l_argument);
248     WHEN OTHERS THEN
249        RAISE;
250 End chk_non_updateable_args;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |----------------------------< chk_entity_id >-----------------------------|
254 -- ----------------------------------------------------------------------------
255 --
256 -- Description:
257 --   This procedure insures a valid entity_id is entered
258 --
259 -- Pre Conditions:
260 --   None
261 --
262 -- In Arguments:
263 --   entity id
264 --
265 -- Post Success:
266 --   Processing continues if the mapping component id business rules
267 --   have not been violated
268 --
269 -- Post Failure:
270 --   An application error is raised if the mapping component id is not valid
271 --
272 -- ----------------------------------------------------------------------------
273 Procedure chk_entity_id
274   (
275    p_entity_id   in hxc_entity_group_comps.entity_id%TYPE
276 ,  p_entity_type in hxc_entity_group_comps.entity_type%TYPE
277   ) IS
278 --
279   l_proc  varchar2(72);
280 --
281 -- cursor to check time_entry_rule_id is valid
282 --
283 CURSOR  csr_chk_ter IS
284 SELECT 'error'
285 FROM	sys.dual
286 WHERE NOT EXISTS (
287 	SELECT	'x'
288 	FROM	hxc_time_entry_rules ter
289 	WHERE	ter.time_entry_rule_id = p_entity_id );
290 
291 CURSOR csr_chk_tr IS
292 SELECT 'error'
293 FROM	dual
294 WHERE	NOT EXISTS (
295 	SELECT	'x'
299 CURSOR csr_chk_rr IS
296 	FROM	hxc_time_recipients tr
297 	WHERE	tr.time_recipient_id	= p_entity_id );
298 
300 SELECT 'error'
301 FROM	dual
302 WHERE	NOT EXISTS (
303 	SELECT	'x'
304 	FROM	hxc_retrieval_rules rr
305 	WHERE	rr.retrieval_rule_id	= p_entity_id );
306 
307 CURSOR csr_chk_ptg IS
308 SELECT 'error'
309 FROM	dual
310 WHERE	NOT EXISTS (
311 	SELECT	'x'
312 	FROM	hxc_template_summary hts
313 	WHERE	hts.template_id	= p_entity_id
314         and hts.template_type = 'PUBLIC');
315 
316  l_error varchar2(5) := NULL;
317 
318 BEGIN
319   g_debug:=hr_utility.debug_enabled;
320   if g_debug then
321 	l_proc := g_package||'chk_entity_id';
322 	hr_utility.set_location('Entering:'||l_proc, 5);
323   end if;
324 -- check that the entity id has been entered
325 --
326 IF p_entity_id IS NULL
327 THEN
328 --
329       hr_utility.set_message(809, 'HXC_EGC_ENTITY_ID_MAND');
330       hr_utility.raise_error;
331 --
332 END IF;
333 
334   if g_debug then
335 	hr_utility.set_location('Processing:'||l_proc, 10);
336   end if;
337 
338 -- check to see what entity we are dealing with
339 
340 IF ( p_entity_type = 'TIME_ENTRY_RULES' )
341 THEN
342 
343 -- check that entity_id is valid
344 
345   OPEN  csr_chk_ter;
346   FETCH csr_chk_ter INTO l_error;
347   CLOSE csr_chk_ter;
348 
349   IF l_error IS NOT NULL
350   THEN
351 
352       hr_utility.set_message(809, 'HXC_EGC_ENTITY_ID_INVALID');
353       hr_utility.raise_error;
354 
355   END IF;
356 
357 ELSIF ( p_entity_type = 'TIME_RECIPIENTS' )
358 THEN
359 
360 -- check that entity_id is valid
361 
362   OPEN  csr_chk_tr;
363   FETCH csr_chk_tr INTO l_error;
364   CLOSE csr_chk_tr;
365 
366   IF l_error IS NOT NULL
367   THEN
368 
369       hr_utility.set_message(809, 'HXC_EGC_ENTITY_ID_INVALID');
370       hr_utility.raise_error;
371 
372   END IF;
373 
374 ELSIF ( p_entity_type = 'RETRIEVAL_RULES' )
375 THEN
376 
377 -- check that entity_id is valid
378 
379   OPEN  csr_chk_rr;
380   FETCH csr_chk_rr INTO l_error;
381   CLOSE csr_chk_rr;
382 
383   IF l_error IS NOT NULL
384   THEN
385 
386       hr_utility.set_message(809, 'HXC_EGC_ENTITY_ID_INVALID');
387       hr_utility.raise_error;
388 
389   END IF;
390 
391 -- To handle Public Template Group Insert
392 ELSIF (p_entity_type = 'PUBLIC_TEMPLATE_GROUP')
393 THEN
394       OPEN  csr_chk_ptg;
395       FETCH csr_chk_ptg INTO l_error;
396       CLOSE csr_chk_ptg;
397 
398       IF l_error IS NOT NULL
399       THEN
400 
401           hr_utility.set_message(809, 'HXC_EGC_ENTITY_ID_INVALID');
402           hr_utility.raise_error;
403 
404       END IF;
405 
406 
407 ELSE
408 
409       hr_utility.set_message(809, 'HXC_EGC_ENTITY_TYPE_INVALID');
410       hr_utility.raise_error;
411 
412 END IF; -- entity_type
413 
414 --
415 END chk_entity_id;
416 --
417 -- ----------------------------------------------------------------------------
418 -- |-----------------------< chk_entity_group_id >----------------------------|
419 -- ----------------------------------------------------------------------------
420 --
421 -- Description:
422 --   This procedure insures a valid entity group id
423 --
424 -- Pre Conditions:
425 --   None
426 --
427 -- In Arguments:
428 --   entity group id
429 --
430 -- Post Success:
431 --   Processing continues if the entity id business rules
432 --   have not been violated
433 --
434 -- Post Failure:
435 --   An application error is raised if the entity id is not valid
436 --
437 -- ----------------------------------------------------------------------------
438 Procedure chk_entity_group_id
439   (
440    p_entity_group_id  in hxc_entity_groups.entity_group_id%TYPE
441   ) IS
442 --
443   l_proc  varchar2(72);
444 --
445 -- cursor to check entity group id is valid
446 --
447 CURSOR  csr_chk_egc IS
448 SELECT 'error'
449 FROM	sys.dual
450 WHERE NOT EXISTS (
451 	SELECT	'x'
452 	FROM	hxc_entity_groups egc
453 	WHERE	egc.entity_group_id = p_entity_group_id );
454 --
455  l_error varchar2(5) := NULL;
456 --
457 BEGIN
458   g_debug:=hr_utility.debug_enabled;
459   if g_debug then
460 	l_proc := g_package||'chk_entity_group_id';
461 	hr_utility.set_location('Entering:'||l_proc, 5);
462   end if;
463 --
464 -- check that the entity group id has been entered
465 --
466 IF p_entity_group_id IS NULL
467 THEN
468 --
469       hr_utility.set_message(809, 'HXC_EGC_ENTITY_GROUP_ID_MAND');
470       hr_utility.raise_error;
471 --
472 END IF;
473   if g_debug then
474 	hr_utility.set_location('Processing:'||l_proc, 10);
475   end if;
476 --
477 -- check that entity_group_id is valid
478 --
479   OPEN  csr_chk_egc;
480   FETCH csr_chk_egc INTO l_error;
481   CLOSE csr_chk_egc;
482 --
483 IF l_error IS NOT NULL
484 THEN
485 --
486       hr_utility.set_message(809, 'HXC_EGC_ENTITY_GROUP_ID_INVLD');
487       hr_utility.raise_error;
488 --
489 END IF;
490 --
491   if g_debug then
492 	hr_utility.set_location('Leaving:'||l_proc, 20);
493   end if;
494 --
495 END chk_entity_group_id;
496 --
497 -- ----------------------------------------------------------------------------
498 -- |-----------------------< chk_entity_type >--------------------------------|
499 -- ----------------------------------------------------------------------------
500 --
501 -- Description:
502 --   This procedure insures a valid entity type
503 --
504 -- Pre Conditions:
505 --   None
506 --
507 -- In Arguments:
508 --   entity type
509 --
510 -- Post Success:
511 --   Processing continues if the entity id business rules
512 --   have not been violated
513 --
514 -- Post Failure:
515 --   An application error is raised if the entity id is not valid
516 --
517 -- ----------------------------------------------------------------------------
518 Procedure chk_entity_type
519   (
520    p_entity_type    in hxc_entity_group_comps.entity_type%TYPE
521 ,  p_effective_date in DATE
522   ) IS
523 --
524   l_proc  varchar2(72);
525 --
526 -- cursor to check entity type is valid
527 --
528 CURSOR  csr_chk_lkup IS
529 SELECT 'error'
530 FROM	sys.dual
531 WHERE NOT EXISTS (
532 	SELECT	'x'
533 	FROM	hr_lookups lk
534 	WHERE	lk.lookup_type = 'HXC_ENTITIES'
535 	AND	lk.lookup_code = p_entity_type
536 	AND	p_effective_date BETWEEN
537 		lk.start_date_active and NVL(lk.end_date_active, hr_general.end_of_time) );
538 --
539  l_error varchar2(5) := NULL;
540 --
541 BEGIN
542   g_debug:=hr_utility.debug_enabled;
543   if g_debug then
544 	l_proc := g_package||'chk_entity_type';
545 	hr_utility.set_location('Entering:'||l_proc, 5);
546   end if;
547 --
548 -- check that the entity type has been entered
549 --
550 IF p_entity_type IS NULL
551 THEN
552 --
553       hr_utility.set_message(809, 'HXC_EGC_ENTITY_TYPE_MAND');
554       hr_utility.raise_error;
555 --
556 END IF;
557   if g_debug then
558 	hr_utility.set_location('Processing:'||l_proc, 10);
559   end if;
560 --
561 -- check that entity_component_id is valid
562 --
563   OPEN  csr_chk_lkup;
564   FETCH csr_chk_lkup INTO l_error;
565   CLOSE csr_chk_lkup;
566 --
567 IF l_error IS NOT NULL
568 THEN
569 --
570       hr_utility.set_message(809, 'HXC_EGC_ENTITY_TYPE_INVLD');
571       hr_utility.raise_error;
572 --
573 END IF;
574 --
575   if g_debug then
576 	hr_utility.set_location('Leaving:'||l_proc, 20);
577   end if;
578 --
579 END chk_entity_type;
580 -- Procedure to check if there are duplicate rules for a particular
581 -- recipient application in a PTE TERG.
582 -- ----------------------------------------------------------------------------
583 -- |---------------------------< chk_dup_app_PTE >----------------------------|
584 -- ----------------------------------------------------------------------------
585 Procedure chk_dup_app_PTE
586    (p_entity_group_id hxc_entity_group_comps.entity_group_id%TYPE
587    ,p_entity_id hxc_entity_group_comps.entity_id%TYPE
588    ,p_entity_group_comp_id hxc_entity_group_comps.entity_group_comp_id%TYPE
589    ) is
590     cursor csr_chk_dup_app is
591     select 'Y'
592       from hxc_entity_groups heg,
593            hxc_entity_group_comps hec,
594 	   hxc_time_entry_rules hte1,
595 	   hxc_time_entry_rules hte2
596      where heg.entity_type = 'TIME_ENTRY_RULES' and
597            heg.entity_group_id = nvl(p_entity_group_id,-999) and
598 	   hec.ENTITY_GROUP_ID =heg.entity_group_id and
599 	   hec.entity_id = hte1.TIME_ENTRY_RULE_ID and
600 	   hte1.attribute1 = hte2.attribute1 and
601 	   hte2.time_entry_rule_id = nvl(p_entity_id,-999) and
602 	   hec.entity_group_comp_id <> nvl(p_entity_group_comp_id,-999);
603 
604 l_buff varchar2(20);
605 l_proc  varchar2(72);
606 
607 Begin
608    g_debug:=hr_utility.debug_enabled;
609    if g_debug then
610 	l_proc := g_package||'chk_dup_app_PTE';
611 	hr_utility.set_location('Entering:'||l_proc, 5);
612    end if;
613    open csr_chk_dup_app;
614    if g_debug then
615 	   hr_utility.trace('After open');
616 	   hr_utility.trace('Entity_id ' || p_entity_id);
617 	   hr_utility.trace('Group id ' || p_entity_group_id);
618    end if;
619        fetch csr_chk_dup_app into l_buff;
620        if g_debug then
621 		hr_utility.trace('res' || l_buff);
622        end if;
623 
624    if (csr_chk_dup_app%FOUND) then
625        if g_debug then
626 	hr_utility.set_location('Entering:'||l_proc, 10);
627        end if;
628        close csr_chk_dup_app;
629        hr_utility.set_message(809,'HXC_REC_APP_DUP');
630        hr_utility.raise_error;
631    end if;
632    close csr_chk_dup_app;
633    if g_debug then
634 	hr_utility.set_location('leaving:'||l_proc, 15);
635    end if;
636 end chk_dup_app_PTE;
637 
638 -- ----------------------------------------------------------------------------
639 -- |---------------------------< insert_validate >----------------------------|
640 -- ----------------------------------------------------------------------------
641 Procedure insert_validate
642   (p_effective_date               in date
643   ,p_rec                          in hxc_egc_shd.g_rec_type
644   ,p_called_from_form             in varchar2
645   ) is
646 --
647   l_proc  varchar2(72);
648 --
649 Begin
650   g_debug:=hr_utility.debug_enabled;
651   if g_debug then
652 	l_proc := g_package||'insert_validate';
653 	hr_utility.set_location('Entering:'||l_proc, 5);
654   end if;
655   --
656   -- Call all supporting business operations
657   --
658 	chk_entity_group_id ( p_entity_group_id => p_rec.entity_group_id );
659 
660 	chk_entity_type ( p_entity_type		=> p_rec.entity_type
661 			, p_effective_date 	=> p_effective_date );
662 
663 -- Call chk_entity_id only if it is not a Dynamic Template i.e. Entity_Id =-1  and
664 -- Entity_Type = PUBLIC_TEMPLATE_GROUP
665   if(p_rec.entity_id = -1)
666   then
667     if(p_rec.entity_type <> 'PUBLIC_TEMPLATE_GROUP')
668     then
669       chk_entity_id ( p_entity_id		=> p_rec.entity_id
670       ,	p_entity_type		=> p_rec.entity_type );
671     end if;
672   else
673     chk_entity_id ( p_entity_id		=> p_rec.entity_id
674       ,	p_entity_type		=> p_rec.entity_type );
675   end if;
676 
677         if (p_rec.attribute1 = 'PTE') then
678 	    chk_dup_app_PTE(p_entity_group_id => p_rec.entity_group_id,
679 			    p_entity_id =>p_rec.entity_id,
680 			    p_entity_group_comp_id => p_rec.entity_group_comp_id);
681 	end if;
682 -- only call the DF validation if API called directly
683 
684 	IF ( p_called_from_form = 'N' )
685 	THEN
686 	        chk_df(p_rec);
687 	END IF;
688 
689   if g_debug then
690 	hr_utility.set_location(' Leaving:'||l_proc, 10);
691   end if;
692 End insert_validate;
693 --
694 -- ----------------------------------------------------------------------------
695 -- |---------------------------< update_validate >----------------------------|
696 -- ----------------------------------------------------------------------------
697 Procedure update_validate
698   (p_effective_date               in date
699   ,p_rec                          in hxc_egc_shd.g_rec_type
700   ,p_called_from_form             in varchar2
701   ) is
702 --
703   l_proc  varchar2(72);
704 --
705 Begin
706   g_debug:=hr_utility.debug_enabled;
707   if g_debug then
711   --
708 	l_proc := g_package||'update_validate';
709 	hr_utility.set_location('Entering:'||l_proc, 5);
710   end if;
712   -- Call all supporting business operations
713   --
714 	chk_entity_group_id ( p_entity_group_id => p_rec.entity_group_id );
715 
716 	chk_entity_type ( p_entity_type		=> p_rec.entity_type
717 			, p_effective_date	=> p_effective_date );
718 
719 	chk_entity_id ( p_entity_id		=> p_rec.entity_id
720 		,	p_entity_type		=> p_rec.entity_type );
721 
722   chk_non_updateable_args
723     (p_effective_date              => p_effective_date
724       ,p_rec              => p_rec
725     );
726         if (p_rec.attribute1 = 'PTE') then
727 	    chk_dup_app_PTE(p_entity_group_id => p_rec.entity_group_id,
728 			    p_entity_id =>p_rec.entity_id,
729 			    p_entity_group_comp_id => p_rec.entity_group_comp_id);
730 	end if;
731 -- only call the DF validation if API called directly
732 
733 	IF ( p_called_from_form = 'N' )
734 	THEN
735 	        chk_df(p_rec);
736 	END IF;
737 
738   if g_debug then
739 	hr_utility.set_location(' Leaving:'||l_proc, 10);
740   end if;
741 End update_validate;
742 --
743 -- ----------------------------------------------------------------------------
744 -- |---------------------------< delete_validate >----------------------------|
745 -- ----------------------------------------------------------------------------
746 Procedure delete_validate
747   (p_rec                          in hxc_egc_shd.g_rec_type
748   ) is
749 --
750   l_proc  varchar2(72);
751 --
752 Begin
753   g_debug:=hr_utility.debug_enabled;
754   if g_debug then
755 	l_proc := g_package||'delete_validate';
756 	hr_utility.set_location('Entering:'||l_proc, 5);
757   end if;
758   --
759   -- Call all supporting business operations
760 null;
761 
762   if g_debug then
763 	hr_utility.set_location(' Leaving:'||l_proc, 10);
764   end if;
765 End delete_validate;
766 --
767 end hxc_egc_bus;