1 Package Body psp_poa_bus as
2 /* $Header: PSPOARHB.pls 120.5 2006/09/05 11:10:12 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' psp_poa_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_organization_account_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_organization_account_id in number
22 ,p_associated_column1 in varchar2 default null
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 , psp_organization_accounts poa
32 where poa.organization_account_id = p_organization_account_id
33 and pbg.business_group_id = poa.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 => 'organization_account_id'
50 ,p_argument_value => p_organization_account_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 hr_multi_message.add
65 (p_associated_column1
66 => nvl(p_associated_column1,'ORGANIZATION_ACCOUNT_ID')
67 );
68 --
69 else
70 close csr_sec_grp;
71 --
72 -- Set the security_group_id in CLIENT_INFO
73 --
74 hr_api.set_security_group_id
75 (p_security_group_id => l_security_group_id
76 );
77 --
78 -- Set the sessions legislation context in HR_SESSION_DATA
79 --
80 hr_api.set_legislation_context(l_legislation_code);
81 end if;
82 --
83 hr_utility.set_location(' Leaving:'|| l_proc, 20);
84 --
85 end set_security_group_id;
86 --
87 -- ---------------------------------------------------------------------------
88 -- |---------------------< return_legislation_code >-------------------------|
89 -- ---------------------------------------------------------------------------
90 --
91 Function return_legislation_code
92 (p_organization_account_id in number
93 )
94 Return Varchar2 Is
95 --
96 -- Declare cursor
97 --
98 cursor csr_leg_code is
99 select pbg.legislation_code
100 from per_business_groups_perf pbg
101 , psp_organization_accounts poa
102 where poa.organization_account_id = p_organization_account_id
103 and pbg.business_group_id = poa.business_group_id;
104 --
105 -- Declare local variables
106 --
107 l_legislation_code varchar2(150);
108 l_proc varchar2(72) := g_package||'return_legislation_code';
109 --
110 Begin
111 --
112 hr_utility.set_location('Entering:'|| l_proc, 10);
113 --
114 -- Ensure that all the mandatory parameter are not null
115 --
116 hr_api.mandatory_arg_error
117 (p_api_name => l_proc
118 ,p_argument => 'organization_account_id'
119 ,p_argument_value => p_organization_account_id
120 );
121 --
122 if ( nvl(psp_poa_bus.g_organization_account_id, hr_api.g_number)
123 = p_organization_account_id) then
124 --
125 -- The legislation code has already been found with a previous
126 -- call to this function. Just return the value in the global
127 -- variable.
128 --
129 l_legislation_code := psp_poa_bus.g_legislation_code;
130 hr_utility.set_location(l_proc, 20);
131 else
132 --
133 -- The ID is different to the last call to this function
134 -- or this is the first call to this function.
135 --
136 open csr_leg_code;
137 fetch csr_leg_code into l_legislation_code;
138 --
139 if csr_leg_code%notfound then
140 --
141 -- The primary key is invalid therefore we must error
142 --
143 close csr_leg_code;
144 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
145 fnd_message.raise_error;
146 end if;
147 hr_utility.set_location(l_proc,30);
148 --
149 -- Set the global variables so the values are
150 -- available for the next call to this function.
151 --
152 close csr_leg_code;
153 psp_poa_bus.g_organization_account_id := p_organization_account_id;
154 psp_poa_bus.g_legislation_code := l_legislation_code;
155 end if;
156 hr_utility.set_location(' Leaving:'|| l_proc, 40);
157 return l_legislation_code;
158 end return_legislation_code;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |------------------------------< chk_df >----------------------------------|
162 -- ----------------------------------------------------------------------------
163 --
164 -- Description:
165 -- Validates all the Descriptive Flexfield values.
166 --
167 -- Prerequisites:
168 -- All other columns have been validated. Must be called as the
169 -- last step from insert_validate and update_validate.
170 --
171 -- In Arguments:
172 -- p_rec
173 --
174 -- Post Success:
175 -- If the Descriptive Flexfield structure column and data values are
176 -- all valid this procedure will end normally and processing will
177 -- continue.
178 --
179 -- Post Failure:
180 -- If the Descriptive Flexfield structure column value or any of
181 -- the data values are invalid then an application error is raised as
182 -- a PL/SQL exception.
183 --
184 -- Access Status:
185 -- Internal Row Handler Use Only.
186 --
187 -- ----------------------------------------------------------------------------
188 procedure chk_df
189 (p_rec in psp_poa_shd.g_rec_type
190 ) is
191 --
192 l_proc varchar2(72) := g_package || 'chk_df';
193
194 --
195 begin
196 hr_utility.set_location('Entering:'||l_proc,10);
197 --
198 if ((p_rec.organization_account_id is not null) and (
199 nvl(psp_poa_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
200 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
201 nvl(psp_poa_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
202 nvl(p_rec.attribute1, hr_api.g_varchar2) or
203 nvl(psp_poa_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
204 nvl(p_rec.attribute2, hr_api.g_varchar2) or
205 nvl(psp_poa_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
206 nvl(p_rec.attribute3, hr_api.g_varchar2) or
207 nvl(psp_poa_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
208 nvl(p_rec.attribute4, hr_api.g_varchar2) or
209 nvl(psp_poa_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
210 nvl(p_rec.attribute5, hr_api.g_varchar2) or
211 nvl(psp_poa_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
212 nvl(p_rec.attribute6, hr_api.g_varchar2) or
213 nvl(psp_poa_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
214 nvl(p_rec.attribute7, hr_api.g_varchar2) or
215 nvl(psp_poa_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
216 nvl(p_rec.attribute8, hr_api.g_varchar2) or
217 nvl(psp_poa_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
218 nvl(p_rec.attribute9, hr_api.g_varchar2) or
219 nvl(psp_poa_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
220 nvl(p_rec.attribute10, hr_api.g_varchar2) or
221 nvl(psp_poa_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
222 nvl(p_rec.attribute11, hr_api.g_varchar2) or
223 nvl(psp_poa_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
224 nvl(p_rec.attribute12, hr_api.g_varchar2) or
225 nvl(psp_poa_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
226 nvl(p_rec.attribute13, hr_api.g_varchar2) or
227 nvl(psp_poa_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
228 nvl(p_rec.attribute14, hr_api.g_varchar2) or
229 nvl(psp_poa_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
230 nvl(p_rec.attribute15, hr_api.g_varchar2) ))
231 or (p_rec.organization_account_id is null) then
232 --
233 -- Only execute the validation if absolutely necessary:
234 -- a) During update, the structure column value or any
235 -- of the attribute values have actually changed.
236 -- b) During insert.
237 --
238
239 hr_dflex_utility.ins_or_upd_descflex_attribs
240 (p_appl_short_name => 'PSP'
241 ,p_descflex_name => 'Organization Accounts DF'
242 ,p_attribute_category => p_rec.attribute_category
243 ,p_attribute1_name => 'ATTRIBUTE1'
244 ,p_attribute1_value => p_rec.attribute1
245 ,p_attribute2_name => 'ATTRIBUTE2'
246 ,p_attribute2_value => p_rec.attribute2
247 ,p_attribute3_name => 'ATTRIBUTE3'
248 ,p_attribute3_value => p_rec.attribute3
249 ,p_attribute4_name => 'ATTRIBUTE4'
250 ,p_attribute4_value => p_rec.attribute4
251 ,p_attribute5_name => 'ATTRIBUTE5'
252 ,p_attribute5_value => p_rec.attribute5
253 ,p_attribute6_name => 'ATTRIBUTE6'
254 ,p_attribute6_value => p_rec.attribute6
255 ,p_attribute7_name => 'ATTRIBUTE7'
256 ,p_attribute7_value => p_rec.attribute7
257 ,p_attribute8_name => 'ATTRIBUTE8'
258 ,p_attribute8_value => p_rec.attribute8
259 ,p_attribute9_name => 'ATTRIBUTE9'
260 ,p_attribute9_value => p_rec.attribute9
261 ,p_attribute10_name => 'ATTRIBUTE10'
262 ,p_attribute10_value => p_rec.attribute10
263 ,p_attribute11_name => 'ATTRIBUTE11'
264 ,p_attribute11_value => p_rec.attribute11
265 ,p_attribute12_name => 'ATTRIBUTE12'
266 ,p_attribute12_value => p_rec.attribute12
267 ,p_attribute13_name => 'ATTRIBUTE13'
268 ,p_attribute13_value => p_rec.attribute13
269 ,p_attribute14_name => 'ATTRIBUTE14'
270 ,p_attribute14_value => p_rec.attribute14
271 ,p_attribute15_name => 'ATTRIBUTE15'
272 ,p_attribute15_value => p_rec.attribute15
273 );
274 end if;
275 --
276 hr_utility.set_location(' Leaving:'||l_proc,20);
277 end chk_df;
278 --
279 -- ----------------------------------------------------------------------------
280 -- |-----------------------< chk_non_updateable_args >------------------------|
281 -- ----------------------------------------------------------------------------
282 -- {Start Of Comments}
283 --
284 -- Description:
285 -- This procedure is used to ensure that non updateable attributes have
286 -- not been updated. If an attribute has been updated an error is generated.
287 --
288 -- Pre Conditions:
289 -- g_old_rec has been populated with details of the values currently in
290 -- the database.
291 --
292 -- In Arguments:
293 -- p_rec has been populated with the updated values the user would like the
294 -- record set to.
295 --
296 -- Post Success:
297 -- Processing continues if all the non updateable attributes have not
298 -- changed.
299 --
300 -- Post Failure:
301 -- An application error is raised if any of the non updatable attributes
302 -- have been altered.
303 --
304 -- {End Of Comments}
305 -- ----------------------------------------------------------------------------
306 Procedure chk_non_updateable_args
307 (p_rec in psp_poa_shd.g_rec_type
308 ) IS
309 --
310 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
311 --
312 Begin
313 --
314 -- Only proceed with the validation if a row exists for the current
315 -- record in the HR Schema.
316 --
317 IF NOT psp_poa_shd.api_updating
318 (p_organization_account_id => p_rec.organization_account_id
319 ,p_object_version_number => p_rec.object_version_number
320 ) THEN
321 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
322 fnd_message.set_token('PROCEDURE ', l_proc);
323 fnd_message.set_token('STEP ', '5');
324 fnd_message.raise_error;
325 END IF;
326 --
327 -- EDIT_HERE: Add checks to ensure non-updateable args have
328 -- not been updated.
329 --
330 End chk_non_updateable_args;
331
332
333 --
334 -- ----------------------------------------------------------------------------
335 -- |---------------------------< validate_dates >----------------------------|
336 -- ----------------------------------------------------------------------------
337
338 PROCEDURE validate_dates( p_organization_id in NUMBER
339 , p_account_type in VARCHAR2
340 , p_start_date_active in DATE
341 , p_end_date_active in DATE
342 , p_per_business_group_id in NUMBER
343 , p_gl_set_of_bks_id in NUMBER
344 , p_organization_account_id in NUMBER
345 , p_funding_source_code in VARCHAR2) IS
346 --When a record is being inserted or modified, check for the dates. The dates shouldn't overlap with the dates of
347 --previously entered accounts of this organization. If the start date is less than the start date of a previously
348 --entered account of this organization, end date must be entered else the period will overlap. Also, end date must be
349 --greater than the start date.
350
351 --Cursor date_selection_csr: Select the dates for the accounts(other than the current one) of this organization.
352
353 CURSOR date_selection_csr IS
354 SELECT start_date_active, end_date_active
355 FROM psp_organization_accounts
356 WHERE organization_id = p_organization_id
357 AND account_type_code = p_account_type
358 AND business_group_id = p_per_business_group_id
359 AND set_of_books_id = p_gl_set_of_bks_id
360 AND organization_account_id <> NVL(p_organization_account_id,-999)
361 AND funding_source_code = p_funding_source_code;
362
363 CURSOR organnization_name_csr IS
364 SELECT name
365 FROM hr_organization_units
366 WHERE business_group_id = p_per_business_group_id
367 AND organization_id = p_organization_id
368 AND trunc(sysdate) between date_from and nvl(date_to,trunc(sysdate));
369
370 l_start_date_active DATE;
371 l_end_date_active DATE;
372 l_char_date VARCHAR2(30);
373 l_organization_name VARCHAR2(240);
374 BEGIN
375 OPEN date_selection_csr;
376 LOOP
377 fetch date_selection_csr INTO l_start_date_active, l_end_date_active ;
378 EXIT WHEN date_selection_csr%NOTFOUND;
379 IF p_start_date_active BETWEEN l_start_date_active AND NVL(l_end_date_active, to_date('31/12/4712','DD/MM/RRRR')) THEN
380 IF l_end_date_active IS NULL THEN
381 fnd_message.set_name('PSP','PSP_NO_END_DATE');
382 l_char_date := fnd_message.get;
383 ELSE
384 l_char_date := TO_CHAR(l_end_date_active);
385 END IF;
386 OPEN organnization_name_csr;
387 FETCH organnization_name_csr INTO l_organization_name;
388 CLOSE organnization_name_csr;
389
390 fnd_message.set_name ('PSP', 'PSP_SC_BEGINDATE_OVERLAP_ACCT');
391 fnd_message.set_token('BEGIN_DATE', TO_CHAR(l_start_date_active));
392 fnd_message.set_token('END_DATE', l_char_date);
393 fnd_message.set_token('ORGANIZATION_NAME', l_organization_name);
394 fnd_message.raise_error;
395 END IF;
396 END LOOP;
397 CLOSE date_selection_csr;
398
399 IF p_end_date_active IS NULL THEN
400 OPEN date_selection_csr;
401 LOOP
402 fetch date_selection_csr INTO l_start_date_active, l_end_date_active ;
403 EXIT WHEN date_selection_csr%NOTFOUND;
404 IF p_start_date_active < l_start_date_active THEN
405 fnd_message.set_name('PSP', 'PSP_ENDDATE_MUST_ENTER');
406 fnd_message.raise_error;
407 END IF;
408 END LOOP;
409 CLOSE date_selection_csr;
410 END IF;
411
412 IF p_end_date_active < p_start_date_active THEN
413 fnd_message.set_name ('PSP', 'PSP_ED_GREATERTHAN_BD');
414 fnd_message.raise_error;
415 END IF;
416
417 OPEN date_selection_csr;
418 LOOP
419 fetch date_selection_csr INTO l_start_date_active, l_end_date_active ;
420 EXIT WHEN date_selection_csr%NOTFOUND ;
421 IF p_end_date_active BETWEEN l_start_date_active AND NVL(l_end_date_active, to_date('31/12/4712','DD/MM/RRRR')) THEN
422 IF l_end_date_active IS NULL THEN
423 fnd_message.set_name('PSP','PSP_NO_END_DATE');
424 l_char_date := fnd_message.get;
425 ELSE
426 l_char_date := TO_CHAR(l_end_date_active);
427 END IF;
428 OPEN organnization_name_csr;
429 FETCH organnization_name_csr INTO l_organization_name;
430 CLOSE organnization_name_csr;
431
432 fnd_message.set_name('PSP', 'PSP_SC_ENDDATE_OVERLAP_ACCT');
433 fnd_message.set_token('BEGIN_DATE', TO_CHAR(l_start_date_active));
434 fnd_message.set_token('END_DATE', l_char_date);
435 fnd_message.set_token('ORGANIZATION_NAME', l_organization_name);
436 fnd_message.raise_error;
437 ELSIF p_start_date_active < l_start_date_active AND p_end_date_active > NVL(l_end_date_active, to_date('31/12/4712','DD/MM/RRRR')) THEN
438 IF l_end_date_active IS NULL THEN
439 fnd_message.set_name('PSP','PSP_NO_END_DATE');
440 l_char_date := fnd_message.get;
441 ELSE
442 l_char_date := TO_CHAR(l_end_date_active);
443 END IF;
444 OPEN organnization_name_csr;
445 FETCH organnization_name_csr INTO l_organization_name;
446 CLOSE organnization_name_csr;
447
448 fnd_message.set_name('PSP', 'PSP_SC_ENDDATE_OVERLAP_ACCT');
449 fnd_message.set_token('BEGIN_DATE', TO_CHAR(l_start_date_active));
450 fnd_message.set_token('END_DATE', l_char_date);
451 fnd_message.set_token('ORGANIZATION_NAME',l_organization_name);
452 fnd_message.raise_error;
453 END IF;
454 END LOOP;
455 CLOSE date_selection_csr;
456 END validate_dates;
457
458
459 --
460 -- ----------------------------------------------------------------------------
461 -- |---------------------------< validate_ptaoe >----------------------------|
462 -- ----------------------------------------------------------------------------
463 --
464
465 PROCEDURE validate_ptaoe( p_project_id in NUMBER
466 , p_task_id in NUMBER
467 , p_award_id in NUMBER
468 , p_expenditure_organization_id in NUMBER
469 , p_start_date_active in DATE
470 , p_end_date_active in DATE) IS
471
472 --Give a warning if :
473 --Project is not active for schedule begin date or
474 --Task is not active for schedule begin date or
475 --Award is not linked to Project.
476 --Give an error if expenditure organization is not valid for the period selected.
477 l_proj_start_date date;
478 l_proj_end_date date;
479 l_task_start_date date;
480 l_task_end_date date;
481 l_count number;
482 l_exp_org_start_date date;
483 l_exp_org_end_date date;
484 l_gl_set_of_bks_id NUMBER;
485 l_business_group_id NUMBER;
486 l_operating_unit NUMBER;
487 l_pa_gms_install_options VARCHAR2(30);
488
489 CURSOR project_dates_csr IS
490 SELECT start_date, completion_date
491 FROM gms_projects_expend_v
492 WHERE project_id = p_project_id;
493
494 CURSOR task_dates_csr IS
495 SELECT start_date, completion_date
496 FROM pa_tasks_expend_v
497 WHERE task_id = p_task_id;
498
499 CURSOR award_linked_csr IS
500 SELECT count(*)
501 FROM gms_awards_basic_v
502 WHERE project_id = p_project_id
503 AND award_id = p_award_id;
504
505 CURSOR exp_org_dates_csr IS
506 SELECT date_from, date_to
507 FROM pa_all_organizations p,hr_all_organization_units h
508 WHERE p.organization_id = h.organization_id
509 AND p.pa_org_use_type = 'EXPENDITURES'
510 AND h.organization_id = p_expenditure_organization_id
511 AND h.business_group_id = l_business_group_id
512 -- AND nvl(p.org_id, -9999) = nvl(l_operating_unit, -9999)
513 AND ((mo_global.get_current_org_id is NULL and mo_global.check_access(p.org_id) = 'Y')
514 or ( mo_global.get_current_org_id is NOT NULL and p.org_id = mo_global.get_current_org_id ))
515 AND NVL(inactive_date,to_date('31/12/4712','DD/MM/RRRR')) > p_start_date_active;
516
517
518 BEGIN
519 psp_general.multiorg_client_info(
520 p_gl_set_of_bks_id => l_gl_set_of_bks_id,
521 p_business_group_id => l_business_group_id,
522 p_operating_unit => l_operating_unit,
523 p_pa_gms_install_options => l_pa_gms_install_options);
524
525 IF l_pa_gms_install_options in ('PA_GMS','PA_ONLY') THEN
526 IF p_project_id IS NOT NULL THEN
527 OPEN project_dates_csr;
528 FETCH project_dates_csr into l_proj_start_date, l_proj_end_date ;
529 CLOSE project_dates_csr;
530
531 IF (p_start_date_active NOT BETWEEN l_proj_start_date AND
532 NVL(l_proj_end_date, fnd_date.canonical_to_date('4712/12/31'))) OR
533 (NVL(p_end_date_active, fnd_date.canonical_to_date('4712/12/31')) NOT BETWEEN l_proj_start_date AND
534 NVL(l_proj_end_date, fnd_date.canonical_to_date('4712/12/31'))) THEN
535
536 fnd_message.set_name('PSP','PSP_PROJECT_NOT_ACTIVE');
537 fnd_message.raise_error;
538 END IF;
539
540 OPEN task_dates_csr;
541 FETCH task_dates_csr into l_task_start_date, l_task_end_date ;
542 CLOSE task_dates_csr;
543
544 IF p_task_id is not null AND
545 (p_start_date_active NOT BETWEEN l_task_start_date AND
546 NVL(l_task_end_date, fnd_date.canonical_to_date('4712/12/31'))) OR
547 (NVL(p_end_date_active, fnd_date.canonical_to_date('4712/12/31')) NOT BETWEEN l_task_start_date AND
548 NVL(l_task_end_date, fnd_date.canonical_to_date('4712/12/31'))) THEN
549
550 fnd_message.set_name('PSP','PSP_TASK_NOT_ACTIVE');
551 fnd_message.raise_error;
552 END IF;
553
554 IF l_pa_gms_install_options = 'PA_GMS' THEN
555 IF p_project_id is not null and p_award_id is not null then
556 OPEN award_linked_csr;
557 FETCH award_linked_csr INTO l_count;
558 CLOSE award_linked_csr;
559
560 IF l_count = 0 THEN
561 fnd_message.set_name('PSP','PSP_AWARD_NOT_LINKED');
562 fnd_message.raise_error;
563 END IF;
564
565 IF NOT PSP_GENERAL.AWARD_DATE_VALIDATION(
566 P_AWARD_ID,
567 p_start_date_active,
568 p_end_date_active)
569 THEN
570 fnd_message.set_name('PSP','PSP_AWARD_NOT_VALID');
571 fnd_message.raise_error;
572 END IF;
573 END IF;
574 END IF;
575 END IF;
576 END IF;
577
578 IF p_expenditure_organization_id IS NOT NULL THEN
579 OPEN exp_org_dates_csr;
580 FETCH exp_org_dates_csr into l_exp_org_start_date, l_exp_org_end_date;
581 CLOSE exp_org_dates_csr;
582
583 IF (p_start_date_active NOT BETWEEN l_exp_org_start_date AND
584 NVL(l_exp_org_end_date, to_date('31/12/4712', 'DD/MM/RRRR'))) OR
585 (p_end_date_active NOT BETWEEN l_exp_org_start_date AND
586 NVL(l_exp_org_end_date, to_date('31/12/4712', 'DD/MM/RRRR'))) then
587
588 fnd_message.set_name('PSP', 'PSP_EXP_ORG_INVALID');
589 fnd_message.raise_error;
590 END IF;
591 END IF;
592
593
594 exception when others then
595 fnd_message.raise_error;
596 END validate_ptaoe ;
597
598
599 --
600 -- ----------------------------------------------------------------------------
601 -- |---------------------------< insert_validate >----------------------------|
602 -- ----------------------------------------------------------------------------
603 Procedure insert_validate
604 (p_rec in psp_poa_shd.g_rec_type
605 ) is
606 --
607 l_proc varchar2(72) := g_package||'insert_validate';
608 --
609 Begin
610 hr_utility.set_location('Entering:'||l_proc, 5);
611 --
612 -- Call all supporting business operations
613 --
614 hr_api.validate_bus_grp_id
615 (p_business_group_id => p_rec.business_group_id
616 ,p_associated_column1 => psp_poa_shd.g_tab_nam
617 || '.BUSINESS_GROUP_ID');
618
619
620 validate_dates( p_organization_id => p_rec.organization_id
621 , p_account_type => p_rec.account_type_code
622 , p_start_date_active => p_rec.start_date_active
623 , p_end_date_active => p_rec.end_date_active
624 , p_per_business_group_id => p_rec.business_group_id
625 , p_gl_set_of_bks_id => p_rec.set_of_books_id
626 , p_organization_account_id => p_rec.organization_account_id
627 ,p_funding_source_code => p_rec.funding_source_code);
628
629 validate_ptaoe( p_project_id => p_rec.project_id
630 , p_task_id => p_rec.task_id
631 , p_award_id => p_rec.award_id
632 , p_expenditure_organization_id => p_rec.expenditure_organization_id
633 , p_start_date_active => p_rec.start_date_active
634 , p_end_date_active => p_rec.end_date_active);
635
636 --
637 -- After validating the set of important attributes,
638 -- if Multiple Message detection is enabled and at least
639 -- one error has been found then abort further validation.
640 --
641 hr_multi_message.end_validation_set;
642 --
643 -- Validate Dependent Attributes
644 --
645 --
646 psp_poa_bus.chk_df(p_rec);
647 --
648 hr_utility.set_location(' Leaving:'||l_proc, 10);
649 End insert_validate;
650 --
651 -- ----------------------------------------------------------------------------
652 -- |---------------------------< update_validate >----------------------------|
653 -- ----------------------------------------------------------------------------
654 Procedure update_validate
655 (p_rec in psp_poa_shd.g_rec_type
656 ) is
657 --
658 l_proc varchar2(72) := g_package||'update_validate';
659 --
660 Begin
661 hr_utility.set_location('Entering:'||l_proc, 5);
662 --
663 -- Call all supporting business operations
664 --
665 hr_api.validate_bus_grp_id
666 (p_business_group_id => p_rec.business_group_id
667 ,p_associated_column1 => psp_poa_shd.g_tab_nam
668 || '.BUSINESS_GROUP_ID');
669
670
671 validate_dates( p_organization_id => p_rec.organization_id
672 , p_account_type => p_rec.account_type_code
673 , p_start_date_active => p_rec.start_date_active
674 , p_end_date_active => p_rec.end_date_active
675 , p_per_business_group_id => p_rec.business_group_id
676 , p_gl_set_of_bks_id => p_rec.set_of_books_id
677 , p_organization_account_id => p_rec.organization_account_id
678 ,p_funding_source_code => p_rec.funding_source_code);
679
680 validate_ptaoe( p_project_id => p_rec.project_id
681 , p_task_id => p_rec.task_id
682 , p_award_id => p_rec.award_id
683 , p_expenditure_organization_id => p_rec.expenditure_organization_id
684 , p_start_date_active => p_rec.start_date_active
685 , p_end_date_active => p_rec.end_date_active);
686
687
688 --
689 -- After validating the set of important attributes,
690 -- if Multiple Message detection is enabled and at least
691 -- one error has been found then abort further validation.
692 --
693 hr_multi_message.end_validation_set;
694 --
695 -- Validate Dependent Attributes
696 --
697 chk_non_updateable_args
698 (p_rec => p_rec
699 );
700 --
701 --
702 psp_poa_bus.chk_df(p_rec);
703 --
704 hr_utility.set_location(' Leaving:'||l_proc, 10);
705 End update_validate;
706 --
707 -- ----------------------------------------------------------------------------
708 -- |---------------------------< delete_validate >----------------------------|
709 -- ----------------------------------------------------------------------------
710 Procedure delete_validate
711 (p_rec in psp_poa_shd.g_rec_type
712 ) is
713 --
714 l_proc varchar2(72) := g_package||'delete_validate';
715 --
716 Begin
717 hr_utility.set_location('Entering:'||l_proc, 5);
718 --
719 -- Call all supporting business operations
720 --
721 hr_utility.set_location(' Leaving:'||l_proc, 10);
722 End delete_validate;
723
724
725 end psp_poa_bus;