DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PGN_BUS

Source


1 Package Body per_pgn_bus as
2 /* $Header: pepgnrhi.pkb 120.0 2005/05/31 14:09:44 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pgn_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_hierarchy_node_id           number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_hierarchy_node_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_perf  pbg
29          , per_gen_hierarchy_nodes pgn
30      where pgn.hierarchy_node_id = p_hierarchy_node_id
31       and  pbg.business_group_id  (+) = pgn.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           => 'hierarchy_node_id'
47     ,p_argument_value     => p_hierarchy_node_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_hierarchy_node_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_perf  pbg
89          , per_gen_hierarchy_nodes pgn
90      where pgn.hierarchy_node_id = p_hierarchy_node_id
91        and pbg.business_group_id (+) = pgn.business_group_id;
92   --
93   -- Declare local variables
94   --
95   l_legislation_code  varchar2(150);
96   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
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           => 'hierarchy_node_id'
107     ,p_argument_value     => p_hierarchy_node_id
108     );
109   --
110   if ( nvl(per_pgn_bus.g_hierarchy_node_id, hr_api.g_number)
111        = p_hierarchy_node_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_pgn_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_pgn_bus.g_hierarchy_node_id := p_hierarchy_node_id;
142     per_pgn_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_ddf >---------------------------------|
150 -- -----------------------------------------------------------------------------
151 --
152 --
153 -- Description:
154 --   Validates all the Developer Descriptive Flexfield values.
155 --
156 -- Prerequisites:
157 --   All other columns have been validated.  Must be called as the
158 --   last step from insert_validate and update_validate.
159 --
160 -- In Arguments:
161 --   p_rec
162 --
163 -- Post Success:
164 --   If the Developer Descriptive Flexfield structure column and data values are
165 --   all valid this procedure will end normally and processing will
166 --   continue.
167 --
168 -- Post Failure:
169 --   If the Developer Descriptive Flexfield structure column value or any of
170 --   the data values are invalid then an application error is raised as
171 --   a PL/SQL exception.
172 --
173 -- Access Status:
174 --   Internal Row Handler Use Only.
175 --
176 -- ----------------------------------------------------------------------------
177 procedure chk_ddf
178   (p_rec in per_pgn_shd.g_rec_type) is
179 --
180   l_proc       varchar2(72) := g_package||'chk_ddf';
181   l_error      exception;
182 --
183 Begin
184   hr_utility.set_location('Entering:'||l_proc, 5);
185   --
186   -- Check if the row is being inserted or updated and a
187   -- value has changed
188   --
189   if (p_rec.hierarchy_node_id is null)
190     or ((p_rec.hierarchy_node_id is not null)
191     and
192     nvl(per_pgn_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
193     nvl(p_rec.information_category, hr_api.g_varchar2) or
194     nvl(per_pgn_shd.g_old_rec.information1, hr_api.g_varchar2) <>
195     nvl(p_rec.information1, hr_api.g_varchar2) or
196     nvl(per_pgn_shd.g_old_rec.information2, hr_api.g_varchar2) <>
197     nvl(p_rec.information2, hr_api.g_varchar2) or
198     nvl(per_pgn_shd.g_old_rec.information3, hr_api.g_varchar2) <>
199     nvl(p_rec.information3, hr_api.g_varchar2) or
200     nvl(per_pgn_shd.g_old_rec.information4, hr_api.g_varchar2) <>
201     nvl(p_rec.information4, hr_api.g_varchar2) or
202     nvl(per_pgn_shd.g_old_rec.information5, hr_api.g_varchar2) <>
203     nvl(p_rec.information5, hr_api.g_varchar2) or
204     nvl(per_pgn_shd.g_old_rec.information6, hr_api.g_varchar2) <>
205     nvl(p_rec.information6, hr_api.g_varchar2) or
206     nvl(per_pgn_shd.g_old_rec.information7, hr_api.g_varchar2) <>
207     nvl(p_rec.information7, hr_api.g_varchar2) or
208     nvl(per_pgn_shd.g_old_rec.information8, hr_api.g_varchar2) <>
209     nvl(p_rec.information8, hr_api.g_varchar2) or
210     nvl(per_pgn_shd.g_old_rec.information9, hr_api.g_varchar2) <>
211     nvl(p_rec.information9, hr_api.g_varchar2) or
212     nvl(per_pgn_shd.g_old_rec.information10, hr_api.g_varchar2) <>
213     nvl(p_rec.information10, hr_api.g_varchar2) or
214     nvl(per_pgn_shd.g_old_rec.information11, hr_api.g_varchar2) <>
215     nvl(p_rec.information11, hr_api.g_varchar2) or
216     nvl(per_pgn_shd.g_old_rec.information12, hr_api.g_varchar2) <>
217     nvl(p_rec.information12, hr_api.g_varchar2) or
218     nvl(per_pgn_shd.g_old_rec.information13, hr_api.g_varchar2) <>
219     nvl(p_rec.information13, hr_api.g_varchar2) or
220     nvl(per_pgn_shd.g_old_rec.information14, hr_api.g_varchar2) <>
221     nvl(p_rec.information14, hr_api.g_varchar2) or
222     nvl(per_pgn_shd.g_old_rec.information15, hr_api.g_varchar2) <>
223     nvl(p_rec.information15, hr_api.g_varchar2) or
224     nvl(per_pgn_shd.g_old_rec.information16, hr_api.g_varchar2) <>
225     nvl(p_rec.information16, hr_api.g_varchar2) or
226     nvl(per_pgn_shd.g_old_rec.information17, hr_api.g_varchar2) <>
227     nvl(p_rec.information17, hr_api.g_varchar2) or
228     nvl(per_pgn_shd.g_old_rec.information18, hr_api.g_varchar2) <>
229     nvl(p_rec.information18, hr_api.g_varchar2) or
230     nvl(per_pgn_shd.g_old_rec.information19, hr_api.g_varchar2) <>
231     nvl(p_rec.information19, hr_api.g_varchar2) or
232     nvl(per_pgn_shd.g_old_rec.information20, hr_api.g_varchar2) <>
233     nvl(p_rec.information20, hr_api.g_varchar2) or
234     nvl(per_pgn_shd.g_old_rec.information21, hr_api.g_varchar2) <>
235     nvl(p_rec.information21, hr_api.g_varchar2) or
236     nvl(per_pgn_shd.g_old_rec.information22, hr_api.g_varchar2) <>
237     nvl(p_rec.information22, hr_api.g_varchar2) or
238     nvl(per_pgn_shd.g_old_rec.information23, hr_api.g_varchar2) <>
239     nvl(p_rec.information23, hr_api.g_varchar2) or
240     nvl(per_pgn_shd.g_old_rec.information24, hr_api.g_varchar2) <>
241     nvl(p_rec.information24, hr_api.g_varchar2) or
242     nvl(per_pgn_shd.g_old_rec.information25, hr_api.g_varchar2) <>
243     nvl(p_rec.information25, hr_api.g_varchar2) or
244     nvl(per_pgn_shd.g_old_rec.information26, hr_api.g_varchar2) <>
245     nvl(p_rec.information26, hr_api.g_varchar2) or
246     nvl(per_pgn_shd.g_old_rec.information27, hr_api.g_varchar2) <>
247     nvl(p_rec.information27, hr_api.g_varchar2) or
248     nvl(per_pgn_shd.g_old_rec.information28, hr_api.g_varchar2) <>
249     nvl(p_rec.information28, hr_api.g_varchar2) or
250     nvl(per_pgn_shd.g_old_rec.information29, hr_api.g_varchar2) <>
251     nvl(p_rec.information29, hr_api.g_varchar2) or
252     nvl(per_pgn_shd.g_old_rec.information30, hr_api.g_varchar2) <>
253     nvl(p_rec.information30, hr_api.g_varchar2))
254   then
255     --
256     hr_dflex_utility.ins_or_upd_descflex_attribs
257       (p_appl_short_name    => 'PER'
258       ,p_descflex_name      => 'PER_GEN_HIERARCHY_NODES_DDF'
259       ,p_attribute_category => p_rec.information_category
260       ,p_attribute1_name    => 'INFORMATION1'
261       ,p_attribute1_value   => p_rec.information1
262       ,p_attribute2_name    => 'INFORMATION2'
263       ,p_attribute2_value   => p_rec.information2
264       ,p_attribute3_name    => 'INFORMATION3'
265       ,p_attribute3_value   => p_rec.information3
266       ,p_attribute4_name    => 'INFORMATION4'
267       ,p_attribute4_value   => p_rec.information4
268       ,p_attribute5_name    => 'INFORMATION5'
269       ,p_attribute5_value   => p_rec.information5
270       ,p_attribute6_name    => 'INFORMATION6'
271       ,p_attribute6_value   => p_rec.information6
272       ,p_attribute7_name    => 'INFORMATION7'
273       ,p_attribute7_value   => p_rec.information7
274       ,p_attribute8_name    => 'INFORMATION8'
275       ,p_attribute8_value   => p_rec.information8
276       ,p_attribute9_name    => 'INFORMATION9'
277       ,p_attribute9_value   => p_rec.information9
278       ,p_attribute10_name   => 'INFORMATION10'
279       ,p_attribute10_value  => p_rec.information10
280       ,p_attribute11_name   => 'INFORMATION11'
281       ,p_attribute11_value  => p_rec.information11
282       ,p_attribute12_name   => 'INFORMATION12'
283       ,p_attribute12_value  => p_rec.information12
284       ,p_attribute13_name   => 'INFORMATION13'
285       ,p_attribute13_value  => p_rec.information13
286       ,p_attribute14_name   => 'INFORMATION14'
287       ,p_attribute14_value  => p_rec.information14
288       ,p_attribute15_name   => 'INFORMATION15'
289       ,p_attribute15_value  => p_rec.information15
290       ,p_attribute16_name   => 'INFORMATION16'
291       ,p_attribute16_value  => p_rec.information16
292       ,p_attribute17_name   => 'INFORMATION17'
293       ,p_attribute17_value  => p_rec.information17
294       ,p_attribute18_name   => 'INFORMATION18'
295       ,p_attribute18_value  => p_rec.information18
296       ,p_attribute19_name   => 'INFORMATION19'
297       ,p_attribute19_value  => p_rec.information19
298       ,p_attribute20_name   => 'INFORMATION20'
299       ,p_attribute20_value  => p_rec.information20
300       ,p_attribute21_name   => 'INFORMATION21'
301       ,p_attribute21_value  => p_rec.information21
302       ,p_attribute22_name   => 'INFORMATION22'
303       ,p_attribute22_value  => p_rec.information22
304       ,p_attribute23_name   => 'INFORMATION23'
305       ,p_attribute23_value  => p_rec.information23
306       ,p_attribute24_name   => 'INFORMATION24'
307       ,p_attribute24_value  => p_rec.information24
308       ,p_attribute25_name   => 'INFORMATION25'
309       ,p_attribute25_value  => p_rec.information25
310       ,p_attribute26_name   => 'INFORMATION26'
311       ,p_attribute26_value  => p_rec.information26
312       ,p_attribute27_name   => 'INFORMATION27'
313       ,p_attribute27_value  => p_rec.information27
314       ,p_attribute28_name   => 'INFORMATION28'
315       ,p_attribute28_value  => p_rec.information28
316       ,p_attribute29_name   => 'INFORMATION29'
317       ,p_attribute29_value  => p_rec.information29
318       ,p_attribute30_name   => 'INFORMATION30'
319       ,p_attribute30_value  => p_rec.information30
320       );
321     --
322   end if;
323   --
324   hr_utility.set_location(' Leaving:'||l_proc, 10);
325 end chk_ddf;
326 --
327 --
328 -- ----------------------------------------------------------------------------
329 -- |------------------------------< chk_df >----------------------------------|
330 -- ----------------------------------------------------------------------------
331 --
332 -- Description:
333 --   Validates all the Descriptive Flexfield values.
334 --
335 -- Prerequisites:
336 --   All other columns have been validated.  Must be called as the
337 --   last step from insert_validate and update_validate.
338 --
339 -- In Arguments:
340 --   p_rec
341 --
342 -- Post Success:
343 --   If the Descriptive Flexfield structure column and data values are
344 --   all valid this procedure will end normally and processing will
345 --   continue.
346 --
347 -- Post Failure:
348 --   If the Descriptive Flexfield structure column value or any of
349 --   the data values are invalid then an application error is raised as
350 --   a PL/SQL exception.
351 --
352 -- Access Status:
353 --   Internal Row Handler Use Only.
354 --
355 -- ----------------------------------------------------------------------------
356 procedure chk_df
357   (p_rec in per_pgn_shd.g_rec_type
358   ) is
359 --
360   l_proc   varchar2(72) := g_package || 'chk_df';
361 --
362 begin
363   hr_utility.set_location('Entering:'||l_proc,15);
364   --
365   if ((p_rec.hierarchy_node_id is not null)  and (
366     nvl(per_pgn_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
367     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
368     nvl(per_pgn_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
369     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
370     nvl(per_pgn_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
371     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
372     nvl(per_pgn_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
373     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
377     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
374     nvl(per_pgn_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
375     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
376     nvl(per_pgn_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
378     nvl(per_pgn_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
379     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
380     nvl(per_pgn_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
381     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
382     nvl(per_pgn_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
383     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
384     nvl(per_pgn_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
385     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
386     nvl(per_pgn_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
387     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
388     nvl(per_pgn_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
389     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
390     nvl(per_pgn_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
391     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
392     nvl(per_pgn_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
393     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
394     nvl(per_pgn_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
395     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
396     nvl(per_pgn_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
397     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
398     nvl(per_pgn_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
399     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
400     nvl(per_pgn_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
401     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
402     nvl(per_pgn_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
403     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
404     nvl(per_pgn_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
405     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
406     nvl(per_pgn_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
407     nvl(p_rec.attribute20, hr_api.g_varchar2)  or
408     nvl(per_pgn_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
409     nvl(p_rec.attribute21, hr_api.g_varchar2)  or
410     nvl(per_pgn_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
411     nvl(p_rec.attribute22, hr_api.g_varchar2)  or
412     nvl(per_pgn_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
413     nvl(p_rec.attribute23, hr_api.g_varchar2)  or
414     nvl(per_pgn_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
415     nvl(p_rec.attribute24, hr_api.g_varchar2)  or
416     nvl(per_pgn_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
417     nvl(p_rec.attribute25, hr_api.g_varchar2)  or
418     nvl(per_pgn_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
419     nvl(p_rec.attribute26, hr_api.g_varchar2)  or
420     nvl(per_pgn_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
421     nvl(p_rec.attribute27, hr_api.g_varchar2)  or
422     nvl(per_pgn_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
423     nvl(p_rec.attribute28, hr_api.g_varchar2)  or
424     nvl(per_pgn_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
425     nvl(p_rec.attribute29, hr_api.g_varchar2)  or
426     nvl(per_pgn_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
427     nvl(p_rec.attribute30, hr_api.g_varchar2) ))
428     or (p_rec.hierarchy_node_id is null)  then
429     --
430     -- Only execute the validation if absolutely necessary:
431     -- a) During update, the structure column value or any
432     --    of the attribute values have actually changed.
433     -- b) During insert.
434     --
435     hr_dflex_utility.ins_or_upd_descflex_attribs
436       (p_appl_short_name                 => 'PER'
437       ,p_descflex_name                   => 'PER_GEN_HIERARCHY_NODES'
438       ,p_attribute_category              => p_rec.attribute_category
439       ,p_attribute1_name                 => 'ATTRIBUTE1'
440       ,p_attribute1_value                => p_rec.attribute1
441       ,p_attribute2_name                 => 'ATTRIBUTE2'
442       ,p_attribute2_value                => p_rec.attribute2
443       ,p_attribute3_name                 => 'ATTRIBUTE3'
444       ,p_attribute3_value                => p_rec.attribute3
445       ,p_attribute4_name                 => 'ATTRIBUTE4'
446       ,p_attribute4_value                => p_rec.attribute4
447       ,p_attribute5_name                 => 'ATTRIBUTE5'
448       ,p_attribute5_value                => p_rec.attribute5
449       ,p_attribute6_name                 => 'ATTRIBUTE6'
450       ,p_attribute6_value                => p_rec.attribute6
451       ,p_attribute7_name                 => 'ATTRIBUTE7'
452       ,p_attribute7_value                => p_rec.attribute7
453       ,p_attribute8_name                 => 'ATTRIBUTE8'
454       ,p_attribute8_value                => p_rec.attribute8
455       ,p_attribute9_name                 => 'ATTRIBUTE9'
456       ,p_attribute9_value                => p_rec.attribute9
457       ,p_attribute10_name                => 'ATTRIBUTE10'
458       ,p_attribute10_value               => p_rec.attribute10
459       ,p_attribute11_name                => 'ATTRIBUTE11'
460       ,p_attribute11_value               => p_rec.attribute11
461       ,p_attribute12_name                => 'ATTRIBUTE12'
462       ,p_attribute12_value               => p_rec.attribute12
463       ,p_attribute13_name                => 'ATTRIBUTE13'
464       ,p_attribute13_value               => p_rec.attribute13
465       ,p_attribute14_name                => 'ATTRIBUTE14'
466       ,p_attribute14_value               => p_rec.attribute14
467       ,p_attribute15_name                => 'ATTRIBUTE15'
468       ,p_attribute15_value               => p_rec.attribute15
469       ,p_attribute16_name                => 'ATTRIBUTE16'
470       ,p_attribute16_value               => p_rec.attribute16
471       ,p_attribute17_name                => 'ATTRIBUTE17'
472       ,p_attribute17_value               => p_rec.attribute17
473       ,p_attribute18_name                => 'ATTRIBUTE18'
474       ,p_attribute18_value               => p_rec.attribute18
475       ,p_attribute19_name                => 'ATTRIBUTE19'
476       ,p_attribute19_value               => p_rec.attribute19
477       ,p_attribute20_name                => 'ATTRIBUTE20'
478       ,p_attribute20_value               => p_rec.attribute20
479       ,p_attribute21_name                => 'ATTRIBUTE21'
480       ,p_attribute21_value               => p_rec.attribute21
481       ,p_attribute22_name                => 'ATTRIBUTE22'
482       ,p_attribute22_value               => p_rec.attribute22
483       ,p_attribute23_name                => 'ATTRIBUTE23'
484       ,p_attribute23_value               => p_rec.attribute23
485       ,p_attribute24_name                => 'ATTRIBUTE24'
486       ,p_attribute24_value               => p_rec.attribute24
487       ,p_attribute25_name                => 'ATTRIBUTE25'
488       ,p_attribute25_value               => p_rec.attribute25
489       ,p_attribute26_name                => 'ATTRIBUTE26'
490       ,p_attribute26_value               => p_rec.attribute26
491       ,p_attribute27_name                => 'ATTRIBUTE27'
492       ,p_attribute27_value               => p_rec.attribute27
493       ,p_attribute28_name                => 'ATTRIBUTE28'
494       ,p_attribute28_value               => p_rec.attribute28
495       ,p_attribute29_name                => 'ATTRIBUTE29'
496       ,p_attribute29_value               => p_rec.attribute29
497       ,p_attribute30_name                => 'ATTRIBUTE30'
498       ,p_attribute30_value               => p_rec.attribute30
499       );
500   end if;
501   --
502   hr_utility.set_location(' Leaving:'||l_proc,20);
503 end chk_df;
504 --
505 -- ----------------------------------------------------------------------------
506 -- |-----------------------< chk_non_updateable_args >------------------------|
507 -- ----------------------------------------------------------------------------
508 -- {Start Of Comments}
509 --
510 -- Description:
511 --   This procedure is used to ensure that non updateable attributes have
512 --   not been updated. If an attribute has been updated an error is generated.
513 --
514 -- Pre Conditions:
515 --   g_old_rec has been populated with details of the values currently in
516 --   the database.
517 --
518 -- In Arguments:
519 --   p_rec has been populated with the updated values the user would like the
520 --   record set to.
521 --
522 -- Post Success:
523 --   Processing continues if all the non updateable attributes have not
524 --   changed.
525 --
526 -- Post Failure:
527 --   An application error is raised if any of the non updatable attributes
528 --   have been altered.
529 --
530 -- {End Of Comments}
531 -- ----------------------------------------------------------------------------
532 Procedure chk_non_updateable_args
533   (p_effective_date               in date
534   ,p_rec in per_pgn_shd.g_rec_type
535   ) IS
536 --
537   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
538   l_error    EXCEPTION;
539   l_argument varchar2(30);
540 --
541 Begin
542   --
543   -- Only proceed with the validation if a row exists for the current
544   -- record in the HR Schema.
545   --
546   IF NOT per_pgn_shd.api_updating
547       (p_hierarchy_node_id                    => p_rec.hierarchy_node_id
548       ,p_object_version_number                => p_rec.object_version_number
549       ) THEN
550      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
551      fnd_message.set_token('PROCEDURE ', l_proc);
552      fnd_message.set_token('STEP ', '5');
553      fnd_message.raise_error;
554   END IF;
555   --
556   -- EDIT_HERE: Add checks to ensure non-updateable args have
557   --            not been updated.
558   --
559 --
560   IF nvl(p_rec.business_group_id, hr_api.g_number) <>
561      nvl(per_pgn_shd.g_old_rec.business_group_id, hr_api.g_number) THEN
562      l_argument := 'business_group_id';
563      RAISE l_error;
564   END IF;
565 --
566   IF nvl(p_rec.node_type, hr_api.g_varchar2) <>
567     nvl(per_pgn_shd.g_old_rec.node_type, hr_api.g_varchar2) THEN
568     l_argument := 'node_type';
569     RAISE l_error;
570   END IF;
571 --
572   EXCEPTION
573     WHEN l_error THEN
574        hr_api.argument_changed_error
575          (p_api_name => l_proc
576          ,p_argument => l_argument);
577     WHEN OTHERS THEN
578        RAISE;
579 End chk_non_updateable_args;
580 --
581 --
582 -- ----------------------------------------------------------------------------
583 -- |---------------------------< chk_entity_id >------------------------------|
587   , p_business_group_id    in  hr_all_organization_units.business_group_id%TYPE
584 -- ----------------------------------------------------------------------------
585 Procedure chk_entity_id
586   ( p_entity_id            in  per_gen_hierarchy_nodes.entity_id%TYPE
588   , p_node_type            in  per_gen_hierarchy_nodes.node_type%TYPE
589   , p_hierarchy_version_id in  per_gen_hierarchy_versions.hierarchy_version_id%TYPE
590   ) IS
591 --
592   l_ent_exists varchar2(1) := 'Y';
593 --
594   cursor csr_org_exists is
595     select 'Y'
596       from  hr_all_organization_units  hou
597          ,  hr_organization_information hoi
598          ,  per_gen_hierarchy_versions pgv
599      where  hou.organization_id = p_entity_id
600        and  (hou.business_group_id = p_business_group_id or p_business_group_id is null)
601        and  pgv.hierarchy_version_id = p_hierarchy_version_id
602        and  hou.organization_id = hoi.organization_id
603        and  hoi.org_information_context = 'CLASS'
604        and  hoi.org_information1 = 'PAR_ENT';
605 --
606   cursor csr_loc_exists is
607     select 'Y'
608       from  hr_locations_all  loc
609      where  loc.location_id = p_entity_id;
610 --
611   cursor csr_loc_extra_exists is
612     select 'Y'
613       from  hr_locations_all  loc,
614             hr_location_extra_info lei
615      where  loc.location_id = p_entity_id
616      and    loc.location_id = lei.location_id
617      and    lei.information_type in ('Establishment Information',
618                                      'VETS-100 Specific Information',
619                                      'EEO-1 Specific Information',
620                                       'Multi Work Site Information');
621   --
622   cursor csr_ent_exists is
623     select 'Y'
624     from   per_gen_hierarchy_nodes
625     where  entity_id = p_entity_id
626     and    hierarchy_version_id = p_hierarchy_version_id
627     and    node_type = p_node_type;
628 --
629   l_proc  varchar2(72) := g_package||'chk_entity_id';
630 --
631 Begin
632 --
633   hr_utility.set_location('Entering:'||l_proc, 5);
634 --
635 -- Check mandatory parameters have been set
636 --
637   hr_api.mandatory_arg_error
638     (p_api_name        =>  l_proc
639     ,p_argument        =>  'entity_id'
640     ,p_argument_value  =>  p_entity_id
641     );
642 --
643   hr_utility.set_location(l_proc, 10);
644 --
645   if nvl(per_pgn_shd.g_old_rec.entity_id, hr_api.g_varchar2) <>
646      nvl(p_entity_id, hr_api.g_varchar2) then
647 --
648   if p_node_type = 'PAR' then
649   --
650      hr_utility.set_location(l_proc, 20);
651   --
652      open csr_org_exists;
653        --
654        fetch csr_org_exists into l_ent_exists;
655        if csr_org_exists%notfound then
656          close csr_org_exists;
657          fnd_message.set_name('PER', 'HR_289060_PGN_INV_HIER_ORG');
658          fnd_message.raise_error;
659        end if;
660        --
661      close csr_org_exists;
662   elsif p_node_type = 'LOC' then
663      --
664      hr_utility.set_location(l_proc, 30);
665      --
666      open csr_loc_exists;
667      fetch csr_loc_exists into l_ent_exists;
668      if csr_loc_exists%notfound then
669         close csr_loc_exists;
670         fnd_message.set_name('PER', 'HR_289061_PGN_INV_HIER_LOC');
671         fnd_message.raise_error;
672      else
673         close csr_loc_exists;
674      end if;
675   elsif p_node_type = 'EST' then
676      --
677      hr_utility.set_location(l_proc, 30);
678      --
679      open csr_loc_extra_exists;
680      fetch csr_loc_extra_exists into l_ent_exists;
681      if csr_loc_extra_exists%notfound then
682         close csr_loc_extra_exists;
683         fnd_message.set_name('PER', 'HR_289062_PGN_INV_HIER_EST');
684         fnd_message.raise_error;
685      else
686         close csr_loc_extra_exists;
687      end if;
688  --  else
689      --
690  --    hr_utility.set_location(l_proc, 50);
691  --    fnd_message.set_name('PER', 'HR_289063_INV_NODE_TYPE');
692  --    fnd_message.raise_error;
693      --
694    end if;
695    --
696    hr_utility.set_location(l_proc, 60);
697    --
698 -- changes are done Nitesh
699 
700 if p_node_type IN ('EST','PAR','LOC') then
701      open csr_ent_exists;
702        --
703        fetch csr_ent_exists into l_ent_exists;
704        if csr_ent_exists%found then
705          close csr_ent_exists;
706          fnd_message.set_name('PER', 'HR_289064_PGN_DUP_ENTITY');
707          fnd_message.raise_error;
708        end if;
709        --
710      close csr_ent_exists;
711 end if;
712 
713    end if;
714 --
715    hr_utility.set_location('Leaving: '||l_proc, 70);
716 --
717 end chk_entity_id;
718 --
719 --
720 -- ----------------------------------------------------------------------------
721 -- |---------------------------< chk_hierarchy_version_id >-------------------|
722 -- ----------------------------------------------------------------------------
723 --
724 Procedure chk_hierarchy_version_id
725   ( p_hierarchy_version_id  in per_gen_hierarchy_versions.hierarchy_version_id%TYPE
726   , p_hierarchy_node_id     in per_gen_hierarchy_nodes.hierarchy_node_id%TYPE
727   , p_object_version_number in per_gen_hierarchy_nodes.object_version_number%TYPE
728   )  IS
729 --
730 -- Declare local variables
731 --
732    l_exists  varchar2(1) := 'Y';
733    l_proc  varchar2(72) := g_package||'chk_hierarchy_version_id';
734    l_api_updating   BOOLEAN;
738     from per_gen_hierarchy_versions
735 --
736   cursor csr_hier_vers is
737     select 'Y'
739     where hierarchy_version_id = p_hierarchy_version_id;
740   --
741 Begin
742 --
743   hr_utility.set_location('Entering:'||l_proc, 5);
744 --
745 --
746    l_api_updating := per_pgn_shd.api_updating
747          (p_hierarchy_node_id          =>  p_hierarchy_node_id
748          ,p_object_version_number =>  p_object_version_number);
749 --
750    if ((l_api_updating and
751         nvl(per_pgn_shd.g_old_rec.hierarchy_version_id, hr_api.g_number) <>
752         nvl(p_hierarchy_version_id, hr_api.g_number))
753      or
754         NOT l_api_updating) then
755 --
756    open csr_hier_vers;
757    fetch csr_hier_vers into l_exists;
758    if csr_hier_vers%notfound then
759       close csr_hier_vers;
760       fnd_message.set_name('PER','HR_289065_PGN_INV_HIER_VERS');
761       fnd_message.raise_error;
762    else
763       close csr_hier_vers;
764    end if;
765 --
766    end if;
770 --
767    hr_utility.set_location('Leaving: '||l_proc, 10);
768 end chk_hierarchy_version_id;
769 --
771 --
772 -- ----------------------------------------------------------------------------
773 -- |-------------------------< chk_seq >--------------------------------------|
774 -- ----------------------------------------------------------------------------
775 --
776 PROCEDURE chk_seq
777   (p_seq                      IN per_gen_hierarchy_nodes.seq%TYPE
778   ,p_hierarchy_version_id     IN per_gen_hierarchy_versions.hierarchy_version_id%TYPE
779   ,p_parent_hierarchy_node_id IN per_gen_hierarchy_nodes.parent_hierarchy_node_id%TYPE
780   ,p_hierarchy_node_id        IN per_gen_hierarchy_nodes.hierarchy_node_id%TYPE
781   ,p_object_version_number    IN per_gen_hierarchy_nodes.object_version_number%TYPE
782   )
783 IS
784    l_proc           VARCHAR2(72)  :=  g_package||'chk_seq';
785    l_api_updating   BOOLEAN;
786    --
787    cursor c1 is
788      select seq
789      from   per_gen_hierarchy_nodes
790      where  seq = p_seq
791      and    hierarchy_version_id = p_hierarchy_version_id
792      and    parent_hierarchy_node_id = p_parent_hierarchy_node_id;
793      --
794    --
795    l_seq c1%ROWTYPE;
796 --
797 BEGIN
798 --
799    hr_utility.set_location('Entering:'|| l_proc, 10);
800 --
801 --
802 -- Check if the sequence number is unique for a given parent
803    hr_utility.set_location(l_proc, 20);
804 --
805    l_api_updating := per_pgn_shd.api_updating
806          (p_hierarchy_node_id     =>  p_hierarchy_node_id
807          ,p_object_version_number =>  p_object_version_number);
808 --
809    if ((l_api_updating and
810         nvl(per_pgn_shd.g_old_rec.seq, hr_api.g_number) <>
811         nvl(p_seq, hr_api.g_number))
812      or
813         NOT l_api_updating) then
814         open c1;
815         fetch c1 into l_seq;
816         if c1%found then
817           fnd_message.set_name('PER', 'HR_289066_PGN_INV_SEQ');
818           fnd_message.raise_error;
819         end if;
820         close c1;
821 --
822    hr_utility.set_location(l_proc, 30);
823 --
824         if p_seq < 0 then
825           fnd_message.set_name('PER', 'HR_289082_PGN_NEG_SEQ');
826           fnd_message.raise_error;
827         end if;
828 --
829       end if;
830   hr_utility.set_location('Leaving:'||l_proc, 40);
831 --
832 END chk_seq;
833 --
834 --
835 -- ----------------------------------------------------------------------------
836 -- |-------------------------< chk_node_type >--------------------------------|
837 -- ----------------------------------------------------------------------------
838 --
839 PROCEDURE chk_node_type
840   ( p_node_type               IN per_gen_hierarchy_nodes.node_type%TYPE
841    ,p_effective_date          IN DATE
842    ,p_hierarchy_node_id       IN per_gen_hierarchy_nodes.hierarchy_node_id%TYPE
843    ,p_hierarchy_version_id    IN per_gen_hierarchy_nodes.hierarchy_version_id%TYPE
844    ,p_object_version_number   IN per_gen_hierarchy_nodes.object_version_number%TYPE
845    )
846 IS
847    l_proc           VARCHAR2(72)  :=  g_package||'chk_node_type';
848    l_api_updating   BOOLEAN;
849    l_exists         varchar2(1);
850    --
851    cursor c1 is
852      select 'Y'
853      from   per_gen_hierarchy_nodes
854      where  node_type = 'PAR'
855      and    hierarchy_version_id = p_hierarchy_version_id;
856      --
857    --
858 --
859 BEGIN
860 --
861    hr_utility.set_location('Entering:'|| l_proc, 10);
862 --
863 -- Check mandatory parameters have been set
864 --
865    hr_utility.set_location(l_proc, 20);
866 --
867    hr_api.mandatory_arg_error
868      (p_api_name       => l_proc
869      ,p_argument       => 'effective date'
870      ,p_argument_value => p_effective_date
871      );
872 --
873 -- Check if the node type is valid
874    hr_utility.set_location(l_proc, 30);
875 --
876    l_api_updating := per_pgn_shd.api_updating
877          (p_hierarchy_node_id     =>  p_hierarchy_node_id
878          ,p_object_version_number =>  p_object_version_number);
879 --
880    if ((l_api_updating and
881         nvl(per_pgn_shd.g_old_rec.node_type, hr_api.g_varchar2) <>
882         nvl(p_node_type, hr_api.g_varchar2))
883      or
884         NOT l_api_updating) then
885    if hr_api.NOT_EXISTS_IN_HRSTANLOOKUPS
886              ( p_effective_date  => p_effective_date
887              , p_lookup_type     => 'HIERARCHY_NODE_TYPE'
888              , p_lookup_code     => p_node_type
889              ) then
890      fnd_message.set_name('PER', 'HR_289063_PGN_INV_NODE_TYPE');
891      fnd_message.raise_error;
892 --
893    end if;
894 --
895    hr_utility.set_location(l_proc, 40);
896 --
897    if p_node_type = 'PAR' then
898      open c1;
899      fetch c1 into l_exists;
900      if c1%found then
901        fnd_message.set_name('PER', 'HR_289067_PGN_TOO_MANY_PARENTS');
902        fnd_message.raise_error;
903      end if;
904      close c1;
905    end if;
906 --
907    end if;
908 --
909   hr_utility.set_location('Leaving:'||l_proc, 50);
910 --
911 END chk_node_type;
912 --
913 --
914 -- ----------------------------------------------------------------------------
915 -- |---------------------------< chk_parent_hierarchy_node_id >---------------|
916 -- ----------------------------------------------------------------------------
917 --
918 Procedure chk_parent_hierarchy_node_id
919   (p_parent_hierarchy_node_id  in per_gen_hierarchy_nodes.parent_hierarchy_node_id%TYPE
920   , p_hierarchy_version_id     in per_gen_hierarchy_nodes.hierarchy_version_id%TYPE
921   , p_node_type                in per_gen_hierarchy_nodes.node_type%TYPE
922   ,p_hierarchy_node_id         in per_gen_hierarchy_nodes.hierarchy_node_id%TYPE
923   ,p_object_version_number     in per_gen_hierarchy_nodes.object_version_number%TYPE
924   ) IS
925   --
926   l_proc           varchar2(72) := g_package||'chk_parent_hierarchy_node_id';
927   l_exists         varchar2(1) := 'N';
928   l_api_updating   boolean;
929 --
930   cursor csr_par_node is
931      select 'Y'
932        from per_gen_hierarchy_nodes
933       where hierarchy_version_id = p_hierarchy_version_id
934         and hierarchy_node_id = p_parent_hierarchy_node_id;
935 Begin
936   --
937   hr_utility.set_location('Entering:'||l_proc, 5);
938   -- Check mandatory parameters
939   --
940   hr_utility.set_location(l_proc, 10);
941   --
942    hr_api.mandatory_arg_error
943      (p_api_name       => l_proc
944      ,p_argument       => 'hierarchy_version_id'
945      ,p_argument_value => p_hierarchy_version_id
946      );
947 --
948    l_api_updating := per_pgn_shd.api_updating
949          (p_hierarchy_node_id     =>  p_hierarchy_node_id
950          ,p_object_version_number =>  p_object_version_number);
951 --
952    if ((l_api_updating and
953         nvl(per_pgn_shd.g_old_rec.parent_hierarchy_node_id, hr_api.g_number) <>
954         nvl(p_parent_hierarchy_node_id, hr_api.g_number))
955      or
956         NOT l_api_updating) then
957   --
958   hr_utility.set_location(l_proc, 20);
959   --
960   if p_parent_hierarchy_node_id is not null then
961   --
962   hr_utility.set_location(l_proc, 30);
963   --
964      open csr_par_node;
965      fetch csr_par_node into l_exists;
966      if csr_par_node%notfound then
967         close csr_par_node;
968         fnd_message.set_name('PER', 'HR_289068_PGN_INV_PARENT_ID');
969         fnd_message.raise_error;
970      else
971         close csr_par_node;
972      end if;
973   else
974   --
975   hr_utility.set_location(l_proc, 40);
976   --
977 -- if p_node_type <> 'PAR' then
978 -- fnd_message.set_name('PER', 'HR_289069_PGN_PARENT_ID');
979 -- fnd_message.raise_error;
980 --     end if;
981   end if;
982 end if;
983   hr_utility.set_location('Leaving:'||l_proc,50);
984 end chk_parent_hierarchy_node_id;
985 --
986 --
987 -- ----------------------------------------------------------------------------
988 -- |---------------------------< chk_delete >---------------------------------|
989 -- ----------------------------------------------------------------------------
990 Procedure chk_delete
991   ( p_hierarchy_node_id    in  per_gen_hierarchy_nodes.hierarchy_node_id%TYPE
992   ) is
993 --
994 -- Declare local variables
995 --
996    l_exists       varchar2(1) := 'N';
997    l_proc         varchar2(72) := g_package||'chk_delete';
998 --
999    cursor csr_node_id is
1000      select 'Y'
1001      from   per_gen_hierarchy_nodes
1002      where  parent_hierarchy_node_id = p_hierarchy_node_id;
1003 
1004    cursor csr_ev is
1005     select 'X'
1006     from per_cal_entry_values
1007     where hierarchy_node_id = p_hierarchy_node_id;
1008 --
1009 Begin
1010 --
1011   hr_utility.set_location('Entering :'||l_proc, 5);
1012 -- Check mandatory arguments
1013 --
1014   hr_utility.set_location(l_proc, 10);
1015 --
1016 -- Check if the node has children
1017 --
1018   hr_utility.set_location(l_proc, 20);
1019 --
1020    open csr_node_id;
1021    fetch csr_node_id into l_exists;
1022    if csr_node_id%notfound then
1023       close csr_node_id;
1024    else
1025       close csr_node_id;
1026       fnd_message.set_name('PER', 'HR_289070_PGN_DEL_PARENT');
1027       fnd_message.raise_error;
1028    end if;
1029 
1030    -- check if there is a row referencing this record
1031    -- in the Calendar Module schema before allowing update.
1032    open csr_ev;
1033    fetch csr_ev into l_exists;
1034    if csr_ev%notfound then
1035       close csr_ev;
1036    else
1037       close csr_ev;
1038       fnd_message.set_name('PER', 'HR_449077_CAL_ENTRY_VAL_EXISTS');
1039       fnd_message.raise_error;
1040    end if;
1041 
1042 --
1043   hr_utility.set_location('Leaving :'||l_proc, 10);
1044 --
1045 end chk_delete;
1046 --
1047 --
1048 -- ----------------------------------------------------------------------------
1049 -- |---------------------------< insert_validate >----------------------------|
1050 -- ----------------------------------------------------------------------------
1051 Procedure insert_validate
1052   (p_effective_date               in date
1053   ,p_rec                          in per_pgn_shd.g_rec_type
1054   ) is
1055 --
1056   l_proc  varchar2(72) := g_package||'insert_validate';
1057 --
1058 Begin
1059   hr_utility.set_location('Entering:'||l_proc, 5);
1060   --
1061   -- Call all supporting business operations
1062   --
1063   if p_rec.business_group_id is not null then
1064     hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1065   end if;
1066   --
1067   hr_utility.set_location(l_proc, 10);
1068   --
1069   -- Validate Entity ID
1070   -- ==================
1071   --
1072   chk_entity_id
1073   ( p_entity_id            =>  p_rec.entity_id
1074   , p_business_group_id    =>  p_rec.business_group_id
1075   , p_node_type            =>  p_rec.node_type
1076   , p_hierarchy_version_id =>  p_rec.hierarchy_version_id
1077   );
1078   --
1079   hr_utility.set_location(l_proc, 20);
1080   --
1081   -- Validate Hierarchy Version ID
1082   -- =============================
1083   --
1084   chk_hierarchy_version_id
1085   ( p_hierarchy_version_id  => p_rec.hierarchy_version_id
1086   , p_hierarchy_node_id     => p_rec.hierarchy_node_id
1087   , p_object_version_number => p_rec.object_version_number
1088   );
1089   --
1090   hr_utility.set_location(l_proc, 30);
1091   --
1092   -- Validate Sequence (Seq)
1093   -- ========================
1094   --
1095   chk_seq
1096   ( p_seq                      => p_rec.seq
1097    ,p_hierarchy_version_id     => p_rec.hierarchy_version_id
1098    ,p_parent_hierarchy_node_id => p_rec.parent_hierarchy_node_id
1099    ,p_hierarchy_node_id        => p_rec.hierarchy_node_id
1100    ,p_object_version_number    => p_rec.object_version_number
1101   );
1102   --
1103   hr_utility.set_location(l_proc, 40);
1104   --
1105   -- Validate Hierarchy Node Type
1106   -- ============================
1107   --
1108   chk_node_type
1109   ( p_node_type             => p_rec.node_type
1110    ,p_effective_date        => p_effective_date
1111    ,p_hierarchy_node_id     => p_rec.hierarchy_node_id
1112    ,p_hierarchy_version_id  => p_rec.hierarchy_version_id
1113    ,p_object_version_number => p_rec.object_version_number
1114   );
1115   --
1116   hr_utility.set_location(l_proc, 50);
1117   --
1118   -- Validate Parent Hierarchy Node ID
1119   -- ================================
1120   --
1121   chk_parent_hierarchy_node_id
1122   (p_parent_hierarchy_node_id  => p_rec.parent_hierarchy_node_id
1123   , p_hierarchy_version_id     => p_rec.hierarchy_version_id
1124   , p_node_type                => p_rec.node_type
1125   , p_hierarchy_node_id        => p_rec.hierarchy_node_id
1126   , p_object_version_number    => p_rec.object_version_number
1127   );
1128   --
1129   hr_utility.set_location(l_proc, 60);
1130   --
1131   --
1132   -- Call developer descriptive flexfield validation routines
1133   per_pgn_bus.chk_ddf(p_rec);
1134   --
1135  hr_utility.set_location(l_proc, 65);
1136   --
1137   per_pgn_bus.chk_df(p_rec);
1138   --
1139   hr_utility.set_location(' Leaving:'||l_proc, 70);
1140 End insert_validate;
1141 --
1142 -- ----------------------------------------------------------------------------
1143 -- |---------------------------< update_validate >----------------------------|
1144 -- ----------------------------------------------------------------------------
1145 Procedure update_validate
1146   (p_effective_date               in date
1147   ,p_rec                          in per_pgn_shd.g_rec_type
1148   ) is
1149 --
1150   l_proc  varchar2(72) := g_package||'update_validate';
1151 --
1152 Begin
1153   hr_utility.set_location('Entering:'||l_proc, 5);
1154   --
1155   -- Call all supporting business operations
1156   --
1157   if p_rec.business_group_id is not null then
1158     hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1159   end if;
1160   --
1161   chk_non_updateable_args
1162     (p_effective_date              => p_effective_date
1163       ,p_rec              => p_rec
1164     );
1165   --
1166   --
1167   hr_utility.set_location(l_proc, 10);
1168   --
1169   -- Validate Entity ID
1170   -- ==================
1171   --
1172   chk_entity_id
1173   ( p_entity_id            =>  p_rec.entity_id
1174   , p_business_group_id    =>  p_rec.business_group_id
1175   , p_node_type            =>  p_rec.node_type
1176   , p_hierarchy_version_id =>  p_rec.hierarchy_version_id
1177   );
1178   --
1179    hr_utility.set_location(l_proc, 20);
1180   --
1181   -- Validate Hierarchy Version ID
1182   -- =============================
1183   --
1184   chk_hierarchy_version_id
1185   ( p_hierarchy_version_id  => p_rec.hierarchy_version_id
1186   , p_hierarchy_node_id     => p_rec.hierarchy_node_id
1187   , p_object_version_number => p_rec.object_version_number
1188   );
1189   --
1190   hr_utility.set_location(l_proc, 30);
1191   --
1192   -- Validate Sequence (Seq)
1193   -- ========================
1194   --
1195   chk_seq
1196   ( p_seq                      => p_rec.seq
1197    ,p_hierarchy_version_id     => p_rec.hierarchy_version_id
1198    ,p_parent_hierarchy_node_id => p_rec.parent_hierarchy_node_id
1199    ,p_hierarchy_node_id        => p_rec.hierarchy_node_id
1200    ,p_object_version_number    => p_rec.object_version_number
1201   );
1202   --
1203    hr_utility.set_location(l_proc, 40);
1204   --
1205   -- Validate Parent Hierarchy Node ID
1206   -- ================================
1207   --
1208   chk_parent_hierarchy_node_id
1209   (p_parent_hierarchy_node_id  => p_rec.parent_hierarchy_node_id
1210   , p_hierarchy_version_id     => p_rec.hierarchy_version_id
1211   , p_node_type                => p_rec.node_type
1212   , p_hierarchy_node_id        => p_rec.hierarchy_node_id
1213   , p_object_version_number    => p_rec.object_version_number
1214   );
1215   --
1216   hr_utility.set_location(l_proc, 50);
1217   --
1218   --
1219   -- Call developer descriptive flexfield validation routines
1220   per_pgn_bus.chk_ddf(p_rec);
1221   --
1222   hr_utility.set_location(' Leaving:'||l_proc, 60);
1223   --
1224   per_pgn_bus.chk_df(p_rec);
1225   --
1226   hr_utility.set_location(' Leaving:'||l_proc, 70);
1227 End update_validate;
1228 --
1229 -- ----------------------------------------------------------------------------
1230 -- |---------------------------< delete_validate >----------------------------|
1231 -- ----------------------------------------------------------------------------
1232 Procedure delete_validate
1233   (p_rec                          in per_pgn_shd.g_rec_type
1234   ) is
1235 --
1236   l_proc  varchar2(72) := g_package||'delete_validate';
1237 --
1238 Begin
1239   hr_utility.set_location('Entering:'||l_proc, 5);
1240   --
1241   -- Call all supporting business operations
1242   --
1243   -- Verify if the node included in the record has children
1244   -- ======================================================
1245   --
1246   hr_utility.set_location(l_proc, 10);
1247   --
1248   chk_delete
1249   ( p_hierarchy_node_id    =>  p_rec.hierarchy_node_id
1250   );
1251   --
1252   hr_utility.set_location(' Leaving:'||l_proc, 20);
1253 End delete_validate;
1254 --
1255 end per_pgn_bus;