DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TPS_BUS

Source


1 PACKAGE BODY OTA_TPS_BUS AS
2 /* $Header: ottpsrhi.pkb 120.2 2005/12/14 15:17:58 asud noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tps_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_training_plan_id            number         DEFAULT NULL;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 PROCEDURE set_security_group_id
21   (p_training_plan_id            IN ota_training_plans.training_plan_id%TYPE
22   ,p_associated_column1          IN varchar2
23   ) IS
24   --
25   -- Declare cursor
26   --
27   CURSOR csr_sec_grp IS
28     SELECT inf.org_information14
29       FROM hr_organization_information inf
30          , ota_training_plans tps
31      WHERE tps.training_plan_id = p_training_plan_id
32        AND inf.organization_id  = tps.business_group_id
33        AND    inf.org_information_context || '' = 'Business Group Information';
34   --
35   -- Declare local variables
36   --
37   l_security_group_id number;
38   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
39   --
40 BEGIN
41   --
42   hr_utility.set_location('Entering:'|| l_proc, 10);
43   --
44   -- Ensure that all the mandatory parameter are not null
45   --
46   hr_api.mandatory_arg_error
47     (p_api_name           => l_proc
48     ,p_argument           => 'training_plan_id'
49     ,p_argument_value     => p_training_plan_id
50     );
51   --
52   OPEN csr_sec_grp;
53   FETCH csr_sec_grp INTO l_security_group_id;
54   --
55   IF csr_sec_grp%NOTFOUND THEN
56      --
57      CLOSE csr_sec_grp;
58      --
59      -- The primary key is invalid therefore we must error
60      --
61      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
62     -- fnd_message.raise_error;
63      -- MULTI MESSAGING
64      hr_multi_message.add
65                 (p_associated_column1 => NVL(p_associated_column1,'TRAINING_PLAN_ID'));
66      --
67      ELSE
68 
69 
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     END IF;
79   hr_utility.set_location(' Leaving:'|| l_proc, 20);
80   --
81 END set_security_group_id;
82 --
83 --  ---------------------------------------------------------------------------
84 --  |---------------------< return_legislation_code >-------------------------|
85 --  ---------------------------------------------------------------------------
86 --
87 FUNCTION return_legislation_code
88   (p_training_plan_id                     IN     number
89   )
90   RETURN Varchar2 IS
91   --
92   -- Declare cursor
93   --
94   CURSOR csr_leg_code IS
95     SELECT pbg.legislation_code
96       FROM per_business_groups pbg
97          , ota_training_plans tps
98      WHERE tps.training_plan_id = p_training_plan_id
99        AND pbg.business_group_id = tps.business_group_id;
100   --
101   -- Declare local variables
102   --
103   l_legislation_code  varchar2(150);
104   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
105   --
106 BEGIN
107   --
108   hr_utility.set_location('Entering:'|| l_proc, 10);
109   --
110   -- Ensure that all the mandatory parameter are not null
111   --
112   hr_api.mandatory_arg_error
113     (p_api_name           => l_proc
114     ,p_argument           => 'training_plan_id'
115     ,p_argument_value     => p_training_plan_id
116     );
117   --
118   IF ( NVL(ota_tps_bus.g_training_plan_id, hr_api.g_number)
119        = p_training_plan_id) THEN
120     --
121     -- The legislation code has already been found with a previous
122     -- call to this function. Just return the value in the global
123     -- variable.
124     --
125     l_legislation_code := ota_tps_bus.g_legislation_code;
126     hr_utility.set_location(l_proc, 20);
127   ELSE
128     --
129     -- The ID is different to the last call to this function
130     -- or this is the first call to this function.
131     --
132     OPEN csr_leg_code;
133     FETCH csr_leg_code INTO l_legislation_code;
134     --
135     IF csr_leg_code%NOTFOUND THEN
136       --
137       -- The primary key is invalid therefore we must error
138       --
139       CLOSE csr_leg_code;
140       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
141       fnd_message.raise_error;
142     END IF;
143     hr_utility.set_location(l_proc,30);
144     --
145     -- Set the global variables so the values are
146     -- available for the next call to this function.
147     --
148     CLOSE csr_leg_code;
149     ota_tps_bus.g_training_plan_id  := p_training_plan_id;
150     ota_tps_bus.g_legislation_code  := l_legislation_code;
151   END IF;
152   hr_utility.set_location(' Leaving:'|| l_proc, 40);
153   RETURN l_legislation_code;
154 END return_legislation_code;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< chk_df >----------------------------------|
158 -- ----------------------------------------------------------------------------
159 --
160 -- Description:
161 --   Validates all the Descriptive Flexfield values.
162 --
163 -- Prerequisites:
164 --   All other columns have been validated.  Must be called as the
165 --   last step from insert_validate and update_validate.
166 --
167 -- In Arguments:
168 --   p_rec
169 --
170 -- Post Success:
171 --   If the Descriptive Flexfield structure column and data values are
172 --   all valid this procedure will end normally and processing will
173 --   continue.
174 --
175 -- Post Failure:
176 --   If the Descriptive Flexfield structure column value or any of
177 --   the data values are invalid then an application error is raised as
178 --   a PL/SQL exception.
179 --
180 -- Access Status:
181 --   Internal Row Handler Use Only.
182 --
183 -- ----------------------------------------------------------------------------
184 PROCEDURE chk_df
185   (p_rec IN ota_tps_shd.g_rec_type
186   ) IS
187 --
188   l_proc   varchar2(72) := g_package || 'chk_df';
189 --
190 BEGIN
191   hr_utility.set_location('Entering:'||l_proc,10);
192   --
193   IF ((p_rec.training_plan_id IS NOT NULL)  AND (
194     NVL(ota_tps_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
195     NVL(p_rec.attribute_category, hr_api.g_varchar2)  OR
196     NVL(ota_tps_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
197     NVL(p_rec.attribute1, hr_api.g_varchar2)  OR
198     NVL(ota_tps_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
199     NVL(p_rec.attribute2, hr_api.g_varchar2)  OR
200     NVL(ota_tps_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
201     NVL(p_rec.attribute3, hr_api.g_varchar2)  OR
202     NVL(ota_tps_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
203     NVL(p_rec.attribute4, hr_api.g_varchar2)  OR
204     NVL(ota_tps_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
205     NVL(p_rec.attribute5, hr_api.g_varchar2)  OR
206     NVL(ota_tps_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
207     NVL(p_rec.attribute6, hr_api.g_varchar2)  OR
208     NVL(ota_tps_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
209     NVL(p_rec.attribute7, hr_api.g_varchar2)  OR
210     NVL(ota_tps_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
211     NVL(p_rec.attribute8, hr_api.g_varchar2)  OR
212     NVL(ota_tps_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
213     NVL(p_rec.attribute9, hr_api.g_varchar2)  OR
214     NVL(ota_tps_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
215     NVL(p_rec.attribute10, hr_api.g_varchar2)  OR
216     NVL(ota_tps_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
217     NVL(p_rec.attribute11, hr_api.g_varchar2)  OR
218     NVL(ota_tps_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
219     NVL(p_rec.attribute12, hr_api.g_varchar2)  OR
220     NVL(ota_tps_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
221     NVL(p_rec.attribute13, hr_api.g_varchar2)  OR
222     NVL(ota_tps_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
223     NVL(p_rec.attribute14, hr_api.g_varchar2)  OR
224     NVL(ota_tps_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
225     NVL(p_rec.attribute15, hr_api.g_varchar2)  OR
226     NVL(ota_tps_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
227     NVL(p_rec.attribute16, hr_api.g_varchar2)  OR
228     NVL(ota_tps_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
229     NVL(p_rec.attribute17, hr_api.g_varchar2)  OR
230     NVL(ota_tps_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
231     NVL(p_rec.attribute18, hr_api.g_varchar2)  OR
232     NVL(ota_tps_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
233     NVL(p_rec.attribute19, hr_api.g_varchar2)  OR
234     NVL(ota_tps_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
235     NVL(p_rec.attribute20, hr_api.g_varchar2)  OR
236     NVL(ota_tps_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
237     NVL(p_rec.attribute21, hr_api.g_varchar2)  OR
238     NVL(ota_tps_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
239     NVL(p_rec.attribute22, hr_api.g_varchar2)  OR
240     NVL(ota_tps_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
241     NVL(p_rec.attribute23, hr_api.g_varchar2)  OR
242     NVL(ota_tps_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
243     NVL(p_rec.attribute24, hr_api.g_varchar2)  OR
244     NVL(ota_tps_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
245     NVL(p_rec.attribute25, hr_api.g_varchar2)  OR
246     NVL(ota_tps_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
247     NVL(p_rec.attribute26, hr_api.g_varchar2)  OR
248     NVL(ota_tps_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
249     NVL(p_rec.attribute27, hr_api.g_varchar2)  OR
250     NVL(ota_tps_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
251     NVL(p_rec.attribute28, hr_api.g_varchar2)  OR
252     NVL(ota_tps_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
253     NVL(p_rec.attribute29, hr_api.g_varchar2)  OR
254     NVL(ota_tps_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
255     NVL(p_rec.attribute30, hr_api.g_varchar2) ) )
256     OR (p_rec.training_plan_id IS NULL)  THEN
257     --
258     -- Only execute the validation if absolutely necessary:
259     -- a) During update, the structure column value or any
260     --    of the attribute values have actually changed.
261     -- b) During insert.
262     --
263     hr_dflex_utility.ins_or_upd_descflex_attribs
264       (p_appl_short_name                 => 'OTA'
265       ,p_descflex_name                   => 'OTA_TRAINING_PLANS'
266       ,p_attribute_category              => p_rec.attribute_category
267       ,p_attribute1_name                 => 'ATTRIBUTE1'
268       ,p_attribute1_value                => p_rec.attribute1
269       ,p_attribute2_name                 => 'ATTRIBUTE2'
270       ,p_attribute2_value                => p_rec.attribute2
271       ,p_attribute3_name                 => 'ATTRIBUTE3'
272       ,p_attribute3_value                => p_rec.attribute3
273       ,p_attribute4_name                 => 'ATTRIBUTE4'
274       ,p_attribute4_value                => p_rec.attribute4
275       ,p_attribute5_name                 => 'ATTRIBUTE5'
276       ,p_attribute5_value                => p_rec.attribute5
277       ,p_attribute6_name                 => 'ATTRIBUTE6'
278       ,p_attribute6_value                => p_rec.attribute6
279       ,p_attribute7_name                 => 'ATTRIBUTE7'
280       ,p_attribute7_value                => p_rec.attribute7
281       ,p_attribute8_name                 => 'ATTRIBUTE8'
282       ,p_attribute8_value                => p_rec.attribute8
283       ,p_attribute9_name                 => 'ATTRIBUTE9'
284       ,p_attribute9_value                => p_rec.attribute9
285       ,p_attribute10_name                => 'ATTRIBUTE10'
286       ,p_attribute10_value               => p_rec.attribute10
287       ,p_attribute11_name                => 'ATTRIBUTE11'
288       ,p_attribute11_value               => p_rec.attribute11
289       ,p_attribute12_name                => 'ATTRIBUTE12'
290       ,p_attribute12_value               => p_rec.attribute12
291       ,p_attribute13_name                => 'ATTRIBUTE13'
292       ,p_attribute13_value               => p_rec.attribute13
293       ,p_attribute14_name                => 'ATTRIBUTE14'
294       ,p_attribute14_value               => p_rec.attribute14
295       ,p_attribute15_name                => 'ATTRIBUTE15'
296       ,p_attribute15_value               => p_rec.attribute15
297       ,p_attribute16_name                => 'ATTRIBUTE16'
298       ,p_attribute16_value               => p_rec.attribute16
299       ,p_attribute17_name                => 'ATTRIBUTE17'
300       ,p_attribute17_value               => p_rec.attribute17
301       ,p_attribute18_name                => 'ATTRIBUTE18'
302       ,p_attribute18_value               => p_rec.attribute18
303       ,p_attribute19_name                => 'ATTRIBUTE19'
304       ,p_attribute19_value               => p_rec.attribute19
305       ,p_attribute20_name                => 'ATTRIBUTE20'
306       ,p_attribute20_value               => p_rec.attribute20
307       ,p_attribute21_name                => 'ATTRIBUTE21'
308       ,p_attribute21_value               => p_rec.attribute21
309       ,p_attribute22_name                => 'ATTRIBUTE22'
310       ,p_attribute22_value               => p_rec.attribute22
311       ,p_attribute23_name                => 'ATTRIBUTE23'
312       ,p_attribute23_value               => p_rec.attribute23
313       ,p_attribute24_name                => 'ATTRIBUTE24'
314       ,p_attribute24_value               => p_rec.attribute24
315       ,p_attribute25_name                => 'ATTRIBUTE25'
316       ,p_attribute25_value               => p_rec.attribute25
317       ,p_attribute26_name                => 'ATTRIBUTE26'
318       ,p_attribute26_value               => p_rec.attribute26
319       ,p_attribute27_name                => 'ATTRIBUTE27'
320       ,p_attribute27_value               => p_rec.attribute27
321       ,p_attribute28_name                => 'ATTRIBUTE28'
322       ,p_attribute28_value               => p_rec.attribute28
323       ,p_attribute29_name                => 'ATTRIBUTE29'
324       ,p_attribute29_value               => p_rec.attribute29
325       ,p_attribute30_name                => 'ATTRIBUTE30'
326       ,p_attribute30_value               => p_rec.attribute30
327       );
328   END IF;
329   --
330   hr_utility.set_location(' Leaving:'||l_proc,20);
331 END chk_df;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |-----------------------< chk_non_updateable_args >------------------------|
335 -- ----------------------------------------------------------------------------
336 -- {Start Of Comments}
337 --
338 -- Description:
339 --   This procedure is used to ensure that non updateable attributes have
340 --   not been updated. If an attribute has been updated an error is generated.
341 --
342 -- Pre Conditions:
343 --   g_old_rec has been populated with details of the values currently in
344 --   the database.
345 --
346 -- In Arguments:
347 --   p_rec has been populated with the updated values the user would like the
348 --   record set to.
349 --
350 -- Post Success:
351 --   Processing continues if all the non updateable attributes have not
352 --   changed.
353 --
354 -- Post Failure:
355 --   An application error is raised if any of the non updatable attributes
356 --   have been altered.
357 --
358 -- {End Of Comments}
359 -- ----------------------------------------------------------------------------
360 PROCEDURE chk_non_updateable_args
361   (p_effective_date               IN date
362   ,p_rec                          IN ota_tps_shd.g_rec_type
363   ) IS
367   l_argument varchar2(30);
364 --
365   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
366   l_error    EXCEPTION;
368 --
369 BEGIN
370   --
371   -- Only proceed with the validation if a row exists for the current
372   -- record in the HR Schema.
373   --
374   IF NOT ota_tps_shd.api_updating
375       (p_training_plan_id                     => p_rec.training_plan_id
376       ,p_object_version_number                => p_rec.object_version_number
377       ) THEN
378      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
379      fnd_message.set_token('PROCEDURE ', l_proc);
380      fnd_message.set_token('STEP ', '5');
381      fnd_message.raise_error;
382   END IF;
383   --
384   --
385    hr_utility.set_location(' Step:'|| l_proc, 10);
386   IF NVL(p_rec.business_group_id, hr_api.g_number) <>
387      NVL(ota_tps_shd.g_old_rec.business_group_id, hr_api.g_number) THEN
388      hr_api.argument_changed_error
389          (p_api_name => l_proc
390          ,p_argument => 'BUSINESS_GROUP_ID'
391          ,p_base_table => ota_tps_shd.g_tab_nam);
392   END IF;
393   --
394   hr_utility.set_location(' Step:'|| l_proc, 20);
395   IF NVL(p_rec.training_plan_id, hr_api.g_number) <>
396      NVL(ota_tps_shd.g_old_rec.training_plan_id, hr_api.g_number) THEN
397      hr_api.argument_changed_error
398          (p_api_name => l_proc
399          ,p_argument => 'TRAINING_PLAN_ID'
400          ,p_base_table => ota_tps_shd.g_tab_nam);
401   END IF;
402   --
403   hr_utility.set_location(' Step:'|| l_proc, 30);
404   IF NVL(p_rec.organization_id, hr_api.g_number) <>
405      NVL(ota_tps_shd.g_old_rec.organization_id, hr_api.g_number) THEN
406      hr_api.argument_changed_error
407          (p_api_name => l_proc
408          ,p_argument => 'ORGANIZATION_ID'
409          ,p_base_table => ota_tps_shd.g_tab_nam);
410   END IF;
411   --
412   hr_utility.set_location(' Step:'|| l_proc, 40);
413   IF NVL(p_rec.person_id, hr_api.g_number) <>
414      NVL(ota_tps_shd.g_old_rec.person_id, hr_api.g_number) THEN
415      hr_api.argument_changed_error
416          (p_api_name => l_proc
417          ,p_argument => 'PERSON_ID'
418          ,p_base_table => ota_tps_shd.g_tab_nam);
419   END IF;
420   --
421   EXCEPTION
422 
423     WHEN OTHERS THEN
424        RAISE;
425 END chk_non_updateable_args;
426 --
427 -- ----------------------------------------------------------------------------
428 -- |---------------------------< insert_validate >----------------------------|
429 -- ----------------------------------------------------------------------------
430 PROCEDURE insert_validate
431   (p_effective_date               IN date
432   ,p_rec                          IN ota_tps_shd.g_rec_type
433   ) IS
434 --
435   l_proc  varchar2(72) := g_package||'insert_validate';
436 --
437 BEGIN
438   hr_utility.set_location('Entering:'||l_proc, 5);
439   --
440   -- Call all supporting business operations
441   --Validate Important Attributes
442   --
443   hr_api.validate_bus_grp_id(p_rec.business_group_id
444                              ,p_associated_column1 => ota_tps_shd.g_tab_nam || '.BUSINESS_GROUP_ID');  -- Validate Bus Grp
445   --
446   hr_multi_message.end_validation_set;
447 
448   --
449   hr_utility.set_location(' Step:'|| l_proc, 20);
450   ota_tps_bus1.chk_org_person (
451                p_organization_id        => p_rec.organization_id
452               ,p_person_id              => p_rec.person_id
453 	      ,p_contact_id             =>  p_rec.contact_id);
454   --
455   hr_utility.set_location(' Step:'|| l_proc, 30);
456   ota_tps_bus1.chk_organization_id (
457                p_organization_id        => p_rec.organization_id
458               ,p_business_group_id      => p_rec.business_group_id);
459   --
460   hr_utility.set_location(' Step:'|| l_proc, 40);
461   ota_tps_bus1.chk_person_id (
462                p_effective_date         => p_effective_date
463               ,p_person_id              => p_rec.person_id
464               ,p_business_group_id      => p_rec.business_group_id);
465   --
466   hr_utility.set_location(' Step:'|| l_proc, 50);
467   -- Set the Is_Per_Trng_Plan global variable
468   IF p_rec.person_id IS NOT NULL OR p_rec.contact_id IS NOT NULL THEN
469      OTA_TRNG_PLAN_UTIL_SS.g_is_per_trng_plan := TRUE;
470   END IF;
471 
472   ota_tps_bus1.chk_plan_status_type_id (
473                p_effective_date         => p_effective_date
474               ,p_plan_status_type_id    => p_rec.plan_status_type_id);
475   --
476    hr_utility.set_location(' Step:'|| l_proc, 80);
477   ota_tps_bus1.chk_currency_code (
478                p_budget_currency        => p_rec.budget_currency
479               ,p_training_plan_id       => p_rec.training_plan_id
480               ,p_business_group_id      => p_rec.business_group_id
481               ,p_object_version_number  => p_rec.object_version_number);
482   --
483   IF p_rec.learning_path_id IS NULL THEN
484   hr_utility.set_location(' Step:'|| l_proc, 90);
485   ota_tps_bus1.chk_name
486                (p_name                   => p_rec.name
487                ,p_training_plan_id       => p_rec.training_plan_id
488                ,p_person_id              => p_rec.person_id  --Bug#3484692
489 	       ,p_contact_id             => p_rec.contact_id  --Bug#3855813
493 
490                ,p_business_group_id      => p_rec.business_group_id
491                ,p_object_version_number  => p_rec.object_version_number );
492   END IF;
494   IF p_rec.person_id IS NOT NULL  OR p_rec.contact_id IS NOT NULL THEN
495      hr_utility.set_location(' Step:'|| l_proc, 55);
496 
497 
498      ota_tps_bus1.chk_tp_date_range
499             (p_training_plan_id => p_rec.training_plan_id
500             ,p_start_date => p_rec.start_date
501             ,p_end_date => p_rec.end_date
502             ,p_object_version_number => p_rec.object_version_number);
503 
504      ota_tps_bus1.chk_plan_source(
505                 p_effective_date => p_effective_date
506                ,p_plan_source    => p_rec.plan_source
507                ,p_training_plan_id => p_rec.training_plan_id);
508 
509   ELSIF p_rec.person_id IS NULL  AND p_rec.contact_id IS NULL THEN
510   hr_utility.set_location(' Step:'|| l_proc, 60);
511   ota_tps_bus1.chk_time_period_id (
512                p_training_plan_id       => p_rec.training_plan_id
513               ,p_object_version_number  => p_rec.object_version_number
514               ,p_time_period_id         => p_rec.time_period_id
515               ,p_business_group_id      => p_rec.business_group_id);
516   --
517 
518   ota_tps_bus1.chk_unique (
519                p_training_plan_id       => p_rec.training_plan_id
520               ,p_object_version_number  => p_rec.object_version_number
521               ,p_organization_id        => p_rec.organization_id
522               ,p_person_id              => p_rec.person_id
523               ,p_time_period_id         => p_rec.time_period_id );
524 
525   hr_utility.set_location(' Step:'|| l_proc, 70);
526   ota_tps_bus1.chk_period_overlap (
527                p_training_plan_id       => p_rec.training_plan_id
528               ,p_object_version_number  => p_rec.object_version_number
529               ,p_plan_status_type_id    => p_rec.plan_status_type_id
530               ,p_time_period_id         => p_rec.time_period_id
531               ,p_person_id              => p_rec.person_id
532               ,p_organization_id        => p_rec.organization_id);
533   --
534   END IF;
535 
536    --
537   ota_tps_bus.chk_df(p_rec);
538   --
539    hr_utility.set_location(' Leaving:'||l_proc, 100);
540 END insert_validate;
541 --
542 -- ----------------------------------------------------------------------------
543 -- |---------------------------< update_validate >----------------------------|
544 -- ----------------------------------------------------------------------------
545 PROCEDURE update_validate
546   (p_effective_date               IN date
547   ,p_rec                          IN ota_tps_shd.g_rec_type
548   ) IS
549 --
550   l_proc  varchar2(72) := g_package||'update_validate';
551   l_boolean boolean := null;
552 --
553 BEGIN
554   hr_utility.set_location('Entering:'||l_proc, 5);
555   --
556   -- Call all supporting business operations
557   --Validate Important attribute
558 
559   hr_api.validate_bus_grp_id(p_rec.business_group_id
560                             ,p_associated_column1 => ota_tps_shd.g_tab_nam || '.BUSINESS_GROUP_ID');  -- Validate Bus Grp
561   --
562   hr_multi_message.end_validation_set;
563 
564   chk_non_updateable_args
565     (p_effective_date              => p_effective_date
566       ,p_rec                       => p_rec
567     );
568   --
569   hr_utility.set_location(' Step:'|| l_proc, 10);
570   -- Set the Is_Per_Trng_Plan global variable
571   l_boolean := OTA_TRNG_PLAN_UTIL_SS.is_personal_trng_plan(p_rec.training_plan_id);
572 
573   ota_tps_bus1.chk_plan_status_type_id (
574                p_effective_date         => p_effective_date
575               ,p_plan_status_type_id    => p_rec.plan_status_type_id);
576   --
577   hr_utility.set_location(' Step:'|| l_proc, 40);
578 
579   ota_tps_bus1.chk_currency_code (
580                p_budget_currency        => p_rec.budget_currency
581               ,p_training_plan_id       => p_rec.training_plan_id
582               ,p_business_group_id      => p_rec.business_group_id
583               ,p_object_version_number  => p_rec.object_version_number);
584   --
585   hr_utility.set_location(' Step:'|| l_proc, 50);
586 
587   ota_tps_bus1.chk_name (
588                p_name                   => p_rec.name
589               ,p_training_plan_id       => p_rec.training_plan_id
590               ,p_person_id              => p_rec.person_id  --Bug#3484692
591               ,p_contact_id             => p_rec.contact_id  --Bug#3855813
592               ,p_business_group_id      => p_rec.business_group_id
593               ,p_object_version_number  => p_rec.object_version_number);
594   --
595 
596   IF p_rec.person_id IS NOT NULL OR p_rec.contact_id IS NOT NULL THEN
597   hr_utility.set_location(' Step:'|| l_proc, 15);
598 
599   ota_tps_bus1.chk_tp_date_range
600             (p_training_plan_id => p_rec.training_plan_id
604 
601             ,p_start_date => p_rec.start_date
602             ,p_end_date => p_rec.end_date
603             ,p_object_version_number => p_rec.object_version_number);
605   ota_tps_bus1.chk_plan_source(
606                 p_effective_date => p_effective_date
607                ,p_plan_source    => p_rec.plan_source
608                ,p_training_plan_id => p_rec.training_plan_id);
609 
610   END IF;
611   --
612   IF p_rec.person_id IS NULL AND p_rec.contact_id IS NULL THEN
613   hr_utility.set_location(' Step:'|| l_proc, 20);
614   ota_tps_bus1.chk_time_period_id (
615                p_training_plan_id       => p_rec.training_plan_id
616               ,p_object_version_number  => p_rec.object_version_number
617               ,p_time_period_id         => p_rec.time_period_id
618               ,p_business_group_id      => p_rec.business_group_id);
619   --
620   hr_utility.set_location(' Step:'|| l_proc, 30);
621 
622   ota_tps_bus1.chk_unique (
623                p_training_plan_id       => p_rec.training_plan_id
624               ,p_object_version_number  => p_rec.object_version_number
625               ,p_organization_id        => p_rec.organization_id
626               ,p_person_id              => p_rec.person_id
627               ,p_time_period_id         => p_rec.time_period_id );
628 
629 
630   ota_tps_bus1.chk_period_overlap (
631                p_training_plan_id       => p_rec.training_plan_id
632               ,p_object_version_number  => p_rec.object_version_number
633               ,p_plan_status_type_id    => p_rec.plan_status_type_id
634               ,p_time_period_id         => p_rec.time_period_id
635               ,p_person_id              => p_rec.person_id
636               ,p_organization_id        => p_rec.organization_id);
637   END IF;
638 
639   hr_utility.set_location(' Step:'|| l_proc, 60);
640   ota_tps_bus.chk_df(p_rec);
641   --
642   hr_utility.set_location(' Leaving:'||l_proc, 70);
643 END update_validate;
644 --
645 -- ----------------------------------------------------------------------------
646 -- |---------------------------< delete_validate >----------------------------|
647 -- ----------------------------------------------------------------------------
648 PROCEDURE delete_validate
649   (p_rec                          IN ota_tps_shd.g_rec_type
650   ) IS
651 --
652   l_proc  varchar2(72) := g_package||'delete_validate';
653 --
654 BEGIN
655   hr_utility.set_location('Entering:'||l_proc, 5);
656   --
657   -- Call all supporting business operations
658   --
659    hr_utility.set_location(' Step:'|| l_proc, 10);
660    ota_tps_bus1.chk_del_training_plan_id(
661            p_training_plan_id    => ota_tps_shd.g_old_rec.training_plan_id);
662   --
663   hr_utility.set_location(' Leaving:'||l_proc, 20);
664 END delete_validate;
665 --
666 END ota_tps_bus;