[Home] [Help]
PACKAGE BODY: APPS.HR_PDT_BUS
Source
1 Package Body hr_pdt_bus as
2 /* $Header: hrpdtrhi.pkb 120.6.12020000.2 2012/07/04 23:18:52 amnaraya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_pdt_bus.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code varchar2(150) default null;
15 g_person_deployment_id number default null;
16 --
17 -- ---------------------------------------------------------------------------
18 -- |----------------------< set_security_group_id >--------------------------|
19 -- ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22 (p_person_deployment_id in number
23 ) is
24 --
25 -- Declare cursor
26 --
27 cursor csr_sec_grp is
28 select pbg.security_group_id,
29 pbg.legislation_code
30 from per_business_groups_perf pbg
31 , hr_person_deployments pdt
32 where pdt.person_deployment_id = p_person_deployment_id
33 and pbg.business_group_id = pdt.to_business_group_id;
34 --
35 -- Declare local variables
36 --
37 l_security_group_id number;
38 l_proc varchar2(72) := g_package||'set_security_group_id';
39 l_legislation_code varchar2(150);
40 --
41 begin
42 --
43 hr_utility.set_location('Entering:'|| l_proc, 10);
44 --
45 -- Ensure that all the mandatory parameter are not null
46 --
47 hr_api.mandatory_arg_error
48 (p_api_name => l_proc
49 ,p_argument => 'person_deployment_id'
50 ,p_argument_value => p_person_deployment_id
51 );
52 --
53 open csr_sec_grp;
54 fetch csr_sec_grp into l_security_group_id
55 , l_legislation_code;
56 --
57 if csr_sec_grp%notfound then
58 --
59 close csr_sec_grp;
60 --
61 -- The primary key is invalid therefore we must error
62 --
63 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
64 fnd_message.raise_error;
65 --
66 else
67 close csr_sec_grp;
68 --
69 -- Set the security_group_id in CLIENT_INFO
70 --
71 hr_api.set_security_group_id
72 (p_security_group_id => l_security_group_id
73 );
74 --
75 -- Set the sessions legislation context in HR_SESSION_DATA
76 --
77 hr_api.set_legislation_context(l_legislation_code);
78 end if;
79 --
80 hr_utility.set_location(' Leaving:'|| l_proc, 20);
81 --
82 end set_security_group_id;
83 --
84 -- ---------------------------------------------------------------------------
85 -- |---------------------< return_legislation_code >-------------------------|
86 -- ---------------------------------------------------------------------------
87 --
88 Function return_legislation_code
89 (p_person_deployment_id in number
90 )
91 Return Varchar2 Is
92 --
93 -- Declare cursor
94 --
95 cursor csr_leg_code is
96 select pbg.legislation_code
97 from per_business_groups_perf pbg
98 , hr_person_deployments pdt
99 where pdt.person_deployment_id = p_person_deployment_id
100 and pbg.business_group_id = pdt.to_business_group_id;
101 --
102 -- Declare local variables
103 --
104 l_legislation_code varchar2(150);
105 l_proc varchar2(72) := g_package||'return_legislation_code';
106 --
107 Begin
108 --
109 hr_utility.set_location('Entering:'|| l_proc, 10);
110 --
111 -- Ensure that all the mandatory parameter are not null
112 --
113 hr_api.mandatory_arg_error
114 (p_api_name => l_proc
115 ,p_argument => 'person_deployment_id'
116 ,p_argument_value => p_person_deployment_id
117 );
118 --
119 if ( nvl(hr_pdt_bus.g_person_deployment_id, hr_api.g_number)
120 = p_person_deployment_id) then
121 --
122 -- The legislation code has already been found with a previous
123 -- call to this function. Just return the value in the global
124 -- variable.
125 --
126 l_legislation_code := hr_pdt_bus.g_legislation_code;
127 hr_utility.set_location(l_proc, 20);
128 else
129 --
130 -- The ID is different to the last call to this function
131 -- or this is the first call to this function.
132 --
133 open csr_leg_code;
134 fetch csr_leg_code into l_legislation_code;
135 --
136 if csr_leg_code%notfound then
137 --
138 -- The primary key is invalid therefore we must error
139 --
140 close csr_leg_code;
141 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
142 fnd_message.raise_error;
143 end if;
144 hr_utility.set_location(l_proc,30);
145 --
146 -- Set the global variables so the values are
147 -- available for the next call to this function.
148 --
149 close csr_leg_code;
150 hr_pdt_bus.g_person_deployment_id := p_person_deployment_id;
151 hr_pdt_bus.g_legislation_code := l_legislation_code;
152 end if;
153 hr_utility.set_location(' Leaving:'|| l_proc, 40);
154 return l_legislation_code;
155 end return_legislation_code;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |-----------------------------< chk_ddf >----------------------------------|
159 -- ----------------------------------------------------------------------------
160 --
161 -- Description:
162 -- Validates all the Developer Descriptive Flexfield values.
163 --
164 -- Prerequisites:
165 -- All other columns have been validated. Must be called as the
166 -- last step from insert_validate and update_validate.
167 --
168 -- In Arguments:
169 -- p_rec
170 --
171 -- Post Success:
172 -- If the Developer Descriptive Flexfield structure column and data values
173 -- are all valid this procedure will end normally and processing will
174 -- continue.
175 --
176 -- Post Failure:
177 -- If the Developer Descriptive Flexfield structure column value or any of
178 -- the data values are invalid then an application error is raised as
179 -- a PL/SQL exception.
180 --
181 -- Access Status:
182 -- Internal Row Handler Use Only.
183 --
184 -- ----------------------------------------------------------------------------
185 procedure chk_ddf
186 (p_rec in hr_pdt_shd.g_rec_type
187 ) is
188 --
189 l_proc varchar2(72) := g_package || 'chk_ddf';
190 --
191 begin
192 hr_utility.set_location('Entering:'||l_proc,10);
193 --
194 if ((p_rec.person_deployment_id is not null) and (
195 nvl(hr_pdt_shd.g_old_rec.per_information_category, hr_api.g_varchar2) <>
196 nvl(p_rec.per_information_category, hr_api.g_varchar2) or
197 nvl(hr_pdt_shd.g_old_rec.per_information1, hr_api.g_varchar2) <>
198 nvl(p_rec.per_information1, hr_api.g_varchar2) or
199 nvl(hr_pdt_shd.g_old_rec.per_information2, hr_api.g_varchar2) <>
200 nvl(p_rec.per_information2, hr_api.g_varchar2) or
201 nvl(hr_pdt_shd.g_old_rec.per_information3, hr_api.g_varchar2) <>
202 nvl(p_rec.per_information3, hr_api.g_varchar2) or
203 nvl(hr_pdt_shd.g_old_rec.per_information4, hr_api.g_varchar2) <>
204 nvl(p_rec.per_information4, hr_api.g_varchar2) or
205 nvl(hr_pdt_shd.g_old_rec.per_information5, hr_api.g_varchar2) <>
206 nvl(p_rec.per_information5, hr_api.g_varchar2) or
207 nvl(hr_pdt_shd.g_old_rec.per_information6, hr_api.g_varchar2) <>
208 nvl(p_rec.per_information6, hr_api.g_varchar2) or
209 nvl(hr_pdt_shd.g_old_rec.per_information7, hr_api.g_varchar2) <>
210 nvl(p_rec.per_information7, hr_api.g_varchar2) or
211 nvl(hr_pdt_shd.g_old_rec.per_information8, hr_api.g_varchar2) <>
212 nvl(p_rec.per_information8, hr_api.g_varchar2) or
213 nvl(hr_pdt_shd.g_old_rec.per_information9, hr_api.g_varchar2) <>
214 nvl(p_rec.per_information9, hr_api.g_varchar2) or
215 nvl(hr_pdt_shd.g_old_rec.per_information10, hr_api.g_varchar2) <>
216 nvl(p_rec.per_information10, hr_api.g_varchar2) or
217 nvl(hr_pdt_shd.g_old_rec.per_information11, hr_api.g_varchar2) <>
218 nvl(p_rec.per_information11, hr_api.g_varchar2) or
219 nvl(hr_pdt_shd.g_old_rec.per_information12, hr_api.g_varchar2) <>
220 nvl(p_rec.per_information12, hr_api.g_varchar2) or
221 nvl(hr_pdt_shd.g_old_rec.per_information13, hr_api.g_varchar2) <>
222 nvl(p_rec.per_information13, hr_api.g_varchar2) or
223 nvl(hr_pdt_shd.g_old_rec.per_information14, hr_api.g_varchar2) <>
224 nvl(p_rec.per_information14, hr_api.g_varchar2) or
225 nvl(hr_pdt_shd.g_old_rec.per_information15, hr_api.g_varchar2) <>
226 nvl(p_rec.per_information15, hr_api.g_varchar2) or
227 nvl(hr_pdt_shd.g_old_rec.per_information16, hr_api.g_varchar2) <>
228 nvl(p_rec.per_information16, hr_api.g_varchar2) or
229 nvl(hr_pdt_shd.g_old_rec.per_information17, hr_api.g_varchar2) <>
230 nvl(p_rec.per_information17, hr_api.g_varchar2) or
231 nvl(hr_pdt_shd.g_old_rec.per_information18, hr_api.g_varchar2) <>
232 nvl(p_rec.per_information18, hr_api.g_varchar2) or
233 nvl(hr_pdt_shd.g_old_rec.per_information19, hr_api.g_varchar2) <>
234 nvl(p_rec.per_information19, hr_api.g_varchar2) or
235 nvl(hr_pdt_shd.g_old_rec.per_information20, hr_api.g_varchar2) <>
236 nvl(p_rec.per_information20, hr_api.g_varchar2) or
237 nvl(hr_pdt_shd.g_old_rec.per_information21, hr_api.g_varchar2) <>
238 nvl(p_rec.per_information21, hr_api.g_varchar2) or
239 nvl(hr_pdt_shd.g_old_rec.per_information22, hr_api.g_varchar2) <>
240 nvl(p_rec.per_information22, hr_api.g_varchar2) or
241 nvl(hr_pdt_shd.g_old_rec.per_information23, hr_api.g_varchar2) <>
242 nvl(p_rec.per_information23, hr_api.g_varchar2) or
243 nvl(hr_pdt_shd.g_old_rec.per_information24, hr_api.g_varchar2) <>
244 nvl(p_rec.per_information24, hr_api.g_varchar2) or
245 nvl(hr_pdt_shd.g_old_rec.per_information25, hr_api.g_varchar2) <>
246 nvl(p_rec.per_information25, hr_api.g_varchar2) or
247 nvl(hr_pdt_shd.g_old_rec.per_information26, hr_api.g_varchar2) <>
248 nvl(p_rec.per_information26, hr_api.g_varchar2) or
249 nvl(hr_pdt_shd.g_old_rec.per_information27, hr_api.g_varchar2) <>
250 nvl(p_rec.per_information27, hr_api.g_varchar2) or
251 nvl(hr_pdt_shd.g_old_rec.per_information28, hr_api.g_varchar2) <>
252 nvl(p_rec.per_information28, hr_api.g_varchar2) or
253 nvl(hr_pdt_shd.g_old_rec.per_information29, hr_api.g_varchar2) <>
254 nvl(p_rec.per_information29, hr_api.g_varchar2) or
255 nvl(hr_pdt_shd.g_old_rec.per_information30, hr_api.g_varchar2) <>
256 nvl(p_rec.per_information30, hr_api.g_varchar2) ))
257 or (p_rec.person_deployment_id is null) then
258 --
259 -- Only execute the validation if absolutely necessary:
260 -- a) During update, the structure column value or any
261 -- of the attribute values have actually changed.
262 -- b) During insert.
263 --
264 hr_dflex_utility.ins_or_upd_descflex_attribs
265 (p_appl_short_name => 'PER'
266 ,p_descflex_name => 'Person Developer DF'
267 ,p_attribute_category => p_rec.per_information_category
268 ,p_attribute1_name => 'PER_INFORMATION1'
269 ,p_attribute1_value => p_rec.per_information1
270 ,p_attribute2_name => 'PER_INFORMATION2'
271 ,p_attribute2_value => p_rec.per_information2
272 ,p_attribute3_name => 'PER_INFORMATION3'
273 ,p_attribute3_value => p_rec.per_information3
274 ,p_attribute4_name => 'PER_INFORMATION4'
275 ,p_attribute4_value => p_rec.per_information4
276 ,p_attribute5_name => 'PER_INFORMATION5'
277 ,p_attribute5_value => p_rec.per_information5
278 ,p_attribute6_name => 'PER_INFORMATION6'
279 ,p_attribute6_value => p_rec.per_information6
280 ,p_attribute7_name => 'PER_INFORMATION7'
281 ,p_attribute7_value => p_rec.per_information7
282 ,p_attribute8_name => 'PER_INFORMATION8'
283 ,p_attribute8_value => p_rec.per_information8
284 ,p_attribute9_name => 'PER_INFORMATION9'
285 ,p_attribute9_value => p_rec.per_information9
286 ,p_attribute10_name => 'PER_INFORMATION10'
287 ,p_attribute10_value => p_rec.per_information10
288 ,p_attribute11_name => 'PER_INFORMATION11'
289 ,p_attribute11_value => p_rec.per_information11
290 ,p_attribute12_name => 'PER_INFORMATION12'
291 ,p_attribute12_value => p_rec.per_information12
292 ,p_attribute13_name => 'PER_INFORMATION13'
293 ,p_attribute13_value => p_rec.per_information13
294 ,p_attribute14_name => 'PER_INFORMATION14'
295 ,p_attribute14_value => p_rec.per_information14
296 ,p_attribute15_name => 'PER_INFORMATION15'
297 ,p_attribute15_value => p_rec.per_information15
298 ,p_attribute16_name => 'PER_INFORMATION16'
299 ,p_attribute16_value => p_rec.per_information16
300 ,p_attribute17_name => 'PER_INFORMATION17'
301 ,p_attribute17_value => p_rec.per_information17
302 ,p_attribute18_name => 'PER_INFORMATION18'
303 ,p_attribute18_value => p_rec.per_information18
304 ,p_attribute19_name => 'PER_INFORMATION19'
305 ,p_attribute19_value => p_rec.per_information19
306 ,p_attribute20_name => 'PER_INFORMATION20'
307 ,p_attribute20_value => p_rec.per_information20
308 ,p_attribute21_name => 'PER_INFORMATION21'
309 ,p_attribute21_value => p_rec.per_information21
310 ,p_attribute22_name => 'PER_INFORMATION22'
311 ,p_attribute22_value => p_rec.per_information22
312 ,p_attribute23_name => 'PER_INFORMATION23'
313 ,p_attribute23_value => p_rec.per_information23
314 ,p_attribute24_name => 'PER_INFORMATION24'
315 ,p_attribute24_value => p_rec.per_information24
316 ,p_attribute25_name => 'PER_INFORMATION25'
317 ,p_attribute25_value => p_rec.per_information25
318 ,p_attribute26_name => 'PER_INFORMATION26'
319 ,p_attribute26_value => p_rec.per_information26
320 ,p_attribute27_name => 'PER_INFORMATION27'
321 ,p_attribute27_value => p_rec.per_information27
322 ,p_attribute28_name => 'PER_INFORMATION28'
323 ,p_attribute28_value => p_rec.per_information28
324 ,p_attribute29_name => 'PER_INFORMATION29'
325 ,p_attribute29_value => p_rec.per_information29
326 ,p_attribute30_name => 'PER_INFORMATION30'
327 ,p_attribute30_value => p_rec.per_information30
328 );
329 end if;
330 --
331 hr_utility.set_location(' Leaving:'||l_proc,20);
332 end chk_ddf;
333 --
334 -- ----------------------------------------------------------------------------
335 -- |-----------------------< chk_non_updateable_args >------------------------|
336 -- ----------------------------------------------------------------------------
337 -- {Start Of Comments}
338 --
339 -- Description:
340 -- This procedure is used to ensure that non updateable attributes have
341 -- not been updated. If an attribute has been updated an error is generated.
342 --
343 -- Pre Conditions:
344 -- g_old_rec has been populated with details of the values currently in
345 -- the database.
346 --
347 -- In Arguments:
348 -- p_rec has been populated with the updated values the user would like the
349 -- record set to.
350 --
351 -- Post Success:
352 -- Processing continues if all the non updateable attributes have not
353 -- changed.
354 --
355 -- Post Failure:
356 -- An application error is raised if any of the non updatable attributes
357 -- have been altered.
358 --
359 -- {End Of Comments}
360 -- ----------------------------------------------------------------------------
361 Procedure chk_non_updateable_args
362 (p_rec in hr_pdt_shd.g_rec_type
363 ) IS
364 --
365 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
366 l_error exception;
367 l_argument varchar2(30);
368 --
369 Begin
370 --
371 hr_utility.set_location('Entering:'|| l_proc,10);
372 --
373 -- Only proceed with the validation if a row exists for the current
374 -- record in the HR Schema.
375 --
376 IF NOT hr_pdt_shd.api_updating
377 (p_person_deployment_id => p_rec.person_deployment_id
378 ,p_object_version_number => p_rec.object_version_number
379 ) THEN
380 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
381 fnd_message.set_token('PROCEDURE ', l_proc);
382 fnd_message.set_token('STEP ', '5');
383 fnd_message.raise_error;
384 END IF;
385 --
386 if nvl(p_rec.from_business_group_id,hr_api.g_number)
387 <> nvl(hr_pdt_shd.g_old_rec.from_business_group_id,hr_api.g_number) then
388 l_argument := 'from_business_group';
389 raise l_error;
390 end if;
391 --
392 if nvl(p_rec.to_business_group_id,hr_api.g_number)
393 <> nvl(hr_pdt_shd.g_old_rec.to_business_group_id,hr_api.g_number) then
394 l_argument := 'to_business_group';
395 raise l_error;
396 end if;
397 --
398 if nvl(p_rec.from_person_id,hr_api.g_number)
399 <> nvl(hr_pdt_shd.g_old_rec.from_person_id,hr_api.g_number) then
400 l_argument := 'from_person_id';
401 raise l_error;
402 end if;
403 --
404 if nvl(p_rec.permanent,hr_api.g_number)
405 <> nvl(hr_pdt_shd.g_old_rec.permanent,hr_api.g_number) then
406 l_argument := 'permanent';
407 raise l_error;
408 end if;
409 --
410 --
411 hr_utility.set_location(' Leaving : '|| l_proc, 30);
412 --
413 exception
414 when l_error then
415 hr_api.argument_changed_error
416 (p_api_name => l_proc
417 ,p_argument => l_argument);
418 when others then
419 raise;
420 End chk_non_updateable_args;
421 --
422 -- ---------------------------------------------------------------------------
423 -- |------------------------< chk_business_groups >--------------------------|
424 -- ---------------------------------------------------------------------------
425 --
426 -- Desciption:
427 -- This procedures validates that both from and to business group ids exist
428 -- in per_business_groups
429 --
430 -- Pre-conditions :
431 -- None
432 --
433 -- In Parameters :
434 -- p_from_business_group_id
435 -- p_to_business_group_id
436 --
437 -- Post Success :
438 -- Processing continues if the is valid
439 --
440 -- Post Failure :
441 -- An application error will be raised and processing is terminated if the
442 -- is invalid
443 --
444 -- Access Status :
445 -- Internal Row Handler Use only.
446 --
447 -- {End of Comments}
448 --
449 -- ---------------------------------------------------------------------------
450 Procedure chk_business_groups
451 (p_from_business_group_id in hr_person_deployments.from_business_group_id%type
452 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
453 ) is
454 --
455 l_proc varchar2(72) := g_package||'chk_business_groups';
456 l_dummy number;
457 --
458 cursor csr_bg_exists(p_bg_id in number) is
459 select 1
460 from per_business_groups_perf
461 where business_group_id = p_bg_id;
462 begin
463 hr_utility.set_location('Entering:'||l_proc, 10);
464 --
465 hr_api.mandatory_arg_error
466 (p_api_name => l_proc
467 ,p_argument => 'from_business_group_id'
468 ,p_argument_value => p_from_business_group_id
469 );
470 --
471 hr_api.mandatory_arg_error
472 (p_api_name => l_proc
473 ,p_argument => 'to_business_group_id'
474 ,p_argument_value => p_to_business_group_id
475 );
476 --
477 open csr_bg_exists(p_from_business_group_id);
478 fetch csr_bg_exists into l_dummy;
479 if csr_bg_exists%notfound then
480 close csr_bg_exists;
481 fnd_message.set_name('PER','HR_449627_PDT_FROM_BG_NOTEXIST');
482 hr_multi_message.add
483 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.FROM_BUSINESS_GROUP_ID');
484 else
485 close csr_bg_exists;
486 end if;
487 --
488 open csr_bg_exists(p_to_business_group_id);
489 fetch csr_bg_exists into l_dummy;
490 if csr_bg_exists%notfound then
491 close csr_bg_exists;
492 fnd_message.set_name('PER','HR_449628_PDT_TO_BG_NOTEXIST');
493 hr_multi_message.add
494 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID');
495 else
496 close csr_bg_exists;
497 end if;
498 --
499 hr_utility.set_location('Leaving:'||l_proc, 20);
500 --
501 end chk_business_groups;
502 --
503 -- ---------------------------------------------------------------------------
504 -- |------------------------< chk_from_person_id >---------------------------|
505 -- ---------------------------------------------------------------------------
506 --
507 -- Desciption:
508 -- This procedures validates that the from person id exists on the start date in
509 -- the from business group in per_all_people_f
510 --
511 -- Pre-conditions :
512 -- None
513 --
514 -- In Parameters :
515 -- p_from_person_id
516 -- p_from_business_group_id
517 -- p_start_date
518 --
519 -- Post Success :
520 -- Processing continues if the is valid
521 --
522 -- Post Failure :
523 -- An application error will be raised and processing is terminated if the
524 -- is invalid
525 --
526 -- Access Status :
527 -- Internal Row Handler Use only.
528 --
529 -- {End of Comments}
530 --
531 -- ---------------------------------------------------------------------------
532 Procedure chk_from_person_id
533 (p_person_deployment_id in hr_person_deployments.person_deployment_id%type
534 ,p_object_version_number in hr_person_deployments.object_version_number%type
535 ,p_from_person_id in hr_person_deployments.from_person_id%type
536 ,p_from_business_group_id in hr_person_deployments.from_business_group_id%type
537 ,p_start_date in date
538 ) is
539 --
540 l_proc varchar2(72) := g_package||'chk_from_person_id';
541 l_dummy number;
542 l_api_updating boolean;
543 --
544 cursor csr_check_person(p_person_id number, p_effective_date in date) is
545 select 1
546 from per_all_people_f per,
547 per_periods_of_service pds
548 where per.person_id = p_person_id
549 and p_effective_date between
550 per.effective_start_date and per.effective_end_date
551 and per.business_group_id = p_from_business_group_id
552 and pds.person_id = per.person_id
553 and p_start_date between
554 pds.date_start and nvl(pds.actual_termination_date,hr_api.g_eot);
555 --
556 begin
557 hr_utility.set_location('Entering:'||l_proc, 10);
558 --
559 -- Check mandatory parameters have been set
560 --
561 hr_api.mandatory_arg_error
562 (p_api_name => l_proc
563 ,p_argument => 'from_business_group_id'
564 ,p_argument_value => p_from_business_group_id
565 );
566 --
567 hr_api.mandatory_arg_error
568 (p_api_name => l_proc
569 ,p_argument => 'from_person_id'
570 ,p_argument_value => p_from_person_id
571 );
572 --
573 hr_api.mandatory_arg_error
574 (p_api_name => l_proc
575 ,p_argument => 'start_date'
576 ,p_argument_value => p_start_date
577 );
578 --
579 if hr_multi_message.no_exclusive_error
580 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.FROM_BUSINESS_GROUP_ID'
581 ) then
582 --
583 l_api_updating := hr_pdt_shd.api_updating
584 (p_person_deployment_id => p_person_deployment_id
585 ,p_object_version_number => p_object_version_number);
586 --
587 --
588 -- Only proceed with validation if:
589 -- a) rec is being inserted or
590 -- b) rec is updating and the g_old_rec is not current value
591 --
592 if ( (l_api_updating and (hr_pdt_shd.g_old_rec.start_date <> p_start_date))
593 or not l_api_updating)
594 then
595 open csr_check_person(p_from_person_id, p_start_date);
596 fetch csr_check_person into l_dummy;
597 if csr_check_person%notfound then
598 close csr_check_person;
599 --
600 fnd_message.set_name('PER','HR_449629_PDT_FR_PER_NOTEXIST');
601 fnd_message.raise_error;
602 else
603 close csr_check_person;
604 end if;
605 --
606 end if;
607 end if;
608 --
609 hr_utility.set_location('Leaving:'||l_proc, 20);
610 --
611 exception
612 when app_exception.application_exception then
613 if hr_multi_message.exception_add
614 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.FROM_PERSON_ID'
615 ) then
616 hr_utility.set_location(' Leaving:'||l_proc, 50);
617 raise;
618 end if;
619 hr_utility.set_location(' Leaving:'||l_proc,60);
620 end chk_from_person_id;
621 --
622 -- ---------------------------------------------------------------------------
623 -- |------------------------< chk_to_person_id >-----------------------------|
624 -- ---------------------------------------------------------------------------
625 --
626 -- Desciption:
627 -- This procedures validates that if specified, the to person id exists on the
628 -- start date in to business group in per_all_people_f, and the to_person_id is
629 -- not of type EMP,CWK, or APL on the start_date or in the future
630 --
631 -- Pre-conditions :
632 -- None
633 --
634 -- In Parameters :
635 -- p_to_person_id
636 -- p_to_business_group_id
637 -- p_start_date
638 -- p_status
639 --
640 -- Post Success :
641 -- Processing continues if the to_person_id is valid
642 --
643 -- Post Failure :
644 -- An application error will be raised and processing is terminated if the
645 -- to_person_id is invalid
646 --
647 -- Access Status :
648 -- Internal Row Handler Use only.
649 --
650 -- {End of Comments}
651 --
652 -- ---------------------------------------------------------------------------
653 Procedure chk_to_person_id
654 (p_person_deployment_id in hr_person_deployments.person_deployment_id%type
655 ,p_object_version_number in hr_person_deployments.object_version_number%type
656 ,p_to_person_id in hr_person_deployments.to_person_id%type
657 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
658 ,p_start_date in date
659 ,p_status in hr_person_deployments.status%type
660 ) is
661 --
662 l_proc varchar2(72) := g_package||'chk_to_person_id';
663 l_dummy number;
664 l_api_updating boolean;
665 --
666 cursor csr_check_person(p_person_id number) is
667 select per.person_id
668 from per_all_people_f per
669 where per.person_id = p_person_id
670 and p_start_date between
671 per.effective_start_date and per.effective_end_date
672 and per.business_group_id = p_to_business_group_id;
673 --
674 cursor csr_check_per_type(p_person_id number) is
675 select ptu.person_type_id
676 from per_person_type_usages_f ptu,
677 per_person_types ppt
678 where ptu.person_id = p_person_id
679 and ptu.person_type_id = ppt.person_type_id
680 and ppt.system_person_type in ('EMP','CWK','APL')
681 and ptu.effective_end_date >= p_start_date;
682 --
683 cursor csr_check_per_type2(p_person_id number) is
684 select ptu.person_type_id
685 from per_person_type_usages_f ptu,
686 per_person_types ppt
687 where ptu.person_id = p_person_id
688 and ptu.person_type_id = ppt.person_type_id
689 and ppt.system_person_type in ('EMP','CWK','APL')
690 and ptu.effective_start_date > p_start_date
691 and not exists (select 1
692 from per_person_type_usages_f ptu1,
693 per_person_types ppt1
694 where ptu.person_type_usage_id = ptu1.person_type_usage_id
695 and ptu1.person_type_id = ppt1.person_type_id
696 and ppt1.system_person_type in ('EMP','CWK','APL')
697 and ptu1.effective_start_date = p_start_date);
698 --
699 begin
700 hr_utility.set_location('Entering:'||l_proc, 10);
701 --
702 -- Check mandatory parameters have been set
703 --
704 hr_api.mandatory_arg_error
705 (p_api_name => l_proc
706 ,p_argument => 'to_business_group_id'
707 ,p_argument_value => p_to_business_group_id
708 );
709 --
710 hr_api.mandatory_arg_error
711 (p_api_name => l_proc
712 ,p_argument => 'start_date'
713 ,p_argument_value => p_start_date
714 );
715 --
716 hr_api.mandatory_arg_error
717 (p_api_name => l_proc
718 ,p_argument => 'status'
719 ,p_argument_value => p_status
720 );
721 --
722 if hr_multi_message.no_exclusive_error
723 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.FROM_BUSINESS_GROUP_ID'
724 ) then
725 --
726 l_api_updating := hr_pdt_shd.api_updating
727 (p_person_deployment_id => p_person_deployment_id
728 ,p_object_version_number => p_object_version_number);
729 --
730 --
731 -- Only proceed with validation if:
732 -- a) rec is being inserted or
733 -- b) rec is updating and the g_old_rec is not current value
734 --
735 if ( (l_api_updating and
736 ( hr_pdt_shd.g_old_rec.start_date <> p_start_date
737 or nvl(hr_pdt_shd.g_old_rec.to_person_id,hr_api.g_number)
738 <> nvl(p_to_person_id,hr_api.g_number)))
739 or not l_api_updating)
740 then
741 if p_to_person_id is not null then
742
743 open csr_check_person(p_to_person_id);
744 fetch csr_check_person into l_dummy;
745 if csr_check_person%notfound then
746 close csr_check_person;
747 --
748 fnd_message.set_name('PER','HR_449630_PDT_TO_PER_NOTEXIST');
749 fnd_message.raise_error;
750 else
751 close csr_check_person;
752 --
753 -- only check person type in host if we are in DRAFT status or
754 -- upon initiation when DRAFT becomes ACTIVE
755 --
756 if p_status='DRAFT' then
757 --
758 open csr_check_per_type(p_to_person_id);
759 fetch csr_check_per_type into l_dummy;
760 if csr_check_per_type%found then
761 close csr_check_per_type;
762 fnd_message.set_name('PER','HR_449631_PDT_TO_PER_FUT_PER');
763 fnd_message.raise_error;
764 else
765 close csr_check_per_type;
766 end if; --check future person types
767 --
768 elsif p_status='ACTIVE' and hr_pdt_shd.g_old_rec.status='DRAFT' then
769 --
770 open csr_check_per_type2(p_to_person_id);
771 fetch csr_check_per_type2 into l_dummy;
772 if csr_check_per_type2%found then
773 close csr_check_per_type2;
774 fnd_message.set_name('PER','HR_449631_PDT_TO_PER_FUT_PER');
775 fnd_message.raise_error;
776 else
777 close csr_check_per_type2;
778 end if; --check future person types
779 --
780 end if; --status checks
781 end if; --check person
782 --
783 end if; --to_person_id not null
784 --
785 if p_to_person_id is null and (p_status='ACTIVE' or p_status='COMPLETE') then
786 fnd_message.set_name('PER','HR_449632_PDT_TO_PER_NULL');
787 fnd_message.raise_error;
788 end if; --status check
789 --
790 end if; --api updating
791 end if; --multi message
792 --
793 hr_utility.set_location('Leaving:'||l_proc, 20);
794 --
795 exception
796 when app_exception.application_exception then
797 if hr_multi_message.exception_add
798 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.TO_PERSON_ID'
799 ) then
800 hr_utility.set_location(' Leaving:'||l_proc, 50);
801 raise;
802 end if;
803 hr_utility.set_location(' Leaving:'||l_proc,60);
804 end chk_to_person_id;
805 --
806 -- ---------------------------------------------------------------------------
807 -- |------------------------< chk_person_type_id >----------------------------|
808 -- ---------------------------------------------------------------------------
809 --
810 -- Desciption:
811 -- This procedures validates that person type is valid in the to business group
812 -- and is of type EMP, and is active
813 --
814 -- Pre-conditions :
815 -- None
816 --
817 -- In Parameters :
818 -- p_person_type_id
819 -- p_to_business_group_id
820 --
821 -- Post Success :
822 -- Processing continues if the person type id is valid
823 --
824 -- Post Failure :
825 -- An application error will be raised and processing is terminated if the
826 -- person type id is invalid
827 --
828 -- Access Status :
829 -- Internal Row Handler Use only.
830 --
831 -- {End of Comments}
832 --
833 -- ---------------------------------------------------------------------------
834 Procedure chk_person_type_id
835 (p_person_type_id in hr_person_deployments.person_type_id%type
836 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
837 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
838 ,p_object_version_number in hr_person_deployments.object_version_number%type
839 ) is
840 --
841 l_proc varchar2(72) := g_package||'chk_';
842 l_api_updating boolean;
843 l_sys_type per_person_types.system_person_type%type;
844 l_bg_id per_person_types.business_group_id%type;
845 l_active_flag per_person_types.active_flag%type;
846 --
847 cursor csr_check_per_type is
848 select system_person_type,business_group_id,active_flag
849 from per_person_types
850 where person_type_id = p_person_type_id;
851 --
852 begin
853 hr_utility.set_location('Entering:'||l_proc, 10);
854 --
855 hr_api.mandatory_arg_error
856 (p_api_name => l_proc
857 ,p_argument => 'to_business_group_id'
858 ,p_argument_value => p_to_business_group_id
859 );
860 --
861 if hr_multi_message.no_all_inclusive_error
862 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
863 ) then
864 --
865 l_api_updating := hr_pdt_shd.api_updating
866 (p_person_deployment_id => p_person_deployment_id
867 ,p_object_version_number => p_object_version_number);
868 --
869 if (( (l_api_updating and
870 (nvl(hr_pdt_shd.g_old_rec.person_type_id,hr_api.g_number)
871 <> nvl(p_person_type_id,hr_api.g_number)))
872 or not l_api_updating)
873 and p_person_type_id is not null) then
874 --
875 open csr_check_per_type;
876 fetch csr_check_per_type into l_sys_type,l_bg_id,l_active_flag;
877 if csr_check_per_type%notfound then
878 close csr_check_per_type;
879 fnd_message.set_name('PER','HR_7513_PER_TYPE_INVALID');
880 fnd_message.raise_error;
881 else
882 close csr_check_per_type;
883 --
884 if l_sys_type <> 'EMP' then
885 fnd_message.set_name('PER','HR_7513_PER_TYPE_INVALID');
886 fnd_message.raise_error;
887 end if;
888 if l_bg_id <> p_to_business_group_id then
889 fnd_message.set_name('PER','HR_7974_PER_TYPE_INV_BUS_GROUP');
890 fnd_message.raise_error;
891 end if;
892 if l_active_flag <> 'Y' then
893 fnd_message.set_name('PER','HR_7973_PER_TYPE_NOT_ACTIVE');
894 fnd_message.raise_error;
895 end if;
896 end if; --csr notfound
897
898 end if; --api updating
899 end if; --multi message
900 --
901 hr_utility.set_location('Leaving:'||l_proc, 20);
902 --
903 exception
904 when app_exception.application_exception then
905 if hr_multi_message.exception_add
906 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PERSON_TYPE_ID'
907 ) then
908 hr_utility.set_location(' Leaving:'||l_proc, 50);
909 raise;
910 end if;
911 hr_utility.set_location(' Leaving:'||l_proc,60);
912 end chk_person_type_id;
913 --
914 -- ---------------------------------------------------------------------------
915 -- |------------------------< chk_start_end_date >---------------------------|
916 -- ---------------------------------------------------------------------------
917 --
918 -- Desciption:
919 -- This procedures validates that the start date is not greater than the end date
920 --
921 -- Pre-conditions :
922 -- None
923 --
924 -- In Parameters :
925 -- p_start_date
926 -- p_end_date
927 --
928 -- Post Success :
929 -- Processing continues if the dates are valid
930 --
931 -- Post Failure :
932 -- An application error will be raised and processing is terminated if the
933 -- dates are invalid
934 --
935 -- Access Status :
936 -- Internal Row Handler Use only.
937 --
938 -- {End of Comments}
939 --
940 -- ---------------------------------------------------------------------------
941 Procedure chk_start_end_date
942 (p_start_date in hr_person_deployments.start_date%type
943 ,p_end_date in hr_person_deployments.end_date%type
944 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
945 ,p_object_version_number in hr_person_deployments.object_version_number%type
946 ,p_status in hr_person_deployments.status%type
947 ) is
948 --
949 l_proc varchar2(72) := g_package||'chk_start_end_date';
950 l_api_updating boolean;
951 --
952 begin
953 hr_utility.set_location('Entering:'||l_proc, 10);
954 --
955 hr_api.mandatory_arg_error
956 (p_api_name => l_proc
957 ,p_argument => 'start_date'
958 ,p_argument_value => p_start_date
959 );
960 --
961 if hr_multi_message.no_all_inclusive_error
962 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
963 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.END_DATE'
964 ) then
965 --
966 l_api_updating := hr_pdt_shd.api_updating
967 (p_person_deployment_id => p_person_deployment_id
968 ,p_object_version_number => p_object_version_number);
969 --
970 if ( (l_api_updating and
971 ( hr_pdt_shd.g_old_rec.start_date <> p_start_date
972 or nvl(hr_pdt_shd.g_old_rec.end_date,hr_api.g_date)
973 <> nvl(p_end_date,hr_api.g_date)))
974 or not l_api_updating) then
975 --
976 -- bug fix 5665505
977 -- commented the following code
978 /*
979 -- Added check for COMPLETED deployments: Bug 5494622
980 if (p_status = 'COMPLETE' and p_start_date > nvl(p_end_date,hr_api.g_eot))
981 then
982 fnd_message.set_name('PER','HR_449621_PDT_CHG_DATES');
983 fnd_message.raise_error;
984 end if;
985
986 if (p_status <> 'COMPLETE' and p_start_date >= nvl(p_end_date,hr_api.g_eot))
987 then
988 fnd_message.set_name('PER','HR_449621_PDT_CHG_DATES');
989 fnd_message.raise_error;
990 end if;
991 --
992 */
993 -- added the following piece of code
994 -- bug fix 5665505
995 --
996 if p_start_date > nvl(p_end_date,hr_api.g_eot)
997 then
998 fnd_message.set_name('PER','HR_449621_PDT_CHG_DATES');
999 fnd_message.raise_error;
1000 end if;
1001 --
1002 -- End of Additions
1003 end if;
1004 end if;
1005 --
1006 hr_utility.set_location('Leaving:'||l_proc, 20);
1007 --
1008 exception
1009 when app_exception.application_exception then
1010 if hr_multi_message.exception_add
1011 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
1012 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.END_DATE'
1013 ) then
1014 hr_utility.set_location(' Leaving:'||l_proc, 50);
1015 raise;
1016 end if;
1017 hr_utility.set_location(' Leaving:'||l_proc,60);
1018 end chk_start_end_date;
1019 --
1020 --
1021 -- ---------------------------------------------------------------------------
1022 -- |------------------------< chk_start_date >---------------------------|
1023 -- ---------------------------------------------------------------------------
1024 --
1025 -- Desciption:
1026 -- This function validates that the deployment start date is not greater
1027 -- than the employee start date.
1028 --
1029 -- Pre-conditions :
1030 -- None
1031 --
1032 -- In Parameters :
1033 -- p_start_date
1034 -- p_person_id
1035 --
1036 -- Post Success :
1037 -- Processing continues if the dates are valid
1038 --
1039 -- Post Failure :
1040 -- An application error will be raised and processing is terminated if the
1041 -- dates are invalid
1042 --
1043 -- Access Status :
1044 -- Internal Row Handler Use only.
1045 --
1046 -- {End of Comments}
1047 --
1048 -- ---------------------------------------------------------------------------
1049 FUNCTION chk_start_date
1050 (p_person_id in HR_PERSON_DEPLOYMENTS.FROM_PERSON_ID%type
1051 ,p_start_date in HR_PERSON_DEPLOYMENTS.START_DATE%type
1052 ) RETURN VARCHAR2
1053 is
1054
1055 -- Declare Cursor
1056
1057 cursor csr_get_min_st_date is
1058 select min(effective_start_date) from per_all_people_f
1059 where person_id = p_person_id;
1060
1061 -- Declare Local Variables
1062
1063 l_emp_date_start date;
1064 l_dep_start_date date;
1065
1066
1067
1068 begin
1069
1070 l_dep_start_date := trunc(p_start_date);
1071
1072 open csr_get_min_st_date;
1073 fetch csr_get_min_st_date into l_emp_date_start;
1074
1075 if csr_get_min_st_date%notfound then
1076 fnd_message.set_name('PER','HR_449629_PDT_FR_PER_NOTEXIST');
1077 fnd_message.raise_error;
1078 end if;
1079
1080 if(l_dep_start_date < l_emp_date_start) then
1081 return 'Y';
1082 else return 'N';
1083 end if;
1084
1085 end chk_start_date;
1086
1087 -- ---------------------------------------------------------------------------
1088 -- |------------------------< chk_permanent >--------------------------------|
1089 -- ---------------------------------------------------------------------------
1090 --
1091 -- Desciption:
1092 -- This procedures validates that permanent is a valid value of 'Y','N' or null
1093 -- If PERMANENT='Y', then end date must be null
1094 -- If PERMANENT='Y', the from_person_id cannot have a future person record change
1095 --
1096 -- Pre-conditions :
1097 -- None
1098 --
1099 -- In Parameters :
1100 -- p_permanent
1101 -- p_from_person_id
1102 -- p_end_date
1103 --
1104 -- Post Success :
1105 -- Processing continues if the is valid
1106 --
1107 -- Post Failure :
1108 -- An application error will be raised and processing is terminated if the
1109 -- is invalid
1110 --
1111 -- Access Status :
1112 -- Internal Row Handler Use only.
1113 --
1114 -- {End of Comments}
1115 --
1116 -- ---------------------------------------------------------------------------
1117 Procedure chk_permanent
1118 (p_permanent in hr_person_deployments.permanent%type
1119 ,p_from_person_id in hr_person_deployments.from_person_id%type
1120 ,p_end_date in hr_person_deployments.end_date%type
1121 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1122 ,p_object_version_number in hr_person_deployments.object_version_number%type
1123 ) is
1124 --
1125 l_proc varchar2(72) := g_package||'chk_permanent';
1126 l_api_updating boolean;
1127 l_dummy number;
1128 --
1129 cursor csr_check_fut_home_per is
1130 select 1
1131 from per_all_people_f
1132 where person_id = p_from_person_id
1133 and effective_start_date > nvl(p_end_date,hr_api.g_eot);
1134 --
1135 begin
1136 hr_utility.set_location('Entering:'||l_proc, 10);
1137 --
1138 hr_api.mandatory_arg_error
1139 (p_api_name => l_proc
1140 ,p_argument => 'from_person_id'
1141 ,p_argument_value => p_from_person_id
1142 );
1143 --
1144 if hr_multi_message.no_exclusive_error
1145 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.END_DATE'
1146 ) then
1147 --
1148 l_api_updating := hr_pdt_shd.api_updating
1149 (p_person_deployment_id => p_person_deployment_id
1150 ,p_object_version_number => p_object_version_number);
1151 --
1152 if ( (l_api_updating and
1153 nvl(hr_pdt_shd.g_old_rec.end_date,hr_api.g_date)
1154 <> nvl(p_end_date,hr_api.g_date))
1155 or not l_api_updating) then
1156 --
1157 if (p_permanent <> 'Y' and p_permanent <> 'N' and p_permanent is not null) then
1158 fnd_message.set_name('PER','HR_449633_PDT_PERM_INVALID');
1159 fnd_message.raise_error;
1160 end if;
1161 --
1162 if (p_permanent is not null and p_permanent = 'Y') then
1163 if nvl(p_end_date,hr_api.g_date) <> hr_api.g_date then
1164 fnd_message.set_name('PER','HR_449634_PDT_PERM_NO_END');
1165 fnd_message.raise_error;
1166 end if;
1167 --
1168 open csr_check_fut_home_per;
1169 fetch csr_check_fut_home_per into l_dummy;
1170 if csr_check_fut_home_per%found then
1171 fnd_message.set_name('PER','HR_449635_PDT_HOME_FUTPER');
1172 fnd_message.raise_error;
1173 end if;
1174 --
1175 end if;
1176 --
1177 end if; --api updating
1178 end if; --multi mesage
1179 --
1180 hr_utility.set_location('Leaving:'||l_proc, 20);
1181 --
1182 exception
1183 when app_exception.application_exception then
1184 if hr_multi_message.exception_add
1185 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PERMANENT'
1186 ) then
1187 hr_utility.set_location(' Leaving:'||l_proc, 50);
1188 raise;
1189 end if;
1190 hr_utility.set_location(' Leaving:'||l_proc,60);
1191 end chk_permanent;
1192 --
1193 -- ---------------------------------------------------------------------------
1194 -- |------------------------< chk_deployment_reason >------------------------|
1195 -- ---------------------------------------------------------------------------
1196 --
1197 -- Desciption:
1198 -- This procedures validates that deployment reason exists as a lookup code on
1199 -- HR_LEG_LOOKUPS for the lookup type 'HR_DEPLOYMENT_REASONS' with an enabled flag
1200 -- set to 'Y' and start_date of the deployment between start_date_active and
1201 -- end_date_active on HR_LEG_LOOKUPS
1202 --
1203 -- Pre-conditions :
1204 -- None
1205 --
1206 -- In Parameters :
1207 -- p_deployment_reason
1208 -- p_start_date
1209 --
1210 -- Post Success :
1211 -- Processing continues if the deployment reason is valid
1212 --
1213 -- Post Failure :
1214 -- An application error will be raised and processing is terminated if the
1215 -- deployment reason is invalid
1216 --
1217 -- Access Status :
1218 -- Internal Row Handler Use only.
1219 --
1220 -- {End of Comments}
1221 --
1222 -- ---------------------------------------------------------------------------
1223 Procedure chk_deployment_reason
1224 (p_deployment_reason in hr_person_deployments.deployment_reason%type
1225 ,p_start_date in hr_person_deployments.start_date%type
1226 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1227 ,p_object_version_number in hr_person_deployments.object_version_number%type
1228 ) is
1229 --
1230 l_proc varchar2(72) := g_package||'chk_deployment_reason';
1231 l_api_updating boolean;
1232 --
1233 begin
1234 hr_utility.set_location('Entering:'||l_proc, 10);
1235 --
1236 hr_api.mandatory_arg_error
1237 (p_api_name => l_proc
1238 ,p_argument => 'start_date'
1239 ,p_argument_value => p_start_date
1240 );
1241 --
1242 if hr_multi_message.no_exclusive_error
1243 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
1244 ) then
1245 --
1246 l_api_updating := hr_pdt_shd.api_updating
1247 (p_person_deployment_id => p_person_deployment_id
1248 ,p_object_version_number => p_object_version_number);
1249 --
1250 if ( (l_api_updating and
1251 ( hr_pdt_shd.g_old_rec.start_date <> p_start_date
1252 or nvl(hr_pdt_shd.g_old_rec.deployment_reason,hr_api.g_varchar2)
1253 <> nvl(p_deployment_reason,hr_api.g_varchar2)))
1254 or not l_api_updating) then
1255 --
1256 if p_deployment_reason is not null
1257 and hr_api.not_exists_in_leg_lookups
1258 (p_effective_date => p_start_date
1259 ,p_lookup_type => 'HR_DEPLOYMENT_REASONS'
1260 ,p_lookup_code => p_deployment_reason
1261 )
1262 then
1263 fnd_message.set_name('PER','HR_449636_PDT_REAS_NOTEXIST');
1264 fnd_message.raise_error;
1265 end if;
1266 end if; --api updating
1267 end if; --multi message
1268 --
1269 hr_utility.set_location('Leaving:'||l_proc, 20);
1270 --
1271 exception
1272 when app_exception.application_exception then
1273 if hr_multi_message.exception_add
1274 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.DEPLOYMENT_REASON'
1275 ) then
1276 hr_utility.set_location(' Leaving:'||l_proc, 50);
1277 raise;
1278 end if;
1279 hr_utility.set_location(' Leaving:'||l_proc,60);
1280 end chk_deployment_reason;
1281 --
1282 -- ---------------------------------------------------------------------------
1283 -- |------------------------< chk_employee_number >--------------------------|
1284 -- ---------------------------------------------------------------------------
1285 --
1286 -- Desciption:
1287 -- This procedures validates that employee number is not set unless to
1288 -- to business group has manual numbering or automatic global numbering.
1289 -- If to_person_id is specified, the employee number if specified must be the same
1290 -- number as the to_person_id
1291 -- The number specified must be unique.
1292 --
1293 -- Pre-conditions :
1294 -- None
1295 --
1296 -- In Parameters :
1297 -- p_employee_number
1298 -- p_to_business_group_id
1299 -- p_to_person_id
1300 --
1301 -- Post Success :
1302 -- Processing continues if the employee number is valid
1303 --
1304 -- Post Failure :
1305 -- An application error will be raised and processing is terminated if the
1306 -- employee number is invalid
1307 --
1308 -- Access Status :
1309 -- Internal Row Handler Use only.
1310 --
1311 -- {End of Comments}
1312 --
1313 -- ---------------------------------------------------------------------------
1314 Procedure chk_employee_number
1315 (p_employee_number in hr_person_deployments.employee_number%type
1316 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
1317 ,p_to_person_id in hr_person_deployments.to_person_id%type
1318 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1319 ,p_object_version_number in hr_person_deployments.object_version_number%type
1320 ) is
1321 --
1322 l_proc varchar2(72) := g_package||'chk_employee_number';
1323 l_api_updating boolean;
1324 l_dummy number;
1325 l_numgen_method per_all_people_f.employee_number%type;
1326 l_host_empnum per_all_people_f.employee_number%type;
1327 l_global_num_set fnd_profile_option_values.profile_option_value%type;
1328 --
1329 cursor csr_numgen_method is
1330 select pbg.method_of_generation_emp_num
1331 from per_business_groups pbg
1332 where pbg.business_group_id=p_to_business_group_id;
1333 --
1334 cursor csr_check_host_number is
1335 select employee_number
1336 from per_all_people_f
1337 where person_id = p_to_person_id
1338 and effective_end_date = hr_api.g_eot;
1339 --
1340 cursor csr_check_num_unique is
1341 select 1
1342 from per_all_people_f
1343 where effective_end_date = hr_api.g_eot
1344 and employee_number=p_employee_number
1345 and business_group_id = p_to_business_group_id;
1346 --
1347 begin
1348 hr_utility.set_location('Entering:'||l_proc, 10);
1349 --
1350 hr_api.mandatory_arg_error
1351 (p_api_name => l_proc
1352 ,p_argument => 'to_business_group_id'
1353 ,p_argument_value => p_to_business_group_id
1354 );
1355 --
1356 if hr_multi_message.no_all_inclusive_error
1357 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
1358 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_PERSON_ID'
1359 ) then
1360 --
1361 l_api_updating := hr_pdt_shd.api_updating
1362 (p_person_deployment_id => p_person_deployment_id
1363 ,p_object_version_number => p_object_version_number);
1364 --
1365 if ( (l_api_updating and
1366 (nvl(hr_pdt_shd.g_old_rec.employee_number,hr_api.g_varchar2)
1367 <> nvl(p_employee_number,hr_api.g_varchar2)))
1368 or not l_api_updating) then
1369 --
1370 if p_employee_number is not null then
1371 --get num gen method
1372 open csr_numgen_method;
1373 fetch csr_numgen_method into l_numgen_method;
1374 close csr_numgen_method;
1375 --
1376 l_global_num_set := fnd_profile.value('PER_GLOBAL_EMP_NUM');
1377 --
1378 if l_numgen_method='N'
1379 or (l_numgen_method='A' and l_global_num_set <> 'Y') then
1380 fnd_message.set_name('PER','HR_449637_PDT_NUMGENMETH');
1381 fnd_message.raise_error;
1382 end if;
1383 --
1384 if p_to_person_id is not null then
1385 open csr_check_host_number;
1386 fetch csr_check_host_number into l_host_empnum;
1387 close csr_check_host_number;
1388 --
1389 if l_host_empnum <> p_employee_number then
1390 fnd_message.set_name('PER','HR_449638_PDT_NUM_HOST');
1391 fnd_message.raise_error;
1392 end if;
1393 elsif p_to_person_id is null
1394 and not(l_numgen_method = 'A' and l_global_num_set = 'Y') then
1395 --
1396 --check that number is not used already in ToBG
1397 --
1398 open csr_check_num_unique;
1399 fetch csr_check_num_unique into l_dummy;
1400 if csr_check_num_unique%found then
1401 close csr_check_num_unique;
1402 fnd_message.set_name('PER','HR_449639_PDT_NUM_USED');
1403 fnd_message.raise_error;
1404 else
1405 close csr_check_num_unique;
1406 end if;
1407 end if; --p_to_person_id not null
1408 end if; --p_employee_number not null
1409 end if; --api updating
1410 end if; --multi message
1411 --
1412 hr_utility.set_location('Leaving:'||l_proc, 20);
1413 --
1414 exception
1415 when app_exception.application_exception then
1416 if hr_multi_message.exception_add
1417 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.EMPLOYEE_NUMBER'
1418 ) then
1419 hr_utility.set_location(' Leaving:'||l_proc, 50);
1420 raise;
1421 end if;
1422 hr_utility.set_location(' Leaving:'||l_proc,60);
1423 end chk_employee_number;
1424 --
1425 -- ---------------------------------------------------------------------------
1426 -- |------------------------< chk_leaving_reason >---------------------------|
1427 -- ---------------------------------------------------------------------------
1428 --
1429 -- Desciption:
1430 -- This procedures validates that leaving reason exists as a lookup code on
1431 -- HR_LEG_LOOKUPS for the lookup type 'LEAV_REAS' with an enabled flag
1432 -- set to 'Y' and start_date of the deployment between start_date_active and
1433 -- end_date_active on HR_LEG_LOOKUPS
1434 -- A value cannot be entered if PERMANENT='Y'
1435 --
1436 -- Pre-conditions :
1437 -- None
1438 --
1439 -- In Parameters :
1440 -- p_leaving_reason
1441 -- p_to_business_group_id
1442 -- p_permanent
1443 --
1444 -- Post Success :
1445 -- Processing continues if the leaving_reason is valid
1446 --
1447 -- Post Failure :
1448 -- An application error will be raised and processing is terminated if the
1449 -- leaving_reason is invalid
1450 --
1451 -- Access Status :
1452 -- Internal Row Handler Use only.
1453 --
1454 -- {End of Comments}
1455 --
1456 -- ---------------------------------------------------------------------------
1457 Procedure chk_leaving_reason
1458 (p_leaving_reason in hr_person_deployments.leaving_reason%type
1459 ,p_start_date in hr_person_deployments.start_date%type
1460 ,p_permanent in hr_person_deployments.permanent%type
1461 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1462 ,p_object_version_number in hr_person_deployments.object_version_number%type
1463 ) is
1464 --
1465 l_proc varchar2(72) := g_package||'chk_leaving_reason';
1466 l_api_updating boolean;
1467 --
1468 begin
1469 hr_utility.set_location('Entering:'||l_proc, 10);
1470 --
1471 hr_api.mandatory_arg_error
1472 (p_api_name => l_proc
1473 ,p_argument => 'start_date'
1474 ,p_argument_value => p_start_date
1475 );
1476 --
1477 if hr_multi_message.no_exclusive_error
1478 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
1479 ) then
1480 --
1481 l_api_updating := hr_pdt_shd.api_updating
1482 (p_person_deployment_id => p_person_deployment_id
1483 ,p_object_version_number => p_object_version_number);
1484 --
1485 if ( (l_api_updating and
1486 (nvl(hr_pdt_shd.g_old_rec.leaving_reason,hr_api.g_varchar2)
1487 <> nvl(p_leaving_reason,hr_api.g_varchar2)))
1488 or not l_api_updating) then
1489 --
1490 if p_leaving_reason is not null then
1491 if nvl(p_permanent,'N') = 'Y' then
1492 fnd_message.set_name('PER','HR_449640_PDT_PERM_LEAV_REAS');
1493 fnd_message.raise_error;
1494 end if;
1495 --
1496 if hr_api.not_exists_in_leg_lookups
1497 (p_effective_date => p_start_date
1498 ,p_lookup_type => 'LEAV_REAS'
1499 ,p_lookup_code => p_leaving_reason
1500 ) then
1501 fnd_message.set_name('PER','HR_7485_PDS_INV_LR');
1502 fnd_message.raise_error;
1503 end if; -- lookup validation
1504 end if; --leaving reason not null
1505 end if; --api updating
1506 end if; --multi message
1507 --
1508 hr_utility.set_location('Leaving:'||l_proc, 20);
1509 --
1510 exception
1511 when app_exception.application_exception then
1512 if hr_multi_message.exception_add
1513 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.LEAVING_REASON'
1514 ) then
1515 hr_utility.set_location(' Leaving:'||l_proc, 50);
1516 raise;
1517 end if;
1518 hr_utility.set_location(' Leaving:'||l_proc,60);
1519 end chk_leaving_reason;
1520 --
1521 -- ---------------------------------------------------------------------------
1522 -- |------------------------< chk_leaving_person_type_id >-------------------|
1523 -- ---------------------------------------------------------------------------
1524 --
1525 -- Desciption:
1526 -- This procedures validates that leaving person type exists in the
1527 -- to business group and is active and of type EX_EMP.
1528 -- A value cannot be specified if PERMANENT='Y'
1529 --
1530 -- Pre-conditions :
1531 -- None
1532 --
1533 -- In Parameters :
1534 -- p_leaving_person_type_id
1535 -- p_to_business_group_id
1536 -- p_permanent
1537 --
1538 -- Post Success :
1539 -- Processing continues if the leaving person type id is valid
1540 --
1541 -- Post Failure :
1542 -- An application error will be raised and processing is terminated if the
1543 -- leaving person type id is invalid
1544 --
1545 -- Access Status :
1546 -- Internal Row Handler Use only.
1547 --
1548 -- {End of Comments}
1549 --
1550 -- ---------------------------------------------------------------------------
1551 Procedure chk_leaving_person_type_id
1552 (p_leaving_person_type_id in hr_person_deployments.leaving_person_type_id%type
1553 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
1554 ,p_permanent in hr_person_deployments.permanent%type
1555 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1556 ,p_object_version_number in hr_person_deployments.object_version_number%type
1557 ) is
1558 --
1559 l_proc varchar2(72) := g_package||'chk_';
1560 l_api_updating boolean;
1561 l_sys_type per_person_types.system_person_type%type;
1562 l_bg_id per_person_types.business_group_id%type;
1563 l_active_flag per_person_types.active_flag%type;
1564 --
1565 cursor csr_check_per_type is
1566 select system_person_type,business_group_id,active_flag
1567 from per_person_types
1568 where person_type_id = p_leaving_person_type_id;
1569 --
1570 begin
1571 hr_utility.set_location('Entering:'||l_proc, 10);
1572 --
1573 hr_api.mandatory_arg_error
1574 (p_api_name => l_proc
1575 ,p_argument => 'to_business_group_id'
1576 ,p_argument_value => p_to_business_group_id
1577 );
1578 --
1579 if hr_multi_message.no_all_inclusive_error
1580 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
1581 ) then
1582 --
1583 l_api_updating := hr_pdt_shd.api_updating
1584 (p_person_deployment_id => p_person_deployment_id
1585 ,p_object_version_number => p_object_version_number);
1586 --
1587 if (( (l_api_updating and
1588 (nvl(hr_pdt_shd.g_old_rec.leaving_person_type_id,hr_api.g_number)
1589 <> nvl(p_leaving_person_type_id,hr_api.g_number)))
1590 or not l_api_updating)
1591 and p_leaving_person_type_id is not null) then
1592 --
1593 if nvl(p_permanent,'N') = 'Y' then
1594 fnd_message.set_name('PER','HR_449641_PDT_PERM_LEAV_TYPE');
1595 fnd_message.raise_error;
1596 end if;
1597 --
1598 open csr_check_per_type;
1599 fetch csr_check_per_type into l_sys_type,l_bg_id,l_active_flag;
1600 if csr_check_per_type%notfound then
1601 close csr_check_per_type;
1602 fnd_message.set_name('PER','HR_7513_PER_TYPE_INVALID');
1603 fnd_message.raise_error;
1604 else
1605 close csr_check_per_type;
1606 --
1607 if l_sys_type <> 'EX_EMP' then
1608 fnd_message.set_name('PER','HR_7513_PER_TYPE_INVALID');
1609 fnd_message.raise_error;
1610 end if;
1611 if l_bg_id <> p_to_business_group_id then
1612 fnd_message.set_name('PER','HR_7974_PER_TYPE_INV_BUS_GROUP');
1613 fnd_message.raise_error;
1614 end if;
1615 if l_active_flag <> 'Y' then
1616 fnd_message.set_name('PER','HR_7973_PER_TYPE_NOT_ACTIVE');
1617 fnd_message.raise_error;
1618 end if;
1619 end if; --csr notfound
1620
1621 end if; --api updating
1622 end if; --multi message
1623 --
1624 hr_utility.set_location('Leaving:'||l_proc, 20);
1625 --
1626 exception
1627 when app_exception.application_exception then
1628 if hr_multi_message.exception_add
1629 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.LEAVING_PERSON_TYPE_ID'
1630 ) then
1631 hr_utility.set_location(' Leaving:'||l_proc, 50);
1632 raise;
1633 end if;
1634 hr_utility.set_location(' Leaving:'||l_proc,60);
1635 end chk_leaving_person_type_id;
1636 --
1637 -- ---------------------------------------------------------------------------
1638 -- |------------------------< chk_status >-----------------------------------|
1639 -- ---------------------------------------------------------------------------
1640 --
1641 -- Desciption:
1642 -- This procedures validates that status exists as a lookup code on
1643 -- HR_LEG_LOOKUPS for the lookup type 'HR_DEPLOYMENT_STATUSES' with an enabled flag
1644 -- set to 'Y' and start_date of the deployment between start_date_active and
1645 -- end_date_active on HR_LEG_LOOKUPS
1646 --
1647 -- Pre-conditions :
1648 -- None
1649 --
1650 -- In Parameters :
1651 -- p_status
1652 -- p_start_date
1653 --
1654 -- Post Success :
1655 -- Processing continues if the status is valid
1656 --
1657 -- Post Failure :
1658 -- An application error will be raised and processing is terminated if the
1659 -- status is invalid
1660 --
1661 -- Access Status :
1662 -- Internal Row Handler Use only.
1663 --
1664 -- {End of Comments}
1665 --
1666 -- ---------------------------------------------------------------------------
1667 Procedure chk_status
1668 (p_status in hr_person_deployments.status%type
1669 ,p_start_date in hr_person_deployments.start_date%type
1670 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1671 ,p_object_version_number in hr_person_deployments.object_version_number%type
1672 ) is
1673 --
1674 l_proc varchar2(72) := g_package||'chk_status';
1675 l_api_updating boolean;
1676 --
1677 begin
1678 hr_utility.set_location('Entering:'||l_proc, 10);
1679 --
1680 hr_api.mandatory_arg_error
1681 (p_api_name => l_proc
1682 ,p_argument => 'status'
1683 ,p_argument_value => p_status
1684 );
1685 --
1686 hr_api.mandatory_arg_error
1687 (p_api_name => l_proc
1688 ,p_argument => 'start_date'
1689 ,p_argument_value => p_start_date
1690 );
1691 --
1692 if hr_multi_message.no_all_inclusive_error
1693 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.STATUS'
1694 ) then
1695 --
1696 l_api_updating := hr_pdt_shd.api_updating
1697 (p_person_deployment_id => p_person_deployment_id
1698 ,p_object_version_number => p_object_version_number);
1699 --
1700 if ( (l_api_updating and
1701 (hr_pdt_shd.g_old_rec.status <> p_status))
1702 or not l_api_updating) then
1703 --
1704 if hr_api.not_exists_in_leg_lookups
1705 (p_effective_date => p_start_date
1706 ,p_lookup_type => 'HR_DEPLOYMENT_STATUSES'
1707 ,p_lookup_code => p_status
1708 ) then
1709 fnd_message.set_name('PER','HR_7485_PDS_INV_LR');
1710 fnd_message.raise_error;
1711 end if;
1712 --
1713 if not l_api_updating and (p_status='ACTIVE' or p_status='COMPLETE') then
1714 fnd_message.set_name('PER','HR_449642_PDT_INS_STATUS');
1715 fnd_message.raise_error;
1716 end if;
1717
1718 end if; --api updating
1719 end if; --multi message
1720 --
1721 hr_utility.set_location('Leaving:'||l_proc, 20);
1722 --
1723 exception
1724 when app_exception.application_exception then
1725 if hr_multi_message.exception_add
1726 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.STATUS'
1727 ) then
1728 hr_utility.set_location(' Leaving:'||l_proc, 50);
1729 raise;
1730 end if;
1731 hr_utility.set_location(' Leaving:'||l_proc,60);
1732 end chk_status;
1733 --
1734 -- ---------------------------------------------------------------------------
1735 -- |------------------------< chk_deplymt_policy_id >------------------------|
1736 -- ---------------------------------------------------------------------------
1737 --
1738 -- Desciption:
1739 -- This procedures validates that deplymt policy id is null.
1740 -- The parameter is not supported for initial release of global transfer functionality
1741 --
1742 -- Pre-conditions :
1743 -- None
1744 --
1745 -- In Parameters :
1746 -- p_deplymt_policy_id
1747 --
1748 -- Post Success :
1749 -- Processing continues if the deplymt policy id is valid
1750 --
1751 -- Post Failure :
1752 -- An application error will be raised and processing is terminated if the
1753 -- deplymt policy id is invalid
1754 --
1755 -- Access Status :
1756 -- Internal Row Handler Use only.
1757 --
1758 -- {End of Comments}
1759 --
1760 -- ---------------------------------------------------------------------------
1761 Procedure chk_deplymt_policy_id
1762 (p_deplymt_policy_id in hr_person_deployments.deplymt_policy_id%type
1763 ) is
1764 --
1765 l_proc varchar2(72) := g_package||'chk_deplymt_policy_id';
1766 l_api_updating boolean;
1767 --
1768 begin
1769 hr_utility.set_location('Entering:'||l_proc, 10);
1770 --
1771 if p_deplymt_policy_id is not null then
1772 fnd_message.set_name('PER','HR_449643_PDT_INV_POLICY');
1773 fnd_message.raise_error;
1774 end if;
1775 --
1776 hr_utility.set_location('Leaving:'||l_proc, 20);
1777 --
1778 exception
1779 when app_exception.application_exception then
1780 if hr_multi_message.exception_add
1781 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.DEPLYMT_POLICY_ID'
1782 ) then
1783 hr_utility.set_location(' Leaving:'||l_proc, 50);
1784 raise;
1785 end if;
1786 hr_utility.set_location(' Leaving:'||l_proc,60);
1787 end chk_deplymt_policy_id;
1788 --
1789 -- ---------------------------------------------------------------------------
1790 -- |------------------------< chk_retain_direct_reports >--------------------|
1791 -- ---------------------------------------------------------------------------
1792 --
1793 -- Desciption:
1794 -- This procedures validates that retain_direct_reports is a valid value
1795 -- of 'Y','N' or null
1796 -- It must be null if the employee has no direct reports
1797 --
1798 -- Pre-conditions :
1799 -- None
1800 --
1801 -- In Parameters :
1802 -- p_retain_direct_reports
1803 -- p_from_person_id
1804 -- p_to_business_group_id
1805 -- p_from_business_group_id
1806 --
1807 -- Post Success :
1808 -- Processing continues if the is valid
1809 --
1810 -- Post Failure :
1811 -- An application error will be raised and processing is terminated if the
1812 -- is invalid
1813 --
1814 -- Access Status :
1815 -- Internal Row Handler Use only.
1816 --
1817 -- {End of Comments}
1818 --
1819 -- ---------------------------------------------------------------------------
1820 Procedure chk_retain_direct_reports
1821 (p_retain_direct_reports in hr_person_deployments.retain_direct_reports%type
1822 ,p_from_person_id in hr_person_deployments.from_person_id%type
1823 ,p_start_date in hr_person_deployments.start_date%type
1824 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
1825 ,p_from_business_group_id in hr_person_deployments.to_business_group_id%type
1826 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1827 ,p_object_version_number in hr_person_deployments.object_version_number%type
1828 ) is
1829 --
1830 l_proc varchar2(72) := g_package||'chk_retain_direct_reports';
1831 l_api_updating boolean;
1832 l_dummy number;
1833 --
1834 cursor csr_check_directs(p_person_id number) is
1835 select 1
1836 from per_all_assignments_f
1837 where supervisor_id = p_person_id
1838 and p_start_date between effective_start_date and effective_end_date;
1839 --
1840 begin
1841 hr_utility.set_location('Entering:'||l_proc, 10);
1842 --
1843 hr_api.mandatory_arg_error
1844 (p_api_name => l_proc
1845 ,p_argument => 'from_person_id'
1846 ,p_argument_value => p_from_person_id
1847 );
1848 --
1849 hr_api.mandatory_arg_error
1850 (p_api_name => l_proc
1851 ,p_argument => 'start_date'
1852 ,p_argument_value => p_start_date
1853 );
1854 --
1855 if hr_multi_message.no_exclusive_error
1856 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.FROM_PERSON_ID'
1857 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
1858 ) then
1859 --
1860 l_api_updating := hr_pdt_shd.api_updating
1861 (p_person_deployment_id => p_person_deployment_id
1862 ,p_object_version_number => p_object_version_number);
1863 --
1864 if nvl(fnd_profile.value('HR_CROSS_BUSINESS_GROUP'),'N') = 'N'
1865 and p_from_business_group_id <> p_to_business_group_id then
1866 fnd_message.set_name('PER','HR_449644_PDT_RETAIN_REPS');
1867 fnd_message.raise_error;
1868 end if;
1869 --
1870 if ( (l_api_updating and
1871 nvl(hr_pdt_shd.g_old_rec.retain_direct_reports,hr_api.g_varchar2)
1872 <> nvl(p_retain_direct_reports,hr_api.g_varchar2))
1873 or not l_api_updating) then
1874 --
1875 if (p_retain_direct_reports <> 'Y'
1876 and p_retain_direct_reports <> 'N'
1877 and p_retain_direct_reports is not null) then
1878 fnd_message.set_name('PER','HR_449645_PDT_RET_REPS_INV');
1879 fnd_message.raise_error;
1880 end if;
1881 --
1882 end if; --api updating
1883 end if; --multi mesage
1884 --
1885 hr_utility.set_location('Leaving:'||l_proc, 20);
1886 --
1887 exception
1888 when app_exception.application_exception then
1889 if hr_multi_message.exception_add
1890 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.RETAIN_DIRECT_REPORTS'
1891 ) then
1892 hr_utility.set_location(' Leaving:'||l_proc, 50);
1893 raise;
1894 end if;
1895 hr_utility.set_location(' Leaving:'||l_proc,60);
1896 end chk_retain_direct_reports;
1897 --
1898 -- ---------------------------------------------------------------------------
1899 -- |------------------------< chk_organization_id >--------------------------|
1900 -- ---------------------------------------------------------------------------
1901 --
1902 -- Desciption:
1903 -- This procedures validates that the org is a valid internal HR organization
1904 --
1905 -- Pre-conditions :
1906 -- None
1907 --
1908 -- In Parameters :
1909 -- p_organization_id
1910 -- p_to_business_group_id
1911 --
1912 -- Post Success :
1913 -- Processing continues if the organization is valid
1914 --
1915 -- Post Failure :
1916 -- An application error will be raised and processing is terminated if the
1917 -- organization is invalid
1918 --
1919 -- Access Status :
1920 -- Internal Row Handler Use only.
1921 --
1922 -- {End of Comments}
1923 --
1924 -- ---------------------------------------------------------------------------
1925 Procedure chk_organization_id
1926 (p_organization_id in hr_person_deployments.organization_id%type
1927 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
1928 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
1929 ,p_object_version_number in hr_person_deployments.object_version_number%type
1930 ) is
1931 --
1932 l_proc varchar2(72) := g_package||'chk_organization_id';
1933 l_api_updating boolean;
1934 l_dummy number;
1935 --
1936 cursor csr_check_int_org is
1937 select 1
1938 from hr_all_organization_units
1939 where organization_id = p_organization_id
1940 and internal_external_flag = 'INT';
1941 --
1942 -- following detects match on Host BG as well
1943 -- Since a proposal creates a primary asg, this is OK for asgrhi validation
1944 --
1945 cursor csr_check_hr_org is
1946 select 1
1947 from per_organization_units
1948 where organization_id = p_organization_id
1949 UNION
1950 select 1
1951 from per_business_groups_perf
1952 where business_group_id = p_to_business_group_id;
1953 --
1954 begin
1955 hr_utility.set_location('Entering:'||l_proc, 10);
1956 --
1957 hr_api.mandatory_arg_error
1958 (p_api_name => l_proc
1959 ,p_argument => 'organization_id'
1960 ,p_argument_value => p_organization_id
1961 );
1962 --
1963 hr_api.mandatory_arg_error
1964 (p_api_name => l_proc
1965 ,p_argument => 'to_business_group_id'
1966 ,p_argument_value => p_to_business_group_id
1967 );
1968 --
1969 l_api_updating := hr_pdt_shd.api_updating
1970 (p_person_deployment_id => p_person_deployment_id
1971 ,p_object_version_number => p_object_version_number);
1972 --
1973 if ( (l_api_updating and
1974 hr_pdt_shd.g_old_rec.organization_id <> p_organization_id)
1975 or not l_api_updating) then
1976 --
1977 open csr_check_int_org;
1978 fetch csr_check_int_org into l_dummy;
1979 if csr_check_int_org%notfound then
1980 close csr_check_int_org;
1981 fnd_message.set_name('PER','HR_34983_ASG_INVALID_ORG');
1982 fnd_message.raise_error;
1983 else
1984 close csr_check_int_org;
1985 end if;
1986 --
1987 open csr_check_hr_org;
1988 fetch csr_check_hr_org into l_dummy;
1989 if csr_check_hr_org%notfound then
1990 close csr_check_hr_org;
1991 fnd_message.set_name('PER','HR_51277_ASG_INV_HR_ORG');
1992 fnd_message.raise_error;
1993 else
1994 close csr_check_hr_org;
1995 end if;
1996 end if; --api updating
1997 --
1998 hr_utility.set_location('Leaving:'||l_proc, 20);
1999 --
2000 exception
2001 when app_exception.application_exception then
2002 if hr_multi_message.exception_add
2003 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.ORGANIZATION_ID'
2004 ) then
2005 hr_utility.set_location(' Leaving:'||l_proc, 50);
2006 raise;
2007 end if;
2008 hr_utility.set_location(' Leaving:'||l_proc,60);
2009 end chk_organization_id;
2010 --
2011 -- ---------------------------------------------------------------------------
2012 -- |------------------------< chk_location_id >------------------------------|
2013 -- ---------------------------------------------------------------------------
2014 --
2015 -- Desciption:
2016 -- This procedures validates that location is valid and active on the start date
2017 --
2018 -- Pre-conditions :
2019 -- None
2020 --
2021 -- In Parameters :
2022 -- p_location_id
2023 -- p_start_date
2024 -- p_to_business_group_id
2025 --
2026 -- Post Success :
2027 -- Processing continues if the location is valid
2028 --
2029 -- Post Failure :
2030 -- An application error will be raised and processing is terminated if the
2031 -- location is invalid
2032 --
2033 -- Access Status :
2034 -- Internal Row Handler Use only.
2035 --
2036 -- {End of Comments}
2037 --
2038 -- ---------------------------------------------------------------------------
2039 Procedure chk_location_id
2040 (p_location_id in hr_person_deployments.location_id%type
2041 ,p_start_date in hr_person_deployments.start_date%type
2042 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
2043 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2044 ,p_object_version_number in hr_person_deployments.object_version_number%type
2045 ) is
2046 --
2047 l_proc varchar2(72) := g_package||'chk_location_id';
2048 l_api_updating boolean;
2049 l_inactive_date date;
2050 --
2051 cursor csr_check_loc is
2052 select inactive_date
2053 from hr_locations_all
2054 where location_id = p_location_id
2055 and nvl(business_group_id,p_to_business_group_id)=p_to_business_group_id;
2056 --
2057 begin
2058 hr_utility.set_location('Entering:'||l_proc, 10);
2059 --
2060 hr_api.mandatory_arg_error
2061 (p_api_name => l_proc
2062 ,p_argument => 'start_date'
2063 ,p_argument_value => p_start_date
2064 );
2065 --
2066 hr_api.mandatory_arg_error
2067 (p_api_name => l_proc
2068 ,p_argument => 'to_business_group_id'
2069 ,p_argument_value => p_to_business_group_id
2070 );
2071 --
2072 if hr_multi_message.no_all_inclusive_error
2073 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2074 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
2075 ) then
2076 --
2077 l_api_updating := hr_pdt_shd.api_updating
2078 (p_person_deployment_id => p_person_deployment_id
2079 ,p_object_version_number => p_object_version_number);
2080 --
2081 if ( (l_api_updating and
2082 (nvl(hr_pdt_shd.g_old_rec.location_id,hr_api.g_number)
2083 <> nvl(p_location_id,hr_api.g_number)
2084 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2085 or not l_api_updating) then
2086 --
2087 if p_location_id is not null then
2088 open csr_check_loc;
2089 fetch csr_check_loc into l_inactive_date;
2090 if csr_check_loc%notfound then
2091 close csr_check_loc;
2092 fnd_message.set_name('PER','HR_7382_ASG_NON_EXIST_LOCATION');
2093 fnd_message.raise_error;
2094 else
2095 close csr_check_loc;
2096 if p_start_date < l_inactive_date then
2097 fnd_message.set_name('PER','HR_51215_ASG_INACT_LOCATION');
2098 fnd_message.raise_error;
2099 end if;
2100 end if; -- csr_check_loc notfound
2101 --
2102 end if; --location not null
2103 end if; --api updating
2104 end if; --multi message
2105 --
2106 hr_utility.set_location('Leaving:'||l_proc, 20);
2107 --
2108 exception
2109 when app_exception.application_exception then
2110 if hr_multi_message.exception_add
2111 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.LOCATION_ID'
2112 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2113 ) then
2114 hr_utility.set_location(' Leaving:'||l_proc, 50);
2115 raise;
2116 end if;
2117 hr_utility.set_location(' Leaving:'||l_proc,60);
2118 end chk_location_id;
2119 --
2120 -- ---------------------------------------------------------------------------
2121 -- |------------------------< chk_job_id >-----------------------------------|
2122 -- ---------------------------------------------------------------------------
2123 --
2124 -- Desciption:
2125 -- This procedures validates that job exists in the host BG as of the
2126 -- start date of deployment
2127 --
2128 -- Pre-conditions :
2129 -- None
2130 --
2131 -- In Parameters :
2132 -- p_job_id
2133 -- p_to_business_group_id
2134 -- p_start_date
2135 --
2136 -- Post Success :
2137 -- Processing continues if the job is valid
2138 --
2139 -- Post Failure :
2140 -- An application error will be raised and processing is terminated if the
2141 -- job is invalid
2142 --
2143 -- Access Status :
2144 -- Internal Row Handler Use only.
2145 --
2146 -- {End of Comments}
2147 --
2148 -- ---------------------------------------------------------------------------
2149 Procedure chk_job_id
2150 (p_job_id in hr_person_deployments.job_id%type
2151 ,p_start_date in hr_person_deployments.start_date%type
2152 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
2153 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2154 ,p_object_version_number in hr_person_deployments.object_version_number%type
2155 ) is
2156 --
2157 l_proc varchar2(72) := g_package||'chk_job_id';
2158 l_api_updating boolean;
2159 l_dummy number;
2160 --
2161 cursor csr_check_job is
2162 select 1
2163 from per_jobs job,
2164 per_job_groups jgr
2165 where job.job_id = p_job_id
2166 and p_start_date between job.date_from and nvl(job.date_to,hr_api.g_eot)
2167 and job.job_group_id = jgr.job_group_id
2168 and jgr.internal_name = 'HR_'||jgr.business_group_id
2169 and (jgr.business_group_id = job.business_group_id
2170 or jgr.business_group_id is null)
2171 and job.business_group_id = p_to_business_group_id;
2172 --
2173 begin
2174 hr_utility.set_location('Entering:'||l_proc, 10);
2175 --
2176 hr_api.mandatory_arg_error
2177 (p_api_name => l_proc
2178 ,p_argument => 'start_date'
2179 ,p_argument_value => p_start_date
2180 );
2181 --
2182 hr_api.mandatory_arg_error
2183 (p_api_name => l_proc
2184 ,p_argument => 'to_business_group_id'
2185 ,p_argument_value => p_to_business_group_id
2186 );
2187 --
2188 if hr_multi_message.no_all_inclusive_error
2189 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2190 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
2191 ) then
2192 --
2193 l_api_updating := hr_pdt_shd.api_updating
2194 (p_person_deployment_id => p_person_deployment_id
2195 ,p_object_version_number => p_object_version_number);
2196 --
2197 if ( (l_api_updating and
2198 (nvl(hr_pdt_shd.g_old_rec.job_id,hr_api.g_number)
2199 <> nvl(p_job_id,hr_api.g_number)
2200 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2201 or not l_api_updating) then
2202 --
2203 if p_job_id is not null then
2204 open csr_check_job;
2205 fetch csr_check_job into l_dummy;
2206 if csr_check_job%notfound then
2207 close csr_check_job;
2208 fnd_message.set_name('PER','HR_51172_ASG_INV_DT_JOB');
2209 fnd_message.raise_error;
2210 else
2211 close csr_check_job;
2212 end if;
2213 end if; --job not null
2214 end if; --api updating
2215 end if; --multi message
2216 --
2217 hr_utility.set_location('Leaving:'||l_proc, 20);
2218 --
2219 exception
2220 when app_exception.application_exception then
2221 if hr_multi_message.exception_add
2222 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.JOB_ID'
2223 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2224 ) then
2225 hr_utility.set_location(' Leaving:'||l_proc, 50);
2226 raise;
2227 end if;
2228 hr_utility.set_location(' Leaving:'||l_proc,60);
2229 end chk_job_id;
2230 --
2231 -- ---------------------------------------------------------------------------
2232 -- |------------------------< chk_position_id >------------------------------|
2233 -- ---------------------------------------------------------------------------
2234 --
2235 -- Desciption:
2236 -- This procedures validates that position exists in the host BG as of the
2237 -- start date of deployment
2238 --
2239 -- Pre-conditions :
2240 -- None
2241 --
2242 -- In Parameters :
2243 -- p_position_id
2244 -- p_to_business_group_id
2245 -- p_start_date
2246 --
2247 -- Post Success :
2248 -- Processing continues if the position is valid
2249 --
2250 -- Post Failure :
2251 -- An application error will be raised and processing is terminated if the
2252 -- position is invalid
2253 --
2254 -- Access Status :
2255 -- Internal Row Handler Use only.
2256 --
2257 -- {End of Comments}
2258 --
2259 -- ---------------------------------------------------------------------------
2260 Procedure chk_position_id
2261 (p_position_id in hr_person_deployments.position_id%type
2262 ,p_start_date in hr_person_deployments.start_date%type
2263 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
2264 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2265 ,p_object_version_number in hr_person_deployments.object_version_number%type
2266 ) is
2267 --
2268 l_proc varchar2(72) := g_package||'chk_position_id';
2269 l_api_updating boolean;
2270 l_dummy number;
2271 --
2272 cursor csr_check_position is
2273 select 1
2274 from hr_positions_f hp,
2275 per_shared_types ps
2276 where hp.position_id = p_position_id
2277 and hp.business_group_id = p_to_business_group_id
2278 and p_start_date between
2279 hp.effective_start_date and hp.effective_end_date
2280 and p_start_date between
2281 hp.date_effective and nvl(hp.date_end,hr_api.g_eot)
2282 and ps.shared_type_id = hp.availability_status_id
2283 and ps.system_type_cd = 'ACTIVE';
2284 --
2285 begin
2286 hr_utility.set_location('Entering:'||l_proc, 10);
2287 --
2288 hr_api.mandatory_arg_error
2289 (p_api_name => l_proc
2290 ,p_argument => 'start_date'
2291 ,p_argument_value => p_start_date
2292 );
2293 --
2294 hr_api.mandatory_arg_error
2295 (p_api_name => l_proc
2296 ,p_argument => 'to_business_group_id'
2297 ,p_argument_value => p_to_business_group_id
2298 );
2299 --
2300 if hr_multi_message.no_all_inclusive_error
2301 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2302 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
2303 ) then
2304 --
2305 l_api_updating := hr_pdt_shd.api_updating
2306 (p_person_deployment_id => p_person_deployment_id
2307 ,p_object_version_number => p_object_version_number);
2308 --
2309 if ( (l_api_updating and
2310 (nvl(hr_pdt_shd.g_old_rec.position_id,hr_api.g_number)
2311 <> nvl(p_position_id,hr_api.g_number)
2312 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2313 or not l_api_updating) then
2314 --
2315 if p_position_id is not null then
2316 open csr_check_position;
2317 fetch csr_check_position into l_dummy;
2318 if csr_check_position%notfound then
2319 close csr_check_position;
2320 fnd_message.set_name('PER','HR_51000_ASG_INVALID_POS');
2321 fnd_message.raise_error;
2322 else
2323 close csr_check_position;
2324 end if;
2325 end if; --position not null
2326 end if; --api updating
2327 end if; --multi message
2328 --
2329 hr_utility.set_location('Leaving:'||l_proc, 20);
2330 --
2331 exception
2332 when app_exception.application_exception then
2333 if hr_multi_message.exception_add
2334 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2335 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2336 ) then
2337 hr_utility.set_location(' Leaving:'||l_proc, 50);
2338 raise;
2339 end if;
2340 hr_utility.set_location(' Leaving:'||l_proc,60);
2341 end chk_position_id;
2342 --
2343 -- ---------------------------------------------------------------------------
2344 -- |------------------------< chk_grade_id >---------------------------------|
2345 -- ---------------------------------------------------------------------------
2346 --
2347 -- Desciption:
2348 -- This procedures validates that grade exists in the host BG as of the
2349 -- start date of deployment
2350 --
2351 -- Pre-conditions :
2352 -- None
2353 --
2354 -- In Parameters :
2355 -- p_grade_id
2356 -- p_to_business_group_id
2357 -- p_start_date
2358 --
2359 -- Post Success :
2360 -- Processing continues if the grade is valid
2361 --
2362 -- Post Failure :
2363 -- An application error will be raised and processing is terminated if the
2364 -- grade is invalid
2365 --
2366 -- Access Status :
2367 -- Internal Row Handler Use only.
2368 --
2369 -- {End of Comments}
2370 --
2371 -- ---------------------------------------------------------------------------
2372 Procedure chk_grade_id
2373 (p_grade_id in hr_person_deployments.grade_id%type
2374 ,p_start_date in hr_person_deployments.start_date%type
2375 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
2376 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2377 ,p_object_version_number in hr_person_deployments.object_version_number%type
2378 ) is
2379 --
2380 l_proc varchar2(72) := g_package||'chk_grade_id';
2381 l_api_updating boolean;
2382 l_dummy number;
2383 --
2384 cursor csr_check_grade is
2385 select 1
2386 from per_grades grade
2387 where grade.grade_id = p_grade_id
2388 and grade.business_group_id = p_to_business_group_id
2389 and p_start_date between
2390 grade.date_from and nvl(grade.date_to,hr_api.g_eot);
2391 --
2392 begin
2393 hr_utility.set_location('Entering:'||l_proc, 10);
2394 --
2395 hr_api.mandatory_arg_error
2396 (p_api_name => l_proc
2397 ,p_argument => 'start_date'
2398 ,p_argument_value => p_start_date
2399 );
2400 --
2401 hr_api.mandatory_arg_error
2402 (p_api_name => l_proc
2403 ,p_argument => 'to_business_group_id'
2404 ,p_argument_value => p_to_business_group_id
2405 );
2406 --
2407 if hr_multi_message.no_all_inclusive_error
2408 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2409 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
2410 ) then
2411 --
2412 l_api_updating := hr_pdt_shd.api_updating
2413 (p_person_deployment_id => p_person_deployment_id
2414 ,p_object_version_number => p_object_version_number);
2415 --
2416 if ( (l_api_updating and
2417 (nvl(hr_pdt_shd.g_old_rec.grade_id,hr_api.g_number)
2418 <> nvl(p_grade_id,hr_api.g_number)
2419 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2420 or not l_api_updating) then
2421 --
2422 if p_grade_id is not null then
2423 open csr_check_grade;
2424 fetch csr_check_grade into l_dummy;
2425 if csr_check_grade%notfound then
2426 close csr_check_grade;
2427 fnd_message.set_name('PER','HR_7393_ASG_INVALID_GRADE');
2428 fnd_message.raise_error;
2429 else
2430 close csr_check_grade;
2431 end if;
2432 end if; --grade not null
2433 end if; --api updating
2434 end if; --multi message
2435 --
2436 hr_utility.set_location('Leaving:'||l_proc, 20);
2437 --
2438 exception
2439 when app_exception.application_exception then
2440 if hr_multi_message.exception_add
2441 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.GRADE_ID'
2442 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2443 ) then
2444 hr_utility.set_location(' Leaving:'||l_proc, 50);
2445 raise;
2446 end if;
2447 hr_utility.set_location(' Leaving:'||l_proc,60);
2448 end chk_grade_id;
2449 --
2450 -- ---------------------------------------------------------------------------
2451 -- |------------------------< chk_position_id_job_id >------------------------|
2452 -- ---------------------------------------------------------------------------
2453 --
2454 -- Desciption:
2455 -- This procedures validates that the position and job combination is valid
2456 --
2457 -- Pre-conditions :
2458 -- None
2459 --
2460 -- In Parameters :
2461 -- p_position_id
2462 -- p_job_id
2463 -- p_start_date
2464 --
2465 -- Post Success :
2466 -- Processing continues if the position and job combo is valid
2467 --
2468 -- Post Failure :
2469 -- An application error will be raised and processing is terminated if the
2470 -- position and job combo is invalid
2471 --
2472 -- Access Status :
2473 -- Internal Row Handler Use only.
2474 --
2475 -- {End of Comments}
2476 --
2477 -- ---------------------------------------------------------------------------
2478 Procedure chk_position_id_job_id
2479 (p_position_id in hr_person_deployments.position_id%type
2480 ,p_job_id in hr_person_deployments.job_id%type
2481 ,p_start_date in hr_person_deployments.start_date%type
2482 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2483 ,p_object_version_number in hr_person_deployments.object_version_number%type
2484 ) is
2485 --
2486 l_proc varchar2(72) := g_package||'chk_position_id_job_id';
2487 l_api_updating boolean;
2488 l_dummy number;
2489 --
2490 cursor csr_check_pos_job is
2491 select null
2492 from hr_positions_f hp,
2493 per_shared_types ps
2494 where hp.position_id = p_position_id
2495 and p_start_date between
2496 hp.effective_start_date and hp.effective_end_date
2497 and hp.job_id = p_job_id
2498 and p_start_date between
2499 hp.date_effective and nvl(hp.date_end,hr_api.g_eot)
2500 and ps.shared_type_id = hp.availability_status_id
2501 and ps.system_type_cd = 'ACTIVE' ;
2502 --
2503 begin
2504 hr_utility.set_location('Entering:'||l_proc, 10);
2505 --
2506 hr_api.mandatory_arg_error
2507 (p_api_name => l_proc
2508 ,p_argument => 'start_date'
2509 ,p_argument_value => p_start_date
2510 );
2511 --
2512 if hr_multi_message.no_exclusive_error
2513 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.JOB_ID'
2514 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2515 ) then
2516 --
2517 l_api_updating := hr_pdt_shd.api_updating
2518 (p_person_deployment_id => p_person_deployment_id
2519 ,p_object_version_number => p_object_version_number);
2520 --
2521 if ( (l_api_updating and
2522 ( nvl(hr_pdt_shd.g_old_rec.position_id,hr_api.g_number)
2523 <> nvl(p_position_id,hr_api.g_number)
2524 or nvl(hr_pdt_shd.g_old_rec.job_id,hr_api.g_number)
2525 <> nvl(p_job_id,hr_api.g_number)
2526 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2527 or not l_api_updating) then
2528 --
2529 if p_position_id is not null and p_job_id is not null then
2530 open csr_check_pos_job;
2531 fetch csr_check_pos_job into l_dummy;
2532 if csr_check_pos_job%notfound then
2533 close csr_check_pos_job;
2534 fnd_message.set_name('PER','HR_51056_ASG_INV_POS_JOB_COMB');
2535 fnd_message.raise_error;
2536 else
2537 close csr_check_pos_job;
2538 end if;
2539 end if; --pos and job not null
2540 end if; --api updating
2541 end if; --multi message
2542 --
2543 hr_utility.set_location('Leaving:'||l_proc, 20);
2544 --
2545 exception
2546 when app_exception.application_exception then
2547 if hr_multi_message.exception_add
2548 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2549 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.JOB_ID'
2550 ) then
2551 hr_utility.set_location(' Leaving:'||l_proc, 50);
2552 raise;
2553 end if;
2554 hr_utility.set_location(' Leaving:'||l_proc,60);
2555 end chk_position_id_job_id;
2556 --
2557 -- ---------------------------------------------------------------------------
2558 -- |------------------------< chk_position_id_grade_id >---------------------|
2559 -- ---------------------------------------------------------------------------
2560 --
2561 -- Desciption:
2562 -- This procedures validates that position and grade combination is valid
2563 --
2564 -- Pre-conditions :
2565 -- None
2566 --
2567 -- In Parameters :
2568 --
2569 --
2570 -- Post Success :
2571 -- Processing continues if the position and grade combo is valid
2572 --
2573 -- Post Failure :
2574 -- An application error will be raised and processing is terminated if the
2575 -- position and grade combo is invalid
2576 --
2577 -- Access Status :
2578 -- Internal Row Handler Use only.
2579 --
2580 -- {End of Comments}
2581 --
2582 -- ---------------------------------------------------------------------------
2583 Procedure chk_position_id_grade_id
2584 (p_position_id in hr_person_deployments.position_id%type
2585 ,p_grade_id in hr_person_deployments.grade_id%type
2586 ,p_start_date in hr_person_deployments.start_date%type
2587 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2588 ,p_object_version_number in hr_person_deployments.object_version_number%type
2589 ,p_inv_pos_grade_warning out nocopy boolean
2590 ) is
2591 --
2592 l_proc varchar2(72) := g_package||'chk_position_id_grade_id';
2593 l_api_updating boolean;
2594 l_dummy number;
2595 l_inv_pos_grade_warning boolean := false;
2596 --
2597 cursor csr_any_valid_grades is
2598 select 1
2599 from per_valid_grades
2600 where position_id = p_position_id
2601 and p_start_date between
2602 date_from and nvl(date_to,hr_api.g_eot);
2603 --
2604 cursor csr_valid_grade is
2605 select 1
2606 from per_valid_grades
2607 where position_id = p_position_id
2608 and grade_id = p_grade_id
2609 and p_start_date between
2610 date_from and nvl(date_to,hr_api.g_eot);
2611 --
2612 begin
2613 hr_utility.set_location('Entering:'||l_proc, 10);
2614 --
2615 hr_api.mandatory_arg_error
2616 (p_api_name => l_proc
2617 ,p_argument => 'start_date'
2618 ,p_argument_value => p_start_date
2619 );
2620 --
2621 if hr_multi_message.no_exclusive_error
2622 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.GRADE_ID'
2623 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2624 ) then
2625 --
2626 l_api_updating := hr_pdt_shd.api_updating
2627 (p_person_deployment_id => p_person_deployment_id
2628 ,p_object_version_number => p_object_version_number);
2629 --
2630 if ( (l_api_updating and
2631 ( nvl(hr_pdt_shd.g_old_rec.position_id,hr_api.g_number)
2632 <> nvl(p_position_id,hr_api.g_number)
2633 or nvl(hr_pdt_shd.g_old_rec.grade_id,hr_api.g_number)
2634 <> nvl(p_grade_id,hr_api.g_number)
2635 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2636 or not l_api_updating) then
2637 --
2638 if p_position_id is not null and p_grade_id is not null then
2639 open csr_any_valid_grades;
2640 fetch csr_any_valid_grades into l_dummy;
2641 if csr_any_valid_grades%found then
2642 close csr_any_valid_grades;
2643 --
2644 open csr_valid_grade;
2645 fetch csr_valid_grade into l_dummy;
2646 if csr_valid_grade%notfound then
2647 close csr_valid_grade;
2648 p_inv_pos_grade_warning := l_inv_pos_grade_warning;
2649 else
2650 close csr_valid_grade;
2651 end if;
2652 else
2653 close csr_any_valid_grades;
2654 end if; --csr_any_valid_grades
2655 end if; --pos and grade not null
2656 end if; --api updating
2657 end if; --multi message
2658 --
2659 hr_utility.set_location('Leaving:'||l_proc, 20);
2660 --
2661 exception
2662 when app_exception.application_exception then
2663 if hr_multi_message.exception_add
2664 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2665 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.GRADE_ID'
2666 ) then
2667 hr_utility.set_location(' Leaving:'||l_proc, 50);
2668 raise;
2669 end if;
2670 hr_utility.set_location(' Leaving:'||l_proc,60);
2671 end chk_position_id_grade_id;
2672 --
2673 -- ---------------------------------------------------------------------------
2674 -- |------------------------< chk_job_id_grade_id >--------------------------|
2675 -- ---------------------------------------------------------------------------
2676 --
2677 -- Desciption:
2678 -- This procedures validates that job and grade combination is valid
2679 --
2680 -- Pre-conditions :
2681 -- None
2682 --
2683 -- In Parameters :
2684 --
2685 --
2686 -- Post Success :
2687 -- Processing continues if the job and grade combo is valid
2688 --
2689 -- Post Failure :
2690 -- An application error will be raised and processing is terminated if the
2691 -- job and grade combo is invalid
2692 --
2693 -- Access Status :
2694 -- Internal Row Handler Use only.
2695 --
2696 -- {End of Comments}
2697 --
2698 -- ---------------------------------------------------------------------------
2699 Procedure chk_job_id_grade_id
2700 (p_job_id in hr_person_deployments.job_id%type
2701 ,p_grade_id in hr_person_deployments.grade_id%type
2702 ,p_start_date in hr_person_deployments.start_date%type
2703 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2704 ,p_object_version_number in hr_person_deployments.object_version_number%type
2705 ,p_inv_job_grade_warning out nocopy boolean
2706 ) is
2707 --
2708 l_proc varchar2(72) := g_package||'chk_job_id_grade_id';
2709 l_api_updating boolean;
2710 l_dummy number;
2711 l_inv_job_grade_warning boolean := false;
2712 --
2713 cursor csr_any_valid_grades is
2714 select 1
2715 from per_valid_grades
2716 where job_id = p_job_id
2717 and p_start_date between
2718 date_from and nvl(date_to,hr_api.g_eot);
2719 --
2720 cursor csr_valid_grade is
2721 select 1
2722 from per_valid_grades
2723 where job_id = p_job_id
2724 and grade_id = p_grade_id
2725 and p_start_date between
2726 date_from and nvl(date_to,hr_api.g_eot);
2727 --
2728 begin
2729 hr_utility.set_location('Entering:'||l_proc, 10);
2730 --
2731 hr_api.mandatory_arg_error
2732 (p_api_name => l_proc
2733 ,p_argument => 'start_date'
2734 ,p_argument_value => p_start_date
2735 );
2736 --
2737 if hr_multi_message.no_exclusive_error
2738 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.GRADE_ID'
2739 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.JOB_ID'
2740 ) then
2741 --
2742 l_api_updating := hr_pdt_shd.api_updating
2743 (p_person_deployment_id => p_person_deployment_id
2744 ,p_object_version_number => p_object_version_number);
2745 --
2746 if ( (l_api_updating and
2747 ( nvl(hr_pdt_shd.g_old_rec.job_id,hr_api.g_number)
2748 <> nvl(p_job_id,hr_api.g_number)
2749 or nvl(hr_pdt_shd.g_old_rec.grade_id,hr_api.g_number)
2750 <> nvl(p_grade_id,hr_api.g_number)
2751 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2752 or not l_api_updating) then
2753 --
2754 if p_job_id is not null and p_grade_id is not null then
2755 open csr_any_valid_grades;
2756 fetch csr_any_valid_grades into l_dummy;
2757 if csr_any_valid_grades%found then
2758 close csr_any_valid_grades;
2759 --
2760 open csr_valid_grade;
2761 fetch csr_valid_grade into l_dummy;
2762 if csr_valid_grade%notfound then
2763 close csr_valid_grade;
2764 p_inv_job_grade_warning := l_inv_job_grade_warning;
2765 else
2766 close csr_valid_grade;
2767 end if;
2768 else
2769 close csr_any_valid_grades;
2770 end if; --csr_any_valid_grades
2771 end if; --job and grade not null
2772 end if; --api updating
2773 end if; --multi message
2774 --
2775 hr_utility.set_location('Leaving:'||l_proc, 20);
2776 --
2777 exception
2778 when app_exception.application_exception then
2779 if hr_multi_message.exception_add
2780 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.JOB_ID'
2781 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.GRADE_ID'
2782 ) then
2783 hr_utility.set_location(' Leaving:'||l_proc, 50);
2784 raise;
2785 end if;
2786 hr_utility.set_location(' Leaving:'||l_proc,60);
2787 end chk_job_id_grade_id;
2788 --
2789 -- ---------------------------------------------------------------------------
2790 -- |------------------------< chk_position_id_org_id >------------------------|
2791 -- ---------------------------------------------------------------------------
2792 --
2793 -- Desciption:
2794 -- This procedures validates that the position and org combination is valid
2795 --
2796 -- Pre-conditions :
2797 -- None
2798 --
2799 -- In Parameters :
2800 -- p_position_id
2801 -- p_organization_id
2802 -- p_start_date
2803 --
2804 -- Post Success :
2805 -- Processing continues if the position and org combo is valid
2806 --
2807 -- Post Failure :
2808 -- An application error will be raised and processing is terminated if the
2809 -- position and org combo is invalid
2810 --
2811 -- Access Status :
2812 -- Internal Row Handler Use only.
2813 --
2814 -- {End of Comments}
2815 --
2816 -- ---------------------------------------------------------------------------
2817 Procedure chk_position_id_org_id
2818 (p_position_id in hr_person_deployments.position_id%type
2819 ,p_organization_id in hr_person_deployments.organization_id%type
2820 ,p_start_date in hr_person_deployments.start_date%type
2821 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2822 ,p_object_version_number in hr_person_deployments.object_version_number%type
2823 ) is
2824 --
2825 l_proc varchar2(72) := g_package||'chk_position_id_org_id';
2826 l_api_updating boolean;
2827 l_dummy number;
2828 --
2829 cursor csr_check_pos_org is
2830 select null
2831 from hr_positions_f hp,
2832 per_shared_types ps
2833 where hp.position_id = p_position_id
2834 and p_start_date between
2835 hp.effective_start_date and hp.effective_end_date
2836 and hp.organization_id = p_organization_id
2837 and p_start_date between
2838 hp.date_effective and nvl(hp.date_end,hr_api.g_eot)
2839 and ps.shared_type_id = hp.availability_status_id
2840 and ps.system_type_cd = 'ACTIVE' ;
2841 --
2842 begin
2843 hr_utility.set_location('Entering:'||l_proc, 10);
2844 --
2845 hr_api.mandatory_arg_error
2846 (p_api_name => l_proc
2847 ,p_argument => 'start_date'
2848 ,p_argument_value => p_start_date
2849 );
2850 --
2851 if hr_multi_message.no_exclusive_error
2852 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.ORGANIZATION_ID'
2853 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2854 ) then
2855 --
2856 l_api_updating := hr_pdt_shd.api_updating
2857 (p_person_deployment_id => p_person_deployment_id
2858 ,p_object_version_number => p_object_version_number);
2859 --
2860 if ( (l_api_updating and
2861 ( nvl(hr_pdt_shd.g_old_rec.position_id,hr_api.g_number)
2862 <> nvl(p_position_id,hr_api.g_number)
2863 or hr_pdt_shd.g_old_rec.organization_id <> p_organization_id
2864 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2865 or not l_api_updating) then
2866 --
2867 if p_position_id is not null and p_organization_id is not null then
2868 open csr_check_pos_org;
2869 fetch csr_check_pos_org into l_dummy;
2870 if csr_check_pos_org%notfound then
2871 close csr_check_pos_org;
2872 fnd_message.set_name('PER','HR_51056_ASG_INV_POS_ORG_COMB');
2873 fnd_message.raise_error;
2874 else
2875 close csr_check_pos_org;
2876 end if;
2877 end if; --pos and org not null
2878 end if; --api updating
2879 end if; --multi message
2880 --
2881 hr_utility.set_location('Leaving:'||l_proc, 20);
2882 --
2883 exception
2884 when app_exception.application_exception then
2885 if hr_multi_message.exception_add
2886 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.POSITION_ID'
2887 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.ORGANIZATION_ID'
2888 ) then
2889 hr_utility.set_location(' Leaving:'||l_proc, 50);
2890 raise;
2891 end if;
2892 hr_utility.set_location(' Leaving:'||l_proc,60);
2893 end chk_position_id_org_id;
2894 --
2895 -- ---------------------------------------------------------------------------
2896 -- |------------------------< chk_payroll_id >-------------------------------|
2897 -- ---------------------------------------------------------------------------
2898 --
2899 -- Desciption:
2900 -- This procedures validates that payroll is valid for the host BG.
2901 -- If the legislation is US or CA, then it must be null since there can bo no address
2902 -- entered against a deployment proposal.
2903 --
2904 --
2905 -- Pre-conditions :
2906 -- None
2907 --
2908 -- In Parameters :
2909 -- p_payroll_id
2910 -- p_start_date
2911 -- p_to_business_group_id
2912 --
2913 -- Post Success :
2914 -- Processing continues if the payroll is valid
2915 --
2916 -- Post Failure :
2917 -- An application error will be raised and processing is terminated if the
2918 -- payroll is invalid
2919 --
2920 -- Access Status :
2921 -- Internal Row Handler Use only.
2922 --
2923 -- {End of Comments}
2924 --
2925 -- ---------------------------------------------------------------------------
2926 Procedure chk_payroll_id
2927 (p_payroll_id in hr_person_deployments.payroll_id%type
2928 ,p_start_date in hr_person_deployments.start_date%type
2929 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
2930 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
2931 ,p_object_version_number in hr_person_deployments.object_version_number%type
2932 ) is
2933 --
2934 l_proc varchar2(72) := g_package||'chk_payroll_id';
2935 l_api_updating boolean;
2936 l_dummy number;
2937 l_legislation_code per_business_groups.legislation_code%type;
2938 --
2939 cursor csr_get_leg_code is
2940 select legislation_code
2941 from per_business_groups_perf
2942 where business_group_id = p_to_business_group_id;
2943 --
2944 cursor csr_check_payroll is
2945 select 1
2946 from pay_all_payrolls_f
2947 where p_start_date between
2948 effective_start_date and effective_end_date
2949 and payroll_id = p_payroll_id
2950 and business_group_id = p_to_business_group_id;
2951 --
2952 begin
2953 hr_utility.set_location('Entering:'||l_proc, 10);
2954 --
2955 hr_api.mandatory_arg_error
2956 (p_api_name => l_proc
2957 ,p_argument => 'start_date'
2958 ,p_argument_value => p_start_date
2959 );
2960 --
2961 hr_api.mandatory_arg_error
2962 (p_api_name => l_proc
2963 ,p_argument => 'to_business_group_id'
2964 ,p_argument_value => p_to_business_group_id
2965 );
2966 --
2967 if hr_multi_message.no_all_inclusive_error
2968 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
2969 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
2970 ) then
2971 --
2972 l_api_updating := hr_pdt_shd.api_updating
2973 (p_person_deployment_id => p_person_deployment_id
2974 ,p_object_version_number => p_object_version_number);
2975 --
2976 if ( (l_api_updating and
2977 (nvl(hr_pdt_shd.g_old_rec.payroll_id,hr_api.g_number)
2978 <> nvl(p_payroll_id,hr_api.g_number)
2979 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
2980 or not l_api_updating) then
2981 --
2982 if p_payroll_id is not null then
2983 open csr_check_payroll;
2984 fetch csr_check_payroll into l_dummy;
2985 if csr_check_payroll%notfound then
2986 close csr_check_payroll;
2987 fnd_message.set_name('PER','HR_7370_ASG_INVALID_PAYROLL');
2988 fnd_message.raise_error;
2989 else
2990 close csr_check_payroll;
2991 end if;
2992 --
2993 open csr_get_leg_code;
2994 fetch csr_get_leg_code into l_legislation_code;
2995 close csr_get_leg_code;
2996 --
2997 if hr_general.chk_geocodes_installed = 'Y'
2998 and ( ( l_legislation_code = 'CA'
2999 and hr_utility.chk_product_install(p_product => 'Oracle Payroll',
3000 p_legislation => 'CA'))
3001 OR ( l_legislation_code = 'US'
3002 and hr_utility.chk_product_install(p_product => 'Oracle Payroll',
3003 p_legislation => 'US')))
3004 then
3005 fnd_message.set_name('PER','HR_449646_PDT_NO_PAYROLL');
3006 fnd_message.raise_error;
3007 end if; -- leg code check
3008 end if; --payroll not null
3009 end if; --api updating
3010 end if; --multi message
3011 --
3012 hr_utility.set_location('Leaving:'||l_proc, 20);
3013 --
3014 exception
3015 when app_exception.application_exception then
3016 if hr_multi_message.exception_add
3017 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PAYROLL_ID'
3018 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3019 ) then
3020 hr_utility.set_location(' Leaving:'||l_proc, 50);
3021 raise;
3022 end if;
3023 hr_utility.set_location(' Leaving:'||l_proc,60);
3024 end chk_payroll_id;
3025 --
3026 -- ---------------------------------------------------------------------------
3027 -- |------------------------< chk_assignment_status_type_id >----------------|
3028 -- ---------------------------------------------------------------------------
3029 --
3030 -- Desciption:-- This procedures validates that assignment_status_type_id exists in the Host BG
3031 -- and is of ACTIVE_ASG
3032 --
3033 -- Pre-conditions :
3034 -- None
3035 --
3036 -- In Parameters :
3037 -- p_assignment_status_type_id
3038 -- p_to_business_group_id
3039 --
3040 -- Post Success :
3041 -- Processing continues if the assignment_status_type_id is valid
3042 --
3043 -- Post Failure :
3044 -- An application error will be raised and processing is terminated if the
3045 -- assignment_status_type_id is invalid
3046 --
3047 -- Access Status :
3048 -- Internal Row Handler Use only.
3049 --
3050 -- {End of Comments}
3051 --
3052 -- ---------------------------------------------------------------------------
3053 Procedure chk_assignment_status_type_id
3054 (p_assignment_status_type_id in hr_person_deployments.assignment_status_type_id%type
3055 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
3056 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3057 ,p_object_version_number in hr_person_deployments.object_version_number%type
3058 ) is
3059 --
3060 l_proc varchar2(72) := g_package||'chk_assignment_status_type_id';
3061 l_api_updating boolean;
3062 l_active_flag per_assignment_status_types.active_flag%type;
3063 l_per_system_status per_assignment_status_types.per_system_status%type;
3064 l_legislation_code per_business_groups.legislation_code%type;
3065 --
3066 cursor csr_get_leg_code is
3067 select legislation_code
3068 from per_business_groups_perf
3069 where business_group_id = p_to_business_group_id;
3070 --
3071 cursor csr_check_asg_status_amend is
3072 select active_flag, per_system_status
3073 from per_ass_status_type_amends
3074 where assignment_status_type_id = p_assignment_status_type_id
3075 and business_group_id = p_to_business_group_id;
3076 --
3077 cursor csr_check_asg_status(p_legislation_code per_business_groups.legislation_code%TYPE) is
3078 select active_flag, per_system_status
3079 from per_assignment_status_types
3080 where assignment_status_type_id = p_assignment_status_type_id
3081 and nvl(business_group_id,p_to_business_group_id) = p_to_business_group_id
3082 and nvl(legislation_code,p_legislation_code) = p_legislation_code;
3083 /*
3084 and (business_group_id is not null
3085 and business_group_id = p_to_business_group_id)
3086 or (business_group_id is null
3087 and (legislation_code is not null
3088 and legislation_code= p_legislation_code));
3089 */
3090 --
3091 begin
3092 hr_utility.set_location('Entering:'||l_proc, 10);
3093 --
3094 hr_api.mandatory_arg_error
3095 (p_api_name => l_proc
3096 ,p_argument => 'to_business_group_id'
3097 ,p_argument_value => p_to_business_group_id
3098 );
3099 --
3100 if hr_multi_message.no_all_inclusive_error
3101 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
3102 ) then
3103 --
3104 l_api_updating := hr_pdt_shd.api_updating
3105 (p_person_deployment_id => p_person_deployment_id
3106 ,p_object_version_number => p_object_version_number);
3107 --
3108 if ( (l_api_updating and
3109 (nvl(hr_pdt_shd.g_old_rec.assignment_status_type_id,hr_api.g_number)
3110 <> nvl(p_assignment_status_type_id,hr_api.g_number)))
3111 or not l_api_updating) then
3112 --
3113 if p_assignment_status_type_id is not null then
3114 open csr_check_asg_status_amend;
3115 fetch csr_check_asg_status_amend into l_active_flag,l_per_system_status;
3116 if csr_check_asg_status_amend%notfound then
3117 close csr_check_asg_status_amend;
3118 --
3119 open csr_get_leg_code;
3120 fetch csr_get_leg_code into l_legislation_code;
3121 close csr_get_leg_code;
3122 --
3123 open csr_check_asg_status(l_legislation_code);
3124 fetch csr_check_asg_status into l_active_flag,l_per_system_status;
3125 if csr_check_asg_status%notfound then
3126 close csr_check_asg_status;
3127 fnd_message.set_name('PER','HR_7940_ASG_INV_ASG_STAT_TYPE');
3128 fnd_message.raise_error;
3129 else
3130 close csr_check_asg_status;
3131 if l_active_flag <> 'Y' then
3132 fnd_message.set_name('PER','HR_51206_ASG_INV_AST_ACT_FLG');
3133 fnd_message.raise_error;
3134 end if;
3135 --
3136 if l_per_system_status <> 'ACTIVE_ASSIGN' then
3137 fnd_message.set_name('PER','HR_7941_ASG_INV_STAT_NOT_ACT');
3138 fnd_message.raise_error;
3139 end if;
3140 end if;
3141 else
3142 close csr_check_asg_status_amend;
3143 end if;
3144 end if;
3145 end if; --api updating
3146 end if; --multi message
3147 --
3148 hr_utility.set_location('Leaving:'||l_proc, 20);
3149 --
3150 exception
3151 when app_exception.application_exception then
3152 if hr_multi_message.exception_add
3153 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.ASSIGNMENT_STATUS_TYPE_ID'
3154 ) then
3155 hr_utility.set_location(' Leaving:'||l_proc, 50);
3156 raise;
3157 end if;
3158 hr_utility.set_location(' Leaving:'||l_proc,60);
3159 end chk_assignment_status_type_id;
3160 --
3161 -- ---------------------------------------------------------------------------
3162 -- |------------------------< chk_supervisor_id >----------------------------|
3163 -- ---------------------------------------------------------------------------
3164 --
3165 -- Desciption:
3166 -- This procedures validates that supervisor_id is valid for range of assignment
3167 --
3168 -- Pre-conditions :
3169 -- None
3170 --
3171 -- In Parameters :
3172 -- p_supervisor_id
3173 -- p_start_date
3174 -- p_from_person_id
3175 -- p_to_person_id
3176 -- p_to_business_group_id
3177 --
3178 -- Post Success :
3179 -- Processing continues if the is valid
3180 --
3181 -- Post Failure :
3182 -- An application error will be raised and processing is terminated if the
3183 -- is invalid
3184 --
3185 -- Access Status :
3186 -- Internal Row Handler Use only.
3187 --
3188 -- {End of Comments}
3189 --
3190 -- ---------------------------------------------------------------------------
3191 Procedure chk_supervisor_id
3192 (p_supervisor_id in hr_person_deployments.supervisor_id%type
3193 ,p_start_date in hr_person_deployments.start_date%type
3194 ,p_from_person_id in hr_person_deployments.from_person_id%type
3195 ,p_to_person_id in hr_person_deployments.to_person_id%type
3196 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
3197 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3198 ,p_object_version_number in hr_person_deployments.object_version_number%type
3199 ) is
3200 --
3201 l_proc varchar2(72) := g_package||'chk_supervisor_id';
3202 l_api_updating boolean;
3203 l_per_party_id number;
3204 l_sup_party_id number;
3205 l_sup_bg_id number;
3206 --
3207 cursor csr_party_id(p_per_id number) IS
3208 select party_id
3209 from per_all_people_f
3210 where person_id = p_per_id
3211 and p_start_date
3212 between effective_start_date
3213 and effective_end_date;
3214 --
3215 cursor csr_check_sup is
3216 select 1
3217 from per_all_people_f
3218 where person_id = p_supervisor_id
3219 and p_start_date between
3220 effective_start_date and effective_end_date
3221 and nvl(current_employee_flag,'N') = 'Y';
3222 --
3223 begin
3224 hr_utility.set_location('Entering:'||l_proc, 10);
3225 --
3226 hr_api.mandatory_arg_error
3227 (p_api_name => l_proc
3228 ,p_argument => 'start_date'
3229 ,p_argument_value => p_start_date
3230 );
3231 --
3232 if hr_multi_message.no_all_inclusive_error
3233 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3234 ) then
3235 --
3236 l_api_updating := hr_pdt_shd.api_updating
3237 (p_person_deployment_id => p_person_deployment_id
3238 ,p_object_version_number => p_object_version_number);
3239 --
3240 if ( (l_api_updating and
3241 ((nvl(hr_pdt_shd.g_old_rec.supervisor_id,hr_api.g_number)
3242 <> nvl(p_supervisor_id,hr_api.g_number))
3243 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
3244 or not l_api_updating) then
3245 --
3246 if p_supervisor_id is not null then
3247 --
3248 if p_supervisor_id = nvl(p_to_person_id,-1)
3249 or p_supervisor_id = p_from_person_id then
3250 fnd_message.set_name('PER','HR_51143_ASG_EMP_EQUAL_SUP');
3251 fnd_message.raise_error;
3252 end if;
3253 --
3254 open csr_party_id(p_from_person_id);
3255 fetch csr_party_id into l_per_party_id;
3256 close csr_party_id;
3257 --
3258 open csr_party_id(p_supervisor_id);
3259 fetch csr_party_id into l_sup_party_id;
3260 close csr_party_id;
3261 --
3262 if l_per_party_id = l_sup_party_id then
3263 fnd_message.set_name('PER','HR_449603_ASG_SUP_DUP_PER');
3264 fnd_message.raise_error;
3265 end if;
3266 --
3267 open csr_check_sup;
3268 fetch csr_check_sup into l_sup_bg_id;
3269 if csr_check_sup%notfound then
3270 close csr_check_sup;
3271 fnd_message.set_name('PER','PAY_7599_SYS_SUP_DT_OUTDATE');
3272 fnd_message.raise_error;
3273 else
3274 close csr_check_sup;
3275 if (p_to_business_group_id <> l_sup_bg_id AND
3276 nvl(fnd_profile.value('HR_CROSS_BUSINESS_GROUP'),'N')='N') then
3277 fnd_message.set_name('PER','HR_51145_ASG_SUP_BG_NE_EMP_BG');
3278 fnd_message.raise_error;
3279 end if;
3280 end if;
3281 end if; --supervisor id not null
3282 end if; --api updating
3283 end if; -- muti message
3284 --
3285 hr_utility.set_location('Leaving:'||l_proc, 20);
3286 --
3287 exception
3288 when app_exception.application_exception then
3289 if hr_multi_message.exception_add
3290 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.SUPERVISOR_ID'
3291 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3292 ) then
3293 hr_utility.set_location(' Leaving:'||l_proc, 50);
3294 raise;
3295 end if;
3296 hr_utility.set_location(' Leaving:'||l_proc,60);
3297 end chk_supervisor_id;
3298 --
3299 -- ---------------------------------------------------------------------------
3300 -- |------------------------< chk_supervisor_assignment_id >-----------------|
3301 -- ---------------------------------------------------------------------------
3302 --
3303 -- Desciption:
3304 -- This procedures validates that supervisor_assignment_id is an existing employee
3305 -- assignment of the given supervisor.
3306 --
3307 -- Pre-conditions :
3308 -- None
3309 --
3310 -- In Parameters :
3311 -- p_supervisor_id
3312 -- p_supervisor_assignment_id
3313 -- p_start_date
3314 --
3315 -- Post Success :
3316 -- Processing continues if the supervisor_assignment_id is valid
3317 --
3318 -- Post Failure :
3319 -- An application error will be raised and processing is terminated if the
3320 -- supervisor_assignment_id is invalid
3321 --
3322 -- Access Status :
3323 -- Internal Row Handler Use only.
3324 --
3325 -- {End of Comments}
3326 --
3327 -- ---------------------------------------------------------------------------
3328 Procedure chk_supervisor_assignment_id
3329 (p_supervisor_assignment_id in out nocopy hr_person_deployments.supervisor_assignment_id%type
3330 ,p_supervisor_id in hr_person_deployments.supervisor_id%type
3331 ,p_start_date in hr_person_deployments.start_date%type
3332 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3333 ,p_object_version_number in hr_person_deployments.object_version_number%type
3334 ) is
3335 --
3336 l_proc varchar2(72) := g_package||'chk_supervisor_assignment_id';
3337 l_api_updating boolean;
3338 l_sup_asg_type per_all_assignments_f.assignment_type%type;
3339 --
3340 cursor csr_check_sup_asg is
3341 select assignment_type
3342 from per_all_assignments_f
3343 -- where person_id = p_supervisor_id fix for the bug#13870904
3344 where assignment_id = p_supervisor_assignment_id
3345 and p_start_date between
3346 effective_start_date and effective_end_date;
3347 --
3348 begin
3349 hr_utility.set_location('Entering:'||l_proc, 10);
3350 --
3351 hr_api.mandatory_arg_error
3352 (p_api_name => l_proc
3353 ,p_argument => 'start_date'
3354 ,p_argument_value => p_start_date
3355 );
3356 --
3357 if hr_multi_message.no_all_inclusive_error
3358 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3359 ) then
3360 --
3361 l_api_updating := hr_pdt_shd.api_updating
3362 (p_person_deployment_id => p_person_deployment_id
3363 ,p_object_version_number => p_object_version_number);
3364 --
3365 if ((l_api_updating and
3366 ( (nvl(hr_pdt_shd.g_old_rec.supervisor_id,hr_api.g_number)
3367 <> nvl(p_supervisor_id,hr_api.g_number))
3368 or (nvl(hr_pdt_shd.g_old_rec.supervisor_assignment_id,hr_api.g_number)
3369 <> nvl(p_supervisor_assignment_id,hr_api.g_number))
3370 or (hr_pdt_shd.g_old_rec.start_date <> p_start_date)
3371 )
3372 )
3373 or not l_api_updating
3374 ) then
3375 --
3376 if p_supervisor_id is null and p_supervisor_assignment_id is not null then
3377 p_supervisor_assignment_id := null;
3378 elsif p_supervisor_assignment_id is not null then
3379 open csr_check_sup_asg;
3380 fetch csr_check_sup_asg into l_sup_asg_type;
3381 if csr_check_sup_asg%notfound then
3382 close csr_check_sup_asg;
3383 fnd_message.set_name('PER','HR_50146_SUP_ASG_INVALID');
3384 fnd_message.raise_error;
3385 else
3386 close csr_check_sup_asg;
3387 if (l_sup_asg_type = 'E'
3388 or (l_sup_asg_type = 'C' and
3389 nvl(fnd_profile.value('HR_TREAT_CWK_AS_EMP'), 'N') = 'Y')) then
3390 null;
3391 else
3392 fnd_message.set_name('PER','HR_50147_SUP_ASG_WRONG_TYPE');
3393 fnd_message.raise_error;
3394 end if;
3395 end if;
3396
3397 end if;
3398 end if; --api updating
3399 end if; --multi message
3400 --
3401 hr_utility.set_location('Leaving:'||l_proc, 20);
3402 --
3403 exception
3404 when app_exception.application_exception then
3405 if hr_multi_message.exception_add
3406 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.SUPERVISOR_ASSIGNMENT_ID'
3407 ) then
3408 hr_utility.set_location(' Leaving:'||l_proc, 50);
3409 raise;
3410 end if;
3411 hr_utility.set_location(' Leaving:'||l_proc,60);
3412 end chk_supervisor_assignment_id;
3413 --
3414 -- ---------------------------------------------------------------------------
3415 -- |------------------------< chk_pay_basis_id >-----------------------------|
3416 -- ---------------------------------------------------------------------------
3417 --
3418 -- Desciption:
3419 -- This procedures validates that pay_basis_id exists in host BG
3420 --
3421 -- Pre-conditions :
3422 -- None
3423 --
3424 -- In Parameters :
3425 -- p_pay_basis_id
3426 -- p_to_business_group_id
3427 --
3428 -- Post Success :
3429 -- Processing continues if thepay_basis_id is valid
3430 --
3431 -- Post Failure :
3432 -- An application error will be raised and processing is terminated if the
3433 -- pay_basis_id is invalid
3434 --
3435 -- Access Status :
3436 -- Internal Row Handler Use only.
3437 --
3438 -- {End of Comments}
3439 --
3440 -- ---------------------------------------------------------------------------
3441 Procedure chk_pay_basis_id
3442 (p_pay_basis_id in hr_person_deployments.pay_basis_id%type
3443 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
3444 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3445 ,p_object_version_number in hr_person_deployments.object_version_number%type
3446 ) is
3447 --
3448 l_proc varchar2(72) := g_package||'chk_pay_basis_id';
3449 l_api_updating boolean;
3450 l_business_group_id per_business_groups.business_group_id%TYPE;
3451 --
3452 cursor csr_check_pay_basis is
3453 select business_group_id
3454 from per_pay_bases
3455 where pay_basis_id = p_pay_basis_id;
3456 --
3457 begin
3458 hr_utility.set_location('Entering:'||l_proc, 10);
3459 --
3460 l_api_updating := hr_pdt_shd.api_updating
3461 (p_person_deployment_id => p_person_deployment_id
3462 ,p_object_version_number => p_object_version_number);
3463 --
3464 if ( (l_api_updating and
3465 (nvl(hr_pdt_shd.g_old_rec.pay_basis_id,hr_api.g_number)
3466 <> nvl(p_pay_basis_id,hr_api.g_number)))
3467 or not l_api_updating) then
3468 --
3469 if p_pay_basis_id is not null then
3470 open csr_check_pay_basis;
3471 fetch csr_check_pay_basis into l_business_group_id;
3472 if csr_check_pay_basis%notfound then
3473 close csr_check_pay_basis;
3474 fnd_message.set_name('PER','HR_51168_ASG_INV_PAY_BASIS_ID');
3475 fnd_message.raise_error;
3476 else
3477 close csr_check_pay_basis;
3478 if p_to_business_group_id <> l_business_group_id then
3479 fnd_message.set_name('PER','HR_51169_ASG_INV_PAY_BAS_BG');
3480 fnd_message.raise_error;
3481 end if;
3482 end if;
3483 end if; -- pay basis not null
3484 end if; --api updating
3485 --
3486 hr_utility.set_location('Leaving:'||l_proc, 20);
3487 --
3488 exception
3489 when app_exception.application_exception then
3490 if hr_multi_message.exception_add
3491 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PAY_BASIS_ID'
3492 ) then
3493 hr_utility.set_location(' Leaving:'||l_proc, 50);
3494 raise;
3495 end if;
3496 hr_utility.set_location(' Leaving:'||l_proc,60);
3497 end chk_pay_basis_id;
3498 --
3499 -- ---------------------------------------------------------------------------
3500 -- |------------------------< chk_people_group_id >--------------------------|
3501 -- ---------------------------------------------------------------------------
3502 --
3503 -- Desciption:
3504 -- This procedures validates that people group id exists on pay_people_groups
3505 -- and that the structure of the provided combination is valid for the Host BG
3506 --
3507 -- Pre-conditions :
3508 -- None
3509 --
3510 -- In Parameters :
3511 -- p_people_group_id
3512 -- p_start_date
3513 -- p_to_business_group_id
3514 --
3515 -- Post Success :
3516 -- Processing continues if the people_group_id is valid
3517 --
3518 -- Post Failure :
3519 -- An application error will be raised and processing is terminated if the
3520 -- people_group_id is invalid
3521 --
3522 -- Access Status :
3523 -- Internal Row Handler Use only.
3524 --
3525 -- {End of Comments}
3526 --
3527 -- ---------------------------------------------------------------------------
3528 Procedure chk_people_group_id
3529 (p_people_group_id in hr_person_deployments.people_group_id%type
3530 ,p_start_date in hr_person_deployments.start_date%type
3531 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
3532 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3533 ,p_object_version_number in hr_person_deployments.object_version_number%type
3534 ) is
3535 --
3536 l_proc varchar2(72) := g_package||'chk_people_group_id';
3537 l_api_updating boolean;
3538 l_id_flex_num pay_people_groups.id_flex_num%type;
3539 l_enabled_flag pay_people_groups.enabled_flag%TYPE;
3540 l_bg_id_flex_num per_business_groups_perf.people_group_structure%type;
3541 --
3542 cursor csr_check_grp is
3543 select enabled_flag,id_flex_num
3544 from pay_people_groups
3545 where people_group_id = p_people_group_id
3546 and p_start_date between
3547 nvl(start_date_active,hr_api.g_sot) and nvl(end_date_active,hr_api.g_eot);
3548 --
3549 cursor csr_get_bg_flex is
3550 select people_group_structure
3551 from per_business_groups_perf
3552 where business_group_id = p_to_business_group_id;
3553 --
3554 begin
3555 hr_utility.set_location('Entering:'||l_proc, 10);
3556 --
3557 hr_api.mandatory_arg_error
3558 (p_api_name => l_proc
3559 ,p_argument => 'start_date'
3560 ,p_argument_value => p_start_date
3561 );
3562 --
3563 hr_api.mandatory_arg_error
3564 (p_api_name => l_proc
3565 ,p_argument => 'to_business_group_id'
3566 ,p_argument_value => p_to_business_group_id
3567 );
3568 --
3569 if hr_multi_message.no_all_inclusive_error
3570 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3571 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
3572 ) then
3573 --
3574 l_api_updating := hr_pdt_shd.api_updating
3575 (p_person_deployment_id => p_person_deployment_id
3576 ,p_object_version_number => p_object_version_number);
3577 --
3578 if ( (l_api_updating and
3579 (nvl(hr_pdt_shd.g_old_rec.people_group_id,hr_api.g_number)
3580 <> nvl(p_people_group_id,hr_api.g_number)
3581 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
3582 or not l_api_updating) then
3583 --
3584 if p_people_group_id is not null then
3585 open csr_check_grp;
3586 fetch csr_check_grp into l_enabled_flag,l_id_flex_num;
3587 if csr_check_grp%notfound then
3588 close csr_check_grp;
3589 fnd_message.set_name('PER','HR_7385_ASG_INV_PEOPLE_GROUP');
3590 fnd_message.raise_error;
3591 else
3592 close csr_check_grp;
3593 if l_enabled_flag <> 'Y' then
3594 fnd_message.set_name('PER','HR_51252_ASG_INV_PGP_ENBD_FLAG');
3595 fnd_message.raise_error;
3596 end if;
3597 --
3598 open csr_get_bg_flex;
3599 fetch csr_get_bg_flex into l_bg_id_flex_num;
3600 close csr_get_bg_flex;
3601 --
3602 if to_number(l_bg_id_flex_num) <> l_id_flex_num then
3603 fnd_message.set_name('PER','HR_7386_ASG_INV_PEOP_GRP_LINK');
3604 fnd_message.raise_error;
3605 end if;
3606 --
3607 end if; --csr_check_grp not found
3608 end if; --people group not null
3609 end if; --api updating
3610 end if; --multi message
3611 --
3612 hr_utility.set_location('Leaving:'||l_proc, 20);
3613 --
3614 exception
3615 when app_exception.application_exception then
3616 if hr_multi_message.exception_add
3617 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PEOPLE_GROUP_ID'
3618 ) then
3619 hr_utility.set_location(' Leaving:'||l_proc, 50);
3620 raise;
3621 end if;
3622 hr_utility.set_location(' Leaving:'||l_proc,60);
3623 end chk_people_group_id;
3624 --
3625 -- ---------------------------------------------------------------------------
3626 -- |------------------------< chk_soft_coding_keyflex_id >-------------------|
3627 -- ---------------------------------------------------------------------------
3628 --
3629 -- Desciption:
3630 -- This procedures validates that people group id exists on
3631 -- and that the structure of the provided combination is valid for the Host BG
3632 --
3633 -- Pre-conditions :
3634 -- None
3635 --
3636 -- In Parameters :
3637 -- p_soft_coding_keyflex_id
3638 -- p_start_date
3639 -- p_to_business_group_id
3640 --
3641 -- Post Success :
3642 -- Processing continues if the soft_coding_keyflex_id is valid
3643 --
3644 -- Post Failure :
3645 -- An application error will be raised and processing is terminated if the
3646 -- soft_coding_keyflex_id is invalid
3647 --
3648 -- Access Status :
3649 -- Internal Row Handler Use only.
3650 --
3651 -- {End of Comments}
3652 --
3653 -- ---------------------------------------------------------------------------
3654 Procedure chk_soft_coding_keyflex_id
3655 (p_soft_coding_keyflex_id in hr_person_deployments.soft_coding_keyflex_id%type
3656 ,p_start_date in hr_person_deployments.start_date%type
3657 ,p_to_business_group_id in hr_person_deployments.to_business_group_id%type
3658 ,p_payroll_id in hr_person_deployments.payroll_id%type
3659 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3660 ,p_object_version_number in hr_person_deployments.object_version_number%type
3661 ) is
3662 --
3663 l_proc varchar2(72) := g_package||'chk_soft_coding_keyflex_id';
3664 l_api_updating boolean;
3665 l_dummy number;
3666 l_legislation_code per_business_groups_perf.legislation_code%type;
3667 --
3668 cursor csr_check_scl is
3669 select 1
3670 from hr_soft_coding_keyflex
3671 where soft_coding_keyflex_id = p_soft_coding_keyflex_id
3672 and enabled_flag = 'Y'
3673 and p_start_date between
3674 nvl(start_date_active,hr_api.g_sot) and nvl(end_date_active,hr_api.g_eot);
3675 --
3676 cursor csr_bg_leg is
3677 select legislation_code
3678 from per_business_groups_perf
3679 where business_group_id = p_to_business_group_id;
3680 --
3681 cursor csr_pay_legislation_rules(p_legislation_code per_business_groups_perf.legislation_code%type) is
3682 select 1
3683 from pay_legislation_rules
3684 where legislation_code = p_legislation_code
3685 and rule_type = 'TAX_UNIT'
3686 and rule_mode = 'Y';
3687 --
3688 cursor csr_tax_unit_message(p_message_name varchar2) is
3689 select 1
3690 from fnd_new_messages
3691 where message_name = p_message_name
3692 and application_id = 801;
3693 --
3694 begin
3695 hr_utility.set_location('Entering:'||l_proc, 10);
3696 --
3697 hr_api.mandatory_arg_error
3698 (p_api_name => l_proc
3699 ,p_argument => 'start_date'
3700 ,p_argument_value => p_start_date
3701 );
3702 --
3703 hr_api.mandatory_arg_error
3704 (p_api_name => l_proc
3705 ,p_argument => 'to_business_group_id'
3706 ,p_argument_value => p_to_business_group_id
3707 );
3708 --
3709 if hr_multi_message.no_all_inclusive_error
3710 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3711 ,p_check_column2 => 'HR_PERSON_DEPLOYMENTS.TO_BUSINESS_GROUP_ID'
3712 ) then
3713 --
3714 l_api_updating := hr_pdt_shd.api_updating
3715 (p_person_deployment_id => p_person_deployment_id
3716 ,p_object_version_number => p_object_version_number);
3717 --
3718 if ( (l_api_updating and
3719 (nvl(hr_pdt_shd.g_old_rec.soft_coding_keyflex_id,hr_api.g_number)
3720 <> nvl(p_soft_coding_keyflex_id,hr_api.g_number)
3721 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
3722 or (l_api_updating and
3723 p_soft_coding_keyflex_id is null and p_payroll_id is not null)
3724 or not l_api_updating) then
3725 --
3726 if p_soft_coding_keyflex_id is not null then
3727 open csr_check_scl;
3728 fetch csr_check_scl into l_dummy;
3729 if csr_check_scl%notfound then
3730 close csr_check_scl;
3731 fnd_message.set_name('PER','HR_7383_ASG_INV_KEYFLEX');
3732 hr_multi_message.add
3733 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.SOFT_CODING_KEYFLEX_ID' ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE');
3734 else
3735 close csr_check_scl;
3736 --
3737 end if;
3738 else -- bug fix 6956927
3739 -- Check that for relevant legislations SCL is mandatory,
3740 -- when payroll_id is populated
3741 if p_payroll_id is not null then
3742 open csr_bg_leg;
3743 fetch csr_bg_leg into l_legislation_code;
3744 close csr_bg_leg;
3745 --
3746 open csr_pay_legislation_rules(l_legislation_code);
3747 fetch csr_pay_legislation_rules into l_dummy;
3748 if csr_pay_legislation_rules%found then
3749 close csr_pay_legislation_rules;
3750 if l_legislation_code = 'US' then
3751 fnd_message.set_name('PER','HR_50001_EMP_ASS_NO_GRE');
3752 hr_multi_message.add
3753 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PAYROLL_ID');
3754 else
3755 open csr_tax_unit_message('HR_INV_LEG_ENT_'||l_legislation_code);
3756 fetch csr_tax_unit_message into l_dummy;
3757 if csr_tax_unit_message%found then
3758 close csr_tax_unit_message;
3759 fnd_message.set_name('PER','HR_INV_LEG_ENT_'||l_legislation_code);
3760 else
3761 close csr_tax_unit_message;
3762 fnd_message.set_name('PER','HR_34024_IP_INV_LEG_ENT');
3763 end if;
3764 hr_multi_message.add
3765 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.PAYROLL_ID');
3766 end if; --legislation code
3767 end if; --csr_pay_legislation_rules found
3768 end if; --payroll_id not null
3769 -- end if; --csr_check_scl not found
3770 end if; --soft coding keyflex not null
3771 end if; --api updating
3772 end if; --multi message
3773 --
3774 hr_utility.set_location('Leaving:'||l_proc, 20);
3775 --
3776 exception
3777 when app_exception.application_exception then
3778 if hr_multi_message.exception_add
3779 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.SOFT_CODING_KEYFLEX_ID'
3780 ) then
3781 hr_utility.set_location(' Leaving:'||l_proc, 50);
3782 raise;
3783 end if;
3784 hr_utility.set_location(' Leaving:'||l_proc,60);
3785 end chk_soft_coding_keyflex_id;
3786 --
3787 -- ---------------------------------------------------------------------------
3788 -- |------------------------< chk_assignment_category >----------------------|
3789 -- ---------------------------------------------------------------------------
3790 --
3791 -- Desciption:
3792 -- This procedures validates that assignment category is valid from lookup EMP_CAT
3793 --
3794 -- Pre-conditions :
3795 -- None
3796 --
3797 -- In Parameters :
3798 -- p_assignment_category
3799 -- p_start_date
3800 --
3801 -- Post Success :
3802 -- Processing continues if the is valid
3803 --
3804 -- Post Failure :
3805 -- An application error will be raised and processing is terminated if the
3806 -- is invalid
3807 --
3808 -- Access Status :
3809 -- Internal Row Handler Use only.
3810 --
3811 -- {End of Comments}
3812 --
3813 -- ---------------------------------------------------------------------------
3814 Procedure chk_assignment_category
3815 (p_assignment_category in hr_person_deployments.assignment_category%type
3816 ,p_start_date in hr_person_deployments.start_date%type
3817 ,p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3818 ,p_object_version_number in hr_person_deployments.object_version_number%type
3819 ) is
3820 --
3821 l_proc varchar2(72) := g_package||'chk_assignment_category';
3822 l_api_updating boolean;
3823 --
3824 begin
3825 hr_utility.set_location('Entering:'||l_proc, 10);
3826 --
3827 hr_api.mandatory_arg_error
3828 (p_api_name => l_proc
3829 ,p_argument => 'start_date'
3830 ,p_argument_value => p_start_date
3831 );
3832 --
3833 if hr_multi_message.no_all_inclusive_error
3834 (p_check_column1 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3835 ) then
3836 --
3837 l_api_updating := hr_pdt_shd.api_updating
3838 (p_person_deployment_id => p_person_deployment_id
3839 ,p_object_version_number => p_object_version_number);
3840 --
3841 if ( (l_api_updating and
3842 (nvl(hr_pdt_shd.g_old_rec.assignment_category,hr_api.g_varchar2)
3843 <> nvl(p_assignment_category,hr_api.g_varchar2)
3844 or hr_pdt_shd.g_old_rec.start_date <> p_start_date))
3845 or not l_api_updating) then
3846 --
3847 if p_assignment_category is not null
3848 and hr_api.not_exists_in_leg_lookups
3849 (p_effective_date => p_start_date
3850 ,p_lookup_type => 'EMP_CAT'
3851 ,p_lookup_code => p_assignment_category
3852 ) then
3853 fnd_message.set_name('PER','HR_51028_ASG_INV_EMP_CATEGORY');
3854 fnd_message.raise_error;
3855 end if; --assignment category not null
3856 end if; --api updating
3857 end if; --multi message
3858 --
3859 hr_utility.set_location('Leaving:'||l_proc, 20);
3860 --
3861 exception
3862 when app_exception.application_exception then
3863 if hr_multi_message.exception_add
3864 (p_associated_column1 => 'HR_PERSON_DEPLOYMENTS.ASSIGNMENT_CATEGORY'
3865 ,p_associated_column2 => 'HR_PERSON_DEPLOYMENTS.START_DATE'
3866 ) then
3867 hr_utility.set_location(' Leaving:'||l_proc, 50);
3868 raise;
3869 end if;
3870 hr_utility.set_location(' Leaving:'||l_proc,60);
3871 end chk_assignment_category;
3872 --
3873 -- ---------------------------------------------------------------------------
3874 -- |------------------------< chk_delete >-----------------------------------|
3875 -- ---------------------------------------------------------------------------
3876 --
3877 -- Desciption:
3878 -- This procedures validates that
3879 --
3880 -- Pre-conditions :
3881 -- None
3882 --
3883 -- In Parameters :
3884 --
3885 --
3886 -- Post Success :
3887 -- Processing continues if the is valid
3888 --
3889 -- Post Failure :
3890 -- An application error will be raised and processing is terminated if the
3891 -- is invalid
3892 --
3893 -- Access Status :
3894 -- Internal Row Handler Use only.
3895 --
3896 -- {End of Comments}
3897 --
3898 -- ---------------------------------------------------------------------------
3899 Procedure chk_delete
3900 (p_person_deployment_id in hr_person_deployments.person_deployment_id%type
3901 ) is
3902 --
3903 l_proc varchar2(72) := g_package||'chk_delete';
3904 l_api_updating boolean;
3905 l_start_date date;
3906 l_status hr_person_deployments.status%type;
3907 --
3908 cursor csr_deployment is
3909 select start_date,status
3910 from hr_person_deployments
3911 where person_deployment_id = p_person_deployment_id;
3912 --
3913 begin
3914 hr_utility.set_location('Entering:'||l_proc, 10);
3915 --
3916 open csr_deployment;
3917 fetch csr_deployment into l_start_date,l_status;
3918 if csr_deployment%notfound then
3919 close csr_deployment;
3920 fnd_message.set_name('PER','HR_449647_PDT_DPL_DEL_PK');
3921 fnd_message.raise_error;
3922 else
3923 close csr_deployment;
3924 if l_status = 'ACTIVE' then
3925 fnd_message.set_name('PER','HR_449648_PDT_DPL_DEL_STATUS');
3926 fnd_message.raise_error;
3927 end if;
3928 end if;
3929 --
3930 hr_utility.set_location('Leaving:'||l_proc, 20);
3931 --
3932 end chk_delete;
3933 --
3934 -- ----------------------------------------------------------------------------
3935 -- |---------------------------< insert_validate >----------------------------|
3936 -- ----------------------------------------------------------------------------
3937 Procedure insert_validate
3938 (p_rec in out nocopy hr_pdt_shd.g_rec_type
3939 ) is
3940 --
3941 l_proc varchar2(72) := g_package||'insert_validate';
3942 l_inv_pos_grade_warning boolean;
3943 l_inv_job_grade_warning boolean;
3944 --
3945 Begin
3946 hr_utility.set_location('Entering:'||l_proc, 5);
3947 --
3948 -- Call all supporting business operations
3949 --
3950 --
3951 -- Set security Group context based on the TO_BUSINESS_GROUP_ID since the data
3952 -- in this table is being held specifically to be copied to an assignment there
3953 --
3954 hr_oru_bus.set_security_group_id(p_rec.to_business_group_id);
3955 --
3956 -- Validate Dependent Attributes
3957 --
3958 if g_debug then
3959 hr_utility.set_location(l_proc, 10);
3960 end if;
3961 --
3962 hr_pdt_bus.chk_business_groups
3963 (p_from_business_group_id => p_rec.from_business_group_id
3964 ,p_to_business_group_id => p_rec.to_business_group_id
3965 );
3966 --
3967 if g_debug then
3968 hr_utility.set_location(l_proc, 15);
3969 end if;
3970 --
3971 hr_pdt_bus.chk_from_person_id
3972 (p_person_deployment_id => p_rec.person_deployment_id
3973 ,p_object_version_number => p_rec.object_version_number
3974 ,p_from_person_id => p_rec.from_person_id
3975 ,p_from_business_group_id => p_rec.from_business_group_id
3976 ,p_start_date => p_rec.start_date
3977 );
3978 --
3979 if g_debug then
3980 hr_utility.set_location(l_proc, 20);
3981 end if;
3982 --
3983 hr_pdt_bus.chk_to_person_id
3984 (p_person_deployment_id => p_rec.person_deployment_id
3985 ,p_object_version_number => p_rec.object_version_number
3986 ,p_to_person_id => p_rec.to_person_id
3987 ,p_to_business_group_id => p_rec.to_business_group_id
3988 ,p_start_date => p_rec.start_date
3989 ,p_status => p_rec.status
3990 );
3991 --
3992 if g_debug then
3993 hr_utility.set_location(l_proc, 25);
3994 end if;
3995 --
3996 hr_pdt_bus.chk_person_type_id
3997 (p_person_type_id => p_rec.person_type_id
3998 ,p_to_business_group_id => p_rec.to_business_group_id
3999 ,p_person_deployment_id => p_rec.person_deployment_id
4000 ,p_object_version_number => p_rec.object_version_number
4001 );
4002 --
4003 if g_debug then
4004 hr_utility.set_location(l_proc,30 );
4005 end if;
4006 --
4007 hr_pdt_bus.chk_start_end_date
4008 (p_start_date => p_rec.start_date
4009 ,p_end_date => p_rec.end_date
4010 ,p_person_deployment_id => p_rec.person_deployment_id
4011 ,p_object_version_number => p_rec.object_version_number
4012 ,p_status => p_rec.status
4013 );
4014 --
4015 if g_debug then
4016 hr_utility.set_location(l_proc, 35);
4017 end if;
4018 --
4019 hr_pdt_bus.chk_permanent
4020 (p_permanent => p_rec.permanent
4021 ,p_from_person_id => p_rec.from_person_id
4022 ,p_end_date => p_rec.end_date
4023 ,p_person_deployment_id => p_rec.person_deployment_id
4024 ,p_object_version_number => p_rec.object_version_number
4025 );
4026 --
4027 if g_debug then
4028 hr_utility.set_location(l_proc, 40);
4029 end if;
4030 --
4031 hr_pdt_bus.chk_deployment_reason
4032 (p_deployment_reason => p_rec.deployment_reason
4033 ,p_start_date => p_rec.start_date
4034 ,p_person_deployment_id => p_rec.person_deployment_id
4035 ,p_object_version_number => p_rec.object_version_number
4036 );
4037 --
4038 if g_debug then
4039 hr_utility.set_location(l_proc, 45);
4040 end if;
4041 --
4042 hr_pdt_bus.chk_employee_number
4043 (p_employee_number => p_rec.employee_number
4044 ,p_to_business_group_id => p_rec.to_business_group_id
4045 ,p_to_person_id => p_rec.to_person_id
4046 ,p_person_deployment_id => p_rec.person_deployment_id
4047 ,p_object_version_number => p_rec.object_version_number
4048 );
4049 --
4050 if g_debug then
4051 hr_utility.set_location(l_proc,50 );
4052 end if;
4053 --
4054 hr_pdt_bus.chk_leaving_reason
4055 (p_leaving_reason => p_rec.leaving_reason
4056 ,p_start_date => p_rec.start_date
4057 ,p_permanent => p_rec.permanent
4058 ,p_person_deployment_id => p_rec.person_deployment_id
4059 ,p_object_version_number => p_rec.object_version_number
4060 );
4061 --
4062 if g_debug then
4063 hr_utility.set_location(l_proc, 55);
4064 end if;
4065 --
4066 hr_pdt_bus.chk_leaving_person_type_id
4067 (p_leaving_person_type_id => p_rec.leaving_person_type_id
4068 ,p_to_business_group_id => p_rec.to_business_group_id
4069 ,p_permanent => p_rec.permanent
4070 ,p_person_deployment_id => p_rec.person_deployment_id
4071 ,p_object_version_number => p_rec.object_version_number
4072 );
4073 --
4074 if g_debug then
4075 hr_utility.set_location(l_proc, 60);
4076 end if;
4077 --
4078 hr_pdt_bus.chk_status
4079 (p_status => p_rec.status
4080 ,p_start_date => p_rec.start_date
4081 ,p_person_deployment_id => p_rec.person_deployment_id
4082 ,p_object_version_number => p_rec.object_version_number
4083 );
4084 --
4085 if g_debug then
4086 hr_utility.set_location(l_proc,65 );
4087 end if;
4088 --
4089 hr_pdt_bus.chk_deplymt_policy_id
4090 (p_deplymt_policy_id => p_rec.deplymt_policy_id
4091 );
4092 --
4093 if g_debug then
4094 hr_utility.set_location(l_proc, 70);
4095 end if;
4096 --
4097 hr_pdt_bus.chk_retain_direct_reports
4098 (p_retain_direct_reports => p_rec.retain_direct_reports
4099 ,p_from_person_id => p_rec.from_person_id
4100 ,p_start_date => p_rec.start_date
4101 ,p_to_business_group_id => p_rec.to_business_group_id
4102 ,p_from_business_group_id => p_rec.from_business_group_id
4103 ,p_person_deployment_id => p_rec.person_deployment_id
4104 ,p_object_version_number => p_rec.object_version_number
4105 );
4106 --
4107 if g_debug then
4108 hr_utility.set_location(l_proc, 75);
4109 end if;
4110 --
4111 hr_pdt_bus.chk_organization_id
4112 (p_organization_id => p_rec.organization_id
4113 ,p_to_business_group_id => p_rec.to_business_group_id
4114 ,p_person_deployment_id => p_rec.person_deployment_id
4115 ,p_object_version_number => p_rec.object_version_number
4116 );
4117 --
4118 if g_debug then
4119 hr_utility.set_location(l_proc, 80);
4120 end if;
4121 --
4122 hr_pdt_bus.chk_location_id
4123 (p_location_id => p_rec.location_id
4124 ,p_start_date => p_rec.start_date
4125 ,p_to_business_group_id => p_rec.to_business_group_id
4126 ,p_person_deployment_id => p_rec.person_deployment_id
4127 ,p_object_version_number => p_rec.object_version_number
4128 );
4129 --
4130 if g_debug then
4131 hr_utility.set_location(l_proc, 85);
4132 end if;
4133 --
4134 hr_pdt_bus.chk_job_id
4135 (p_job_id => p_rec.job_id
4136 ,p_start_date => p_rec.start_date
4137 ,p_to_business_group_id => p_rec.to_business_group_id
4138 ,p_person_deployment_id => p_rec.person_deployment_id
4139 ,p_object_version_number => p_rec.object_version_number
4140 );
4141 --
4142 if g_debug then
4143 hr_utility.set_location(l_proc,90 );
4144 end if;
4145 --
4146 hr_pdt_bus.chk_position_id
4147 (p_position_id => p_rec.position_id
4148 ,p_start_date => p_rec.start_date
4149 ,p_to_business_group_id => p_rec.to_business_group_id
4150 ,p_person_deployment_id => p_rec.person_deployment_id
4151 ,p_object_version_number => p_rec.object_version_number
4152 );
4153 --
4154 if g_debug then
4155 hr_utility.set_location(l_proc, 95);
4156 end if;
4157 --
4158 hr_pdt_bus.chk_grade_id
4159 (p_grade_id => p_rec.grade_id
4160 ,p_start_date => p_rec.start_date
4161 ,p_to_business_group_id => p_rec.to_business_group_id
4162 ,p_person_deployment_id => p_rec.person_deployment_id
4163 ,p_object_version_number => p_rec.object_version_number
4164 );
4165 --
4166 if g_debug then
4167 hr_utility.set_location(l_proc, 100);
4168 end if;
4169 --
4170 hr_pdt_bus.chk_position_id_job_id
4171 (p_position_id => p_rec.position_id
4172 ,p_job_id => p_rec.job_id
4173 ,p_start_date => p_rec.start_date
4174 ,p_person_deployment_id => p_rec.person_deployment_id
4175 ,p_object_version_number => p_rec.object_version_number
4176 );
4177 --
4178 if g_debug then
4179 hr_utility.set_location(l_proc, 105);
4180 end if;
4181 --
4182 hr_pdt_bus.chk_position_id_grade_id
4183 (p_position_id => p_rec.position_id
4184 ,p_grade_id => p_rec.grade_id
4185 ,p_start_date => p_rec.start_date
4186 ,p_person_deployment_id => p_rec.person_deployment_id
4187 ,p_object_version_number => p_rec.object_version_number
4188 ,p_inv_pos_grade_warning => l_inv_pos_grade_warning
4189 );
4190 --
4191 if g_debug then
4192 hr_utility.set_location(l_proc, 110);
4193 end if;
4194 --
4195 hr_pdt_bus.chk_job_id_grade_id
4196 (p_job_id => p_rec.job_id
4197 ,p_grade_id => p_rec.grade_id
4198 ,p_start_date => p_rec.start_date
4199 ,p_person_deployment_id => p_rec.person_deployment_id
4200 ,p_object_version_number => p_rec.object_version_number
4201 ,p_inv_job_grade_warning => l_inv_job_grade_warning
4202 );
4203 --
4204 if g_debug then
4205 hr_utility.set_location(l_proc, 115);
4206 end if;
4207 --
4208 hr_pdt_bus.chk_position_id_org_id
4209 (p_position_id => p_rec.position_id
4210 ,p_organization_id => p_rec.organization_id
4211 ,p_start_date => p_rec.start_date
4212 ,p_person_deployment_id => p_rec.person_deployment_id
4213 ,p_object_version_number => p_rec.object_version_number
4214 );
4215 --
4216 if g_debug then
4217 hr_utility.set_location(l_proc, 120);
4218 end if;
4219 --
4220 hr_pdt_bus.chk_payroll_id
4221 (p_payroll_id => p_rec.payroll_id
4222 ,p_start_date => p_rec.start_date
4223 ,p_to_business_group_id => p_rec.to_business_group_id
4224 ,p_person_deployment_id => p_rec.person_deployment_id
4225 ,p_object_version_number => p_rec.object_version_number
4226 );
4227 --
4228 if g_debug then
4229 hr_utility.set_location(l_proc, 125);
4230 end if;
4231 --
4232 hr_pdt_bus.chk_assignment_status_type_id
4233 (p_assignment_status_type_id => p_rec.assignment_status_type_id
4234 ,p_to_business_group_id => p_rec.to_business_group_id
4235 ,p_person_deployment_id => p_rec.person_deployment_id
4236 ,p_object_version_number => p_rec.object_version_number
4237 );
4238 --
4239 if g_debug then
4240 hr_utility.set_location(l_proc, 130);
4241 end if;
4242 --
4243 hr_pdt_bus.chk_supervisor_id
4244 (p_supervisor_id => p_rec.supervisor_id
4245 ,p_start_date => p_rec.start_date
4246 ,p_from_person_id => p_rec.from_person_id
4247 ,p_to_person_id => p_rec.to_person_id
4248 ,p_to_business_group_id => p_rec.to_business_group_id
4249 ,p_person_deployment_id => p_rec.person_deployment_id
4250 ,p_object_version_number => p_rec.object_version_number
4251 );
4252 --
4253 if g_debug then
4254 hr_utility.set_location(l_proc, 140);
4255 end if;
4256 --
4257 hr_pdt_bus.chk_supervisor_assignment_id
4258 (p_supervisor_assignment_id => p_rec.supervisor_assignment_id
4259 ,p_supervisor_id => p_rec.supervisor_id
4260 ,p_start_date => p_rec.start_date
4261 ,p_person_deployment_id => p_rec.person_deployment_id
4262 ,p_object_version_number => p_rec.object_version_number
4263 );
4264 --
4265 if g_debug then
4266 hr_utility.set_location(l_proc, 145);
4267 end if;
4268 --
4269 hr_pdt_bus.chk_pay_basis_id
4270 (p_pay_basis_id => p_rec.pay_basis_id
4271 ,p_to_business_group_id => p_rec.to_business_group_id
4272 ,p_person_deployment_id => p_rec.person_deployment_id
4273 ,p_object_version_number => p_rec.object_version_number
4274 );
4275 --
4276 if g_debug then
4277 hr_utility.set_location(l_proc, 150);
4278 end if;
4279 --
4280 hr_pdt_bus.chk_people_group_id
4281 (p_people_group_id => p_rec.people_group_id
4282 ,p_start_date => p_rec.start_date
4283 ,p_to_business_group_id => p_rec.to_business_group_id
4284 ,p_person_deployment_id => p_rec.person_deployment_id
4285 ,p_object_version_number => p_rec.object_version_number
4286 );
4287 --
4288 if g_debug then
4289 hr_utility.set_location(l_proc, 155);
4290 end if;
4291 --
4292 hr_pdt_bus.chk_soft_coding_keyflex_id
4293 (p_soft_coding_keyflex_id => p_rec.soft_coding_keyflex_id
4294 ,p_start_date => p_rec.start_date
4295 ,p_to_business_group_id => p_rec.to_business_group_id
4296 ,p_payroll_id => p_rec.payroll_id
4297 ,p_person_deployment_id => p_rec.person_deployment_id
4298 ,p_object_version_number => p_rec.object_version_number
4299 );
4300 --
4301 if g_debug then
4302 hr_utility.set_location(l_proc, 160);
4303 end if;
4304 --
4305 hr_pdt_bus.chk_assignment_category
4306 (p_assignment_category => p_rec.assignment_category
4307 ,p_start_date => p_rec.start_date
4308 ,p_person_deployment_id => p_rec.person_deployment_id
4309 ,p_object_version_number => p_rec.object_version_number
4310 );
4311 --
4312 hr_pdt_bus.chk_ddf(p_rec);
4313 --
4314 hr_utility.set_location(' Leaving:'||l_proc, 10);
4315 End insert_validate;
4316 --
4317 -- ----------------------------------------------------------------------------
4318 -- |---------------------------< update_validate >----------------------------|
4319 -- ----------------------------------------------------------------------------
4320 Procedure update_validate
4321 (p_rec in out nocopy hr_pdt_shd.g_rec_type
4322 ) is
4323 --
4324 l_proc varchar2(72) := g_package||'update_validate';
4325 l_inv_pos_grade_warning boolean;
4326 l_inv_job_grade_warning boolean;
4327 --
4328 Begin
4329 hr_utility.set_location('Entering:'||l_proc, 5);
4330 --
4331 -- Call all supporting business operations
4332 --
4333 --
4334 -- Set security Group context based on the TO_BUSINESS_GROUP_ID since the data
4335 -- in this table is being held specifically to be copied to an assignment there
4336 --
4337 hr_oru_bus.set_security_group_id(p_rec.to_business_group_id);
4338 --
4339 -- Validate Dependent Attributes
4340 --
4341 chk_non_updateable_args
4342 (p_rec => p_rec
4343 );
4344 --
4345 if g_debug then
4346 hr_utility.set_location(l_proc, 20);
4347 end if;
4348 --
4349 hr_pdt_bus.chk_to_person_id
4350 (p_person_deployment_id => p_rec.person_deployment_id
4351 ,p_object_version_number => p_rec.object_version_number
4352 ,p_to_person_id => p_rec.to_person_id
4353 ,p_to_business_group_id => p_rec.to_business_group_id
4354 ,p_start_date => p_rec.start_date
4355 ,p_status => p_rec.status
4356 );
4357 --
4358 if g_debug then
4359 hr_utility.set_location(l_proc, 25);
4360 end if;
4361 --
4362 hr_pdt_bus.chk_person_type_id
4363 (p_person_type_id => p_rec.person_type_id
4364 ,p_to_business_group_id => p_rec.to_business_group_id
4365 ,p_person_deployment_id => p_rec.person_deployment_id
4366 ,p_object_version_number => p_rec.object_version_number
4367 );
4368 --
4369 if g_debug then
4370 hr_utility.set_location(l_proc,30 );
4371 end if;
4372 --
4373 hr_pdt_bus.chk_start_end_date
4374 (p_start_date => p_rec.start_date
4375 ,p_end_date => p_rec.end_date
4376 ,p_person_deployment_id => p_rec.person_deployment_id
4377 ,p_object_version_number => p_rec.object_version_number
4378 ,p_status => p_rec.status
4379 );
4380 --
4381 if g_debug then
4382 hr_utility.set_location(l_proc, 35);
4383 end if;
4384 --
4385 hr_pdt_bus.chk_deployment_reason
4386 (p_deployment_reason => p_rec.deployment_reason
4387 ,p_start_date => p_rec.start_date
4388 ,p_person_deployment_id => p_rec.person_deployment_id
4389 ,p_object_version_number => p_rec.object_version_number
4390 );
4391 --
4392 if g_debug then
4393 hr_utility.set_location(l_proc, 45);
4394 end if;
4395 --
4396 hr_pdt_bus.chk_employee_number
4397 (p_employee_number => p_rec.employee_number
4398 ,p_to_business_group_id => p_rec.to_business_group_id
4399 ,p_to_person_id => p_rec.to_person_id
4400 ,p_person_deployment_id => p_rec.person_deployment_id
4401 ,p_object_version_number => p_rec.object_version_number
4402 );
4403 --
4404 if g_debug then
4405 hr_utility.set_location(l_proc,50 );
4406 end if;
4407 --
4408 hr_pdt_bus.chk_leaving_reason
4409 (p_leaving_reason => p_rec.leaving_reason
4410 ,p_start_date => p_rec.start_date
4411 ,p_permanent => p_rec.permanent
4412 ,p_person_deployment_id => p_rec.person_deployment_id
4413 ,p_object_version_number => p_rec.object_version_number
4414 );
4415 --
4416 if g_debug then
4417 hr_utility.set_location(l_proc, 55);
4418 end if;
4419 --
4420 hr_pdt_bus.chk_leaving_person_type_id
4421 (p_leaving_person_type_id => p_rec.leaving_person_type_id
4422 ,p_to_business_group_id => p_rec.to_business_group_id
4423 ,p_permanent => p_rec.permanent
4424 ,p_person_deployment_id => p_rec.person_deployment_id
4425 ,p_object_version_number => p_rec.object_version_number
4426 );
4427 --
4428 if g_debug then
4429 hr_utility.set_location(l_proc, 60);
4430 end if;
4431 --
4432 hr_pdt_bus.chk_status
4433 (p_status => p_rec.status
4434 ,p_start_date => p_rec.start_date
4435 ,p_person_deployment_id => p_rec.person_deployment_id
4436 ,p_object_version_number => p_rec.object_version_number
4437 );
4438 --
4439 if g_debug then
4440 hr_utility.set_location(l_proc,65 );
4441 end if;
4442 --
4443 hr_pdt_bus.chk_deplymt_policy_id
4444 (p_deplymt_policy_id => p_rec.deplymt_policy_id
4445 );
4446 --
4447 if g_debug then
4448 hr_utility.set_location(l_proc, 70);
4449 end if;
4450 --
4451 hr_pdt_bus.chk_retain_direct_reports
4452 (p_retain_direct_reports => p_rec.retain_direct_reports
4453 ,p_from_person_id => p_rec.from_person_id
4454 ,p_start_date => p_rec.start_date
4455 ,p_to_business_group_id => p_rec.to_business_group_id
4456 ,p_from_business_group_id => p_rec.from_business_group_id
4457 ,p_person_deployment_id => p_rec.person_deployment_id
4458 ,p_object_version_number => p_rec.object_version_number
4459 );
4460 --
4461 if g_debug then
4462 hr_utility.set_location(l_proc, 75);
4463 end if;
4464 --
4465 hr_pdt_bus.chk_organization_id
4466 (p_organization_id => p_rec.organization_id
4467 ,p_to_business_group_id => p_rec.to_business_group_id
4468 ,p_person_deployment_id => p_rec.person_deployment_id
4469 ,p_object_version_number => p_rec.object_version_number
4470 );
4471 --
4472 if g_debug then
4473 hr_utility.set_location(l_proc, 80);
4474 end if;
4475 --
4476 hr_pdt_bus.chk_location_id
4477 (p_location_id => p_rec.location_id
4478 ,p_start_date => p_rec.start_date
4479 ,p_to_business_group_id => p_rec.to_business_group_id
4480 ,p_person_deployment_id => p_rec.person_deployment_id
4481 ,p_object_version_number => p_rec.object_version_number
4482 );
4483 --
4484 if g_debug then
4485 hr_utility.set_location(l_proc, 85);
4486 end if;
4487 --
4488 hr_pdt_bus.chk_job_id
4489 (p_job_id => p_rec.job_id
4490 ,p_start_date => p_rec.start_date
4491 ,p_to_business_group_id => p_rec.to_business_group_id
4492 ,p_person_deployment_id => p_rec.person_deployment_id
4493 ,p_object_version_number => p_rec.object_version_number
4494 );
4495 --
4496 if g_debug then
4497 hr_utility.set_location(l_proc,90 );
4498 end if;
4499 --
4500 hr_pdt_bus.chk_position_id
4501 (p_position_id => p_rec.position_id
4502 ,p_start_date => p_rec.start_date
4503 ,p_to_business_group_id => p_rec.to_business_group_id
4504 ,p_person_deployment_id => p_rec.person_deployment_id
4505 ,p_object_version_number => p_rec.object_version_number
4506 );
4507 --
4508 if g_debug then
4509 hr_utility.set_location(l_proc, 95);
4510 end if;
4511 --
4512 hr_pdt_bus.chk_grade_id
4513 (p_grade_id => p_rec.grade_id
4514 ,p_start_date => p_rec.start_date
4515 ,p_to_business_group_id => p_rec.to_business_group_id
4516 ,p_person_deployment_id => p_rec.person_deployment_id
4517 ,p_object_version_number => p_rec.object_version_number
4518 );
4519 --
4520 if g_debug then
4521 hr_utility.set_location(l_proc, 100);
4522 end if;
4523 --
4524 hr_pdt_bus.chk_position_id_job_id
4525 (p_position_id => p_rec.position_id
4526 ,p_job_id => p_rec.job_id
4527 ,p_start_date => p_rec.start_date
4528 ,p_person_deployment_id => p_rec.person_deployment_id
4529 ,p_object_version_number => p_rec.object_version_number
4530 );
4531 --
4532 if g_debug then
4533 hr_utility.set_location(l_proc, 105);
4534 end if;
4535 --
4536 hr_pdt_bus.chk_position_id_grade_id
4537 (p_position_id => p_rec.position_id
4538 ,p_grade_id => p_rec.grade_id
4539 ,p_start_date => p_rec.start_date
4540 ,p_person_deployment_id => p_rec.person_deployment_id
4541 ,p_object_version_number => p_rec.object_version_number
4542 ,p_inv_pos_grade_warning => l_inv_pos_grade_warning
4543 );
4544 --
4545 if g_debug then
4546 hr_utility.set_location(l_proc, 110);
4547 end if;
4548 --
4549 hr_pdt_bus.chk_job_id_grade_id
4550 (p_job_id => p_rec.job_id
4551 ,p_grade_id => p_rec.grade_id
4552 ,p_start_date => p_rec.start_date
4553 ,p_person_deployment_id => p_rec.person_deployment_id
4554 ,p_object_version_number => p_rec.object_version_number
4555 ,p_inv_job_grade_warning => l_inv_job_grade_warning
4556 );
4557 --
4558 if g_debug then
4559 hr_utility.set_location(l_proc, 115);
4560 end if;
4561 --
4562 hr_pdt_bus.chk_position_id_org_id
4563 (p_position_id => p_rec.position_id
4564 ,p_organization_id => p_rec.organization_id
4565 ,p_start_date => p_rec.start_date
4566 ,p_person_deployment_id => p_rec.person_deployment_id
4567 ,p_object_version_number => p_rec.object_version_number
4568 );
4569 --
4570 if g_debug then
4571 hr_utility.set_location(l_proc, 120);
4572 end if;
4573 --
4574 hr_pdt_bus.chk_payroll_id
4575 (p_payroll_id => p_rec.payroll_id
4576 ,p_start_date => p_rec.start_date
4577 ,p_to_business_group_id => p_rec.to_business_group_id
4578 ,p_person_deployment_id => p_rec.person_deployment_id
4579 ,p_object_version_number => p_rec.object_version_number
4580 );
4581 --
4582 if g_debug then
4583 hr_utility.set_location(l_proc, 125);
4584 end if;
4585 --
4586 hr_pdt_bus.chk_assignment_status_type_id
4587 (p_assignment_status_type_id => p_rec.assignment_status_type_id
4588 ,p_to_business_group_id => p_rec.to_business_group_id
4589 ,p_person_deployment_id => p_rec.person_deployment_id
4590 ,p_object_version_number => p_rec.object_version_number
4591 );
4592 --
4593 if g_debug then
4594 hr_utility.set_location(l_proc, 130);
4595 end if;
4596 --
4597 hr_pdt_bus.chk_supervisor_id
4598 (p_supervisor_id => p_rec.supervisor_id
4599 ,p_start_date => p_rec.start_date
4600 ,p_from_person_id => p_rec.from_person_id
4601 ,p_to_person_id => p_rec.to_person_id
4602 ,p_to_business_group_id => p_rec.to_business_group_id
4603 ,p_person_deployment_id => p_rec.person_deployment_id
4604 ,p_object_version_number => p_rec.object_version_number
4605 );
4606 --
4607 if g_debug then
4608 hr_utility.set_location(l_proc, 140);
4609 end if;
4610 --
4611 hr_pdt_bus.chk_supervisor_assignment_id
4612 (p_supervisor_assignment_id => p_rec.supervisor_assignment_id
4613 ,p_supervisor_id => p_rec.supervisor_id
4614 ,p_start_date => p_rec.start_date
4615 ,p_person_deployment_id => p_rec.person_deployment_id
4616 ,p_object_version_number => p_rec.object_version_number
4617 );
4618 --
4619 if g_debug then
4620 hr_utility.set_location(l_proc, 145);
4621 end if;
4622 --
4623 hr_pdt_bus.chk_pay_basis_id
4624 (p_pay_basis_id => p_rec.pay_basis_id
4625 ,p_to_business_group_id => p_rec.to_business_group_id
4626 ,p_person_deployment_id => p_rec.person_deployment_id
4627 ,p_object_version_number => p_rec.object_version_number
4628 );
4629 --
4630 if g_debug then
4631 hr_utility.set_location(l_proc, 150);
4632 end if;
4633 --
4634 hr_pdt_bus.chk_people_group_id
4635 (p_people_group_id => p_rec.people_group_id
4636 ,p_start_date => p_rec.start_date
4637 ,p_to_business_group_id => p_rec.to_business_group_id
4638 ,p_person_deployment_id => p_rec.person_deployment_id
4639 ,p_object_version_number => p_rec.object_version_number
4640 );
4641 --
4642 if g_debug then
4643 hr_utility.set_location(l_proc, 155);
4644 end if;
4645 --
4646 hr_pdt_bus.chk_soft_coding_keyflex_id
4647 (p_soft_coding_keyflex_id => p_rec.soft_coding_keyflex_id
4648 ,p_start_date => p_rec.start_date
4649 ,p_to_business_group_id => p_rec.to_business_group_id
4650 ,p_payroll_id => p_rec.payroll_id
4651 ,p_person_deployment_id => p_rec.person_deployment_id
4652 ,p_object_version_number => p_rec.object_version_number
4653 );
4654 --
4655 if g_debug then
4656 hr_utility.set_location(l_proc, 160);
4657 end if;
4658 --
4659 hr_pdt_bus.chk_assignment_category
4660 (p_assignment_category => p_rec.assignment_category
4661 ,p_start_date => p_rec.start_date
4662 ,p_person_deployment_id => p_rec.person_deployment_id
4663 ,p_object_version_number => p_rec.object_version_number
4664 );
4665 --
4666 hr_pdt_bus.chk_ddf(p_rec);
4667 --
4668 hr_utility.set_location(' Leaving:'||l_proc, 10);
4669 End update_validate;
4670 --
4671 -- ----------------------------------------------------------------------------
4672 -- |---------------------------< delete_validate >----------------------------|
4673 -- ----------------------------------------------------------------------------
4674 Procedure delete_validate
4675 (p_rec in hr_pdt_shd.g_rec_type
4676 ) is
4677 --
4678 l_proc varchar2(72) := g_package||'delete_validate';
4679 --
4680 Begin
4681 hr_utility.set_location('Entering:'||l_proc, 5);
4682 --
4683 -- Call all supporting business operations
4684 --
4685 hr_utility.set_location(' Leaving:'||l_proc, 10);
4686 End delete_validate;
4687 --
4688 end hr_pdt_bus;