DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BPD_BUS

Source


1 Package Body per_bpd_bus as
2 /* $Header: pebpdrhi.pkb 115.6 2002/12/02 13:52:43 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_bpd_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_payment_detail_id           number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 procedure set_security_group_id
21 (p_payment_detail_id                    in number
22 ) is
23 --
24 -- Declare cursor
25 --
26 cursor csr_sec_grp is
27 select inf.org_information14
28 from hr_organization_information inf
29  , per_bf_payment_details bpd
30 where bpd.payment_detail_id = p_payment_detail_id
31 and inf.organization_id   = bpd.business_group_id
32 and inf.org_information_context || '' = 'Business Group Information';
33 --
34 -- Declare local variables
35 --
36 l_security_group_id number;
37 l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
38 --
39 begin
40 --
41 hr_utility.set_location('Entering:'|| l_proc, 10);
42 --
43 -- Ensure that all the mandatory parameter are not null
44 --
45 hr_api.mandatory_arg_error(p_api_name           => l_proc,
46 		     p_argument           => 'PAYMENT_DETAIL_ID',
47 		     p_argument_value     => p_payment_detail_id);
48 --
49 open csr_sec_grp;
50 fetch csr_sec_grp into l_security_group_id;
51 --
52 if csr_sec_grp%notfound then
53 --
54 close csr_sec_grp;
55 --
56 -- The primary key is invalid therefore we must error
57 --
58 fnd_message.set_name('PER','HR_7220_INVALID_PRIMARY_KEY');
59 fnd_message.raise_error;
60 --
61 end if;
62 close csr_sec_grp;
63 --
64 -- Set the security_group_id in CLIENT_INFO
65 --
66 hr_api.set_security_group_id
67 (p_security_group_id => l_security_group_id
68 );
69 --
70 hr_utility.set_location(' Leaving:'|| l_proc, 20);
71 --
72 end set_security_group_id;
73 --
74 --  ---------------------------------------------------------------------------
75 --  |---------------------< return_legislation_code >-------------------------|
76 --  ---------------------------------------------------------------------------
77 --
78 function return_legislation_code
79 (p_payment_detail_id                    in number) return varchar2 is
80 --
81 -- Declare cursor
82 --
83 cursor csr_leg_code is
84 select pbg.legislation_code
85 from per_business_groups pbg
86  , per_bf_payment_details bpd
87 where bpd.payment_detail_id = p_payment_detail_id
88 and pbg.business_group_id = bpd.business_group_id;
89 --
90 -- Declare local variables
91 --
92 l_legislation_code  varchar2(150);
93 l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
94 --
95 begin
96 --
97 hr_utility.set_location('Entering:'|| l_proc, 10);
98 --
99 -- Ensure that all the mandatory parameter are not null
100 --
101 hr_api.mandatory_arg_error(p_api_name           => l_proc,
102 		     p_argument           => 'PAYMENT_DETAIL_ID',
103 		     p_argument_value     => p_payment_detail_id);
104 --
105 if ( nvl(g_payment_detail_id, hr_api.g_number)
106 = p_payment_detail_id) then
107 --
108 -- The legislation code has already been found with a previous
109 -- call to this function. Just return the value in the global
110 -- variable.
111 --
112 l_legislation_code := g_legislation_code;
113 hr_utility.set_location(l_proc, 20);
114 else
115 --
116 -- The ID is different to the last call to this function
117 -- or this is the first call to this function.
118 --
119 open csr_leg_code;
120 fetch csr_leg_code into l_legislation_code;
121 --
122 if csr_leg_code%notfound then
123 --
124 -- The primary key is invalid therefore we must error
125 --
126 close csr_leg_code;
127 fnd_message.set_name('PER','HR_7220_INVALID_PRIMARY_KEY');
128 fnd_message.raise_error;
129 end if;
130 hr_utility.set_location(l_proc,30);
131 --
132 -- Set the global variables so the values are
133 -- available for the next call to this function.
134 --
135 close csr_leg_code;
136 g_payment_detail_id                 := p_payment_detail_id;
137 g_legislation_code                  := l_legislation_code;
138 end if;
139 hr_utility.set_location(' Leaving:'|| l_proc, 40);
140 return l_legislation_code;
141 end return_legislation_code;
142 --
143 -- ----------------------------------------------------------------------------
144 -- |------------------------------< chk_df >----------------------------------|
145 -- ----------------------------------------------------------------------------
146 --
147 -- Description:
148 --   Validates all the Descriptive Flexfield values.
149 --
150 -- Prerequisites:
151 --   All other columns have been validated.  Must be called as the
152 --   last step from insert_validate and update_validate.
153 --
154 -- In Arguments:
155 --   p_rec
156 --
157 -- Post Success:
158 --   If the Descriptive Flexfield structure column and data values are
159 --   all valid this procedure will end normally and processing will
160 --   continue.
161 --
162 -- Post Failure:
163 --   If the Descriptive Flexfield structure column value or any of
164 --   the data values are invalid then an application error is raised as
165 --   a PL/SQL exception.
166 --
167 -- Access Status:
168 --   Internal Row Handler Use Only.
169 --
170 -- ----------------------------------------------------------------------------
171 procedure chk_df
172 (p_rec in per_bpd_shd.g_rec_type
173 ) is
174 --
175 l_proc   varchar2(72) := g_package || 'chk_df';
176 --
177 begin
178 hr_utility.set_location('Entering:'||l_proc,10);
179 --
180 if ((p_rec.payment_detail_id is not null)  and (
181 nvl(per_bpd_shd.g_old_rec.bpd_attribute_category, hr_api.g_varchar2) <>
182 nvl(p_rec.bpd_attribute_category, hr_api.g_varchar2)  or
183 nvl(per_bpd_shd.g_old_rec.bpd_attribute1, hr_api.g_varchar2) <>
184 nvl(p_rec.bpd_attribute1, hr_api.g_varchar2)  or
185 nvl(per_bpd_shd.g_old_rec.bpd_attribute2, hr_api.g_varchar2) <>
186 nvl(p_rec.bpd_attribute2, hr_api.g_varchar2)  or
187 nvl(per_bpd_shd.g_old_rec.bpd_attribute3, hr_api.g_varchar2) <>
188 nvl(p_rec.bpd_attribute3, hr_api.g_varchar2)  or
189 nvl(per_bpd_shd.g_old_rec.bpd_attribute4, hr_api.g_varchar2) <>
190 nvl(p_rec.bpd_attribute4, hr_api.g_varchar2)  or
191 nvl(per_bpd_shd.g_old_rec.bpd_attribute5, hr_api.g_varchar2) <>
192 nvl(p_rec.bpd_attribute5, hr_api.g_varchar2)  or
193 nvl(per_bpd_shd.g_old_rec.bpd_attribute6, hr_api.g_varchar2) <>
194 nvl(p_rec.bpd_attribute6, hr_api.g_varchar2)  or
195 nvl(per_bpd_shd.g_old_rec.bpd_attribute7, hr_api.g_varchar2) <>
196 nvl(p_rec.bpd_attribute7, hr_api.g_varchar2)  or
197 nvl(per_bpd_shd.g_old_rec.bpd_attribute8, hr_api.g_varchar2) <>
198 nvl(p_rec.bpd_attribute8, hr_api.g_varchar2)  or
199 nvl(per_bpd_shd.g_old_rec.bpd_attribute9, hr_api.g_varchar2) <>
200 nvl(p_rec.bpd_attribute9, hr_api.g_varchar2)  or
201 nvl(per_bpd_shd.g_old_rec.bpd_attribute10, hr_api.g_varchar2) <>
202 nvl(p_rec.bpd_attribute10, hr_api.g_varchar2)  or
203 nvl(per_bpd_shd.g_old_rec.bpd_attribute11, hr_api.g_varchar2) <>
204 nvl(p_rec.bpd_attribute11, hr_api.g_varchar2)  or
205 nvl(per_bpd_shd.g_old_rec.bpd_attribute12, hr_api.g_varchar2) <>
206 nvl(p_rec.bpd_attribute12, hr_api.g_varchar2)  or
207 nvl(per_bpd_shd.g_old_rec.bpd_attribute13, hr_api.g_varchar2) <>
208 nvl(p_rec.bpd_attribute13, hr_api.g_varchar2)  or
209 nvl(per_bpd_shd.g_old_rec.bpd_attribute14, hr_api.g_varchar2) <>
210 nvl(p_rec.bpd_attribute14, hr_api.g_varchar2)  or
211 nvl(per_bpd_shd.g_old_rec.bpd_attribute15, hr_api.g_varchar2) <>
212 nvl(p_rec.bpd_attribute15, hr_api.g_varchar2)  or
213 nvl(per_bpd_shd.g_old_rec.bpd_attribute16, hr_api.g_varchar2) <>
214 nvl(p_rec.bpd_attribute16, hr_api.g_varchar2)  or
215 nvl(per_bpd_shd.g_old_rec.bpd_attribute17, hr_api.g_varchar2) <>
216 nvl(p_rec.bpd_attribute17, hr_api.g_varchar2)  or
217 nvl(per_bpd_shd.g_old_rec.bpd_attribute18, hr_api.g_varchar2) <>
218 nvl(p_rec.bpd_attribute18, hr_api.g_varchar2)  or
219 nvl(per_bpd_shd.g_old_rec.bpd_attribute19, hr_api.g_varchar2) <>
220 nvl(p_rec.bpd_attribute19, hr_api.g_varchar2)  or
221 nvl(per_bpd_shd.g_old_rec.bpd_attribute20, hr_api.g_varchar2) <>
222 nvl(p_rec.bpd_attribute20, hr_api.g_varchar2)  or
223 nvl(per_bpd_shd.g_old_rec.bpd_attribute21, hr_api.g_varchar2) <>
224 nvl(p_rec.bpd_attribute21, hr_api.g_varchar2)  or
225 nvl(per_bpd_shd.g_old_rec.bpd_attribute22, hr_api.g_varchar2) <>
226 nvl(p_rec.bpd_attribute22, hr_api.g_varchar2)  or
227 nvl(per_bpd_shd.g_old_rec.bpd_attribute23, hr_api.g_varchar2) <>
228 nvl(p_rec.bpd_attribute23, hr_api.g_varchar2)  or
229 nvl(per_bpd_shd.g_old_rec.bpd_attribute24, hr_api.g_varchar2) <>
230 nvl(p_rec.bpd_attribute24, hr_api.g_varchar2)  or
231 nvl(per_bpd_shd.g_old_rec.bpd_attribute25, hr_api.g_varchar2) <>
232 nvl(p_rec.bpd_attribute25, hr_api.g_varchar2)  or
233 nvl(per_bpd_shd.g_old_rec.bpd_attribute26, hr_api.g_varchar2) <>
234 nvl(p_rec.bpd_attribute26, hr_api.g_varchar2)  or
235 nvl(per_bpd_shd.g_old_rec.bpd_attribute27, hr_api.g_varchar2) <>
236 nvl(p_rec.bpd_attribute27, hr_api.g_varchar2)  or
237 nvl(per_bpd_shd.g_old_rec.bpd_attribute28, hr_api.g_varchar2) <>
238 nvl(p_rec.bpd_attribute28, hr_api.g_varchar2)  or
239 nvl(per_bpd_shd.g_old_rec.bpd_attribute29, hr_api.g_varchar2) <>
240 nvl(p_rec.bpd_attribute29, hr_api.g_varchar2)  or
241 nvl(per_bpd_shd.g_old_rec.bpd_attribute30, hr_api.g_varchar2) <>
242 nvl(p_rec.bpd_attribute30, hr_api.g_varchar2) ))
243 or (p_rec.payment_detail_id is null)  then
244 --
245 -- Only execute the validation if absolutely necessary:
246 -- a) During update, the structure column value or any
247 --    of the attribute values have actually changed.
248 -- b) During insert.
249 --
250 hr_dflex_utility.ins_or_upd_descflex_attribs
251 (p_appl_short_name                 => 'PER'
252 ,p_descflex_name                   => 'PER_BF_PAYMENT_DETAILS'
253 ,p_attribute_category              => p_rec.bpd_attribute_category
254 ,p_attribute1_name                 => 'BPD_ATTRIBUTE1'
255 ,p_attribute1_value                => p_rec.bpd_attribute1
256 ,p_attribute2_name                 => 'BPD_ATTRIBUTE2'
257 ,p_attribute2_value                => p_rec.bpd_attribute2
258 ,p_attribute3_name                 => 'BPD_ATTRIBUTE3'
259 ,p_attribute3_value                => p_rec.bpd_attribute3
260 ,p_attribute4_name                 => 'BPD_ATTRIBUTE4'
261 ,p_attribute4_value                => p_rec.bpd_attribute4
262 ,p_attribute5_name                 => 'BPD_ATTRIBUTE5'
263 ,p_attribute5_value                => p_rec.bpd_attribute5
264 ,p_attribute6_name                 => 'BPD_ATTRIBUTE6'
265 ,p_attribute6_value                => p_rec.bpd_attribute6
266 ,p_attribute7_name                 => 'BPD_ATTRIBUTE7'
267 ,p_attribute7_value                => p_rec.bpd_attribute7
268 ,p_attribute8_name                 => 'BPD_ATTRIBUTE8'
269 ,p_attribute8_value                => p_rec.bpd_attribute8
270 ,p_attribute9_name                 => 'BPD_ATTRIBUTE9'
271 ,p_attribute9_value                => p_rec.bpd_attribute9
272 ,p_attribute10_name                => 'BPD_ATTRIBUTE10'
273 ,p_attribute10_value               => p_rec.bpd_attribute10
274 ,p_attribute11_name                => 'BPD_ATTRIBUTE11'
275 ,p_attribute11_value               => p_rec.bpd_attribute11
276 ,p_attribute12_name                => 'BPD_ATTRIBUTE12'
277 ,p_attribute12_value               => p_rec.bpd_attribute12
278 ,p_attribute13_name                => 'BPD_ATTRIBUTE13'
279 ,p_attribute13_value               => p_rec.bpd_attribute13
280 ,p_attribute14_name                => 'BPD_ATTRIBUTE14'
281 ,p_attribute14_value               => p_rec.bpd_attribute14
282 ,p_attribute15_name                => 'BPD_ATTRIBUTE15'
283 ,p_attribute15_value               => p_rec.bpd_attribute15
284 ,p_attribute16_name                => 'BPD_ATTRIBUTE16'
285 ,p_attribute16_value               => p_rec.bpd_attribute16
286 ,p_attribute17_name                => 'BPD_ATTRIBUTE17'
287 ,p_attribute17_value               => p_rec.bpd_attribute17
288 ,p_attribute18_name                => 'BPD_ATTRIBUTE18'
289 ,p_attribute18_value               => p_rec.bpd_attribute18
290 ,p_attribute19_name                => 'BPD_ATTRIBUTE19'
291 ,p_attribute19_value               => p_rec.bpd_attribute19
292 ,p_attribute20_name                => 'BPD_ATTRIBUTE20'
293 ,p_attribute20_value               => p_rec.bpd_attribute20
294 ,p_attribute21_name                => 'BPD_ATTRIBUTE21'
295 ,p_attribute21_value               => p_rec.bpd_attribute21
296 ,p_attribute22_name                => 'BPD_ATTRIBUTE22'
297 ,p_attribute22_value               => p_rec.bpd_attribute22
298 ,p_attribute23_name                => 'BPD_ATTRIBUTE23'
299 ,p_attribute23_value               => p_rec.bpd_attribute23
300 ,p_attribute24_name                => 'BPD_ATTRIBUTE24'
301 ,p_attribute24_value               => p_rec.bpd_attribute24
302 ,p_attribute25_name                => 'BPD_ATTRIBUTE25'
303 ,p_attribute25_value               => p_rec.bpd_attribute25
304 ,p_attribute26_name                => 'BPD_ATTRIBUTE26'
305 ,p_attribute26_value               => p_rec.bpd_attribute26
306 ,p_attribute27_name                => 'BPD_ATTRIBUTE27'
307 ,p_attribute27_value               => p_rec.bpd_attribute27
308 ,p_attribute28_name                => 'BPD_ATTRIBUTE28'
309 ,p_attribute28_value               => p_rec.bpd_attribute28
310 ,p_attribute29_name                => 'BPD_ATTRIBUTE29'
311 ,p_attribute29_value               => p_rec.bpd_attribute29
312 ,p_attribute30_name                => 'BPD_ATTRIBUTE30'
313 ,p_attribute30_value               => p_rec.bpd_attribute30
314 
315 );
316 end if;
317 --
318 hr_utility.set_location(' Leaving:'||l_proc,20);
319 end chk_df;
320 -- ----------------------------------------------------------------------------
321 -- |----------------------< check_non_updateable_args >-----------------------|
322 -- ----------------------------------------------------------------------------
323 -- {Start Of Comments}
324 --
325 -- Description:
326 --   This procedure is used to ensure that non updateable attributes have
327 --   not been updated. If an attribute has been updated an error is generated.
328 --
329 -- Pre Conditions:
330 --   g_old_rec has been populated with details of the values currently in
331 --   the database.
332 --
333 -- In Arguments:
334 --   p_rec has been populated with the updated values the user would like the
335 --   record set to.
336 --
337 -- Post Success:
338 --   Processing continues if all the non updateable attributes have not
339 --   changed.
340 --
341 -- Post Failure:
342 --   An application error is raised if any of the non updatable attributes
343 --   have been altered.
344 --
345 -- {End Of Comments}
346 -- ----------------------------------------------------------------------------
347 Procedure chk_non_updateable_args(p_rec in per_bpd_shd.g_rec_type) IS
348 --
349 l_proc     varchar2(72) := g_package || 'check_non_updateable_args';
350 l_error    EXCEPTION;
351 l_argument varchar2(30);
352 --
353 Begin
354 hr_utility.set_location('Entering:'||l_proc,5);
355 --
356 -- Only proceed with the validation if a row exists for the current
357 -- record in the HR Schema.
358 --
359 IF NOT per_bpd_shd.api_updating
360 (p_payment_detail_id                      => p_rec.payment_detail_id
361 ,p_object_version_number                => p_rec.object_version_number
362 ) THEN
363 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
364 hr_utility.set_message_token('PROCEDURE ', l_proc);
365 hr_utility.set_message_token('STEP ', '5');
366 END IF;
367 --
368 hr_utility.set_location(l_proc,10);
369 --
370 IF nvl(p_rec.processed_assignment_id, hr_api.g_number) <>
371 per_bpd_shd.g_old_rec.processed_assignment_id then
372 l_argument:='processed_assignment_id';
373 raise l_error;
374 END IF;
375 hr_utility.set_location(l_proc,20);
376 --
377 IF nvl(p_rec.personal_payment_method_id, hr_api.g_number) <>
378 per_bpd_shd.g_old_rec.personal_payment_method_id then
379 l_argument:='personal_payment_method_id';
380 raise l_error;
381 END IF;
382 hr_utility.set_location(l_proc,30);
383 --
384 IF nvl(p_rec.business_group_id, hr_api.g_number) <>
385 per_bpd_shd.g_old_rec.business_group_id then
386 l_argument:='business_group_id';
387 raise l_error;
388 END IF;
389 hr_utility.set_location(l_proc,40);
390 --
391 EXCEPTION
392 WHEN l_error THEN
393 hr_api.argument_changed_error
394  (p_api_name => l_proc
395  ,p_argument => l_argument);
396 WHEN OTHERS THEN
397 RAISE;
398 hr_utility.set_location(' Leaving:'||l_proc,20);
399 End chk_non_updateable_args;
400 --
401 -- ----------------------------------------------------------------------------
402 -- |----------------------< chk_payment_method_id >---------------------------|
403 -- ----------------------------------------------------------------------------
404 -- {Start Of Comments}
405 --
406 -- Description:
407 --   Check that the personal_payment method id exists in the table
408 --   PAY_PERSONAL_PAYMENT_METHODS_F and is in the same business group
409 --
410 -- Pre Conditions:
411 --
412 -- In Arguments:
413 --   p_payment_method_id
414 --   p_business_group_id
415 -- Post Success:
416 --   Processing continues.
417 --
418 -- Post Failure:
419 --   An application error is raised.
420 --
421 -- {End Of Comments}
422 -- ----------------------------------------------------------------------------
423 PROCEDURE CHK_PAYMENT_METHOD_ID
424 (p_personal_payment_method_id   IN  NUMBER
425 ,p_business_group_id            IN  NUMBER
426 )
427 IS
428 CURSOR csr_get_method_details IS
429 SELECT 1
430 FROM PAY_PERSONAL_PAYMENT_METHODS_F
431 WHERE personal_payment_method_id = p_personal_payment_method_id
432 AND business_group_id = p_business_group_id;
433 --
434 l_temp  VARCHAR2(1) ;
435 --
436 BEGIN
437 OPEN csr_get_method_details;
438 FETCH csr_get_method_details INTO l_temp;
439 IF csr_get_method_details%NOTFOUND THEN
440 CLOSE csr_get_method_details;
441 --
442 -- There isn't a payment_method with the id passed in which is in the
443 -- same business group so error
444 --
445 hr_utility.set_message(800,'HR_52947_INVALID_PPM_ID');
446 hr_utility.raise_error;
447 --
448 END IF;
449 CLOSE csr_get_method_details;
450 END CHK_PAYMENT_METHOD_ID;
451 --
452 -- ----------------------------------------------------------------------------
453 -- |----------------------< chk_processed_asg_id >----------------------------|
454 -- ----------------------------------------------------------------------------
455 -- {Start Of Comments}
456 --
457 -- Description:
458 --   Check that the processed_asg_idexists in the table
459 --   PER_BF_PROCESSED_ASSIGNMENTS
460 --
461 -- Pre Conditions:
462 --
463 -- In Arguments:
464 --   p_processed_assignment_id
465 -- Post Success:
466 --   Processing continues.
467 --
468 -- Post Failure:
469 --   An application error is raised.
470 --
471 -- {End Of Comments}
472 -- ----------------------------------------------------------------------------
473 PROCEDURE chk_processed_asg_id
474  (p_processed_assignment_id  IN NUMBER)
475 IS
476   --
477   CURSOR csr_chk_processed_asg_id IS
478   SELECT 1
479   FROM PER_BF_PROCESSED_ASSIGNMENTS
480   WHERE processed_assignment_id = p_processed_assignment_id;
481   --
482   l_temp   VARCHAR2(1);
483 BEGIN
484   --
485   OPEN csr_chk_processed_asg_id ;
486   FETCH csr_chk_processed_asg_id INTO l_temp;
487   IF csr_chk_processed_asg_id%NOTFOUND THEN
488     --
489     CLOSE csr_chk_processed_asg_id;
490     --
491     -- The ID hasn't been found, so error
492     --
493     hr_utility.set_message(800,'HR_52948_BAD_PROCESSED_ASG_ID');
494     hr_utility.raise_error;
495     --
496   END IF;
497   CLOSE csr_chk_processed_asg_id;
498   --
499 END chk_processed_asg_id;
500 -- ----------------------------------------------------------------------------
501 -- |-------------------------------< chk_check_type >-------------------------|
502 -- ----------------------------------------------------------------------------
503 -- {Start Of Comments}
504 --
505 -- Description:
506 --   If the CHECK_TYPE is not null, check that it is contained in HR_LOOKUPS
507 -- Pre Conditions:
508 --
509 -- In Arguments:
510 --   p_payment_detail_id
511 --   p_object_version_number
512 --   p_check_type
513 --   p_effective_date
514 -- Post Success:
515 --   Processing continues.
516 --
517 -- Post Failure:
518 --   An application error is raised.
519 --
520 -- {End Of Comments}
521 -- ----------------------------------------------------------------------------
522 PROCEDURE chk_check_type
523   (p_payment_detail_id	 	IN NUMBER
524   ,p_object_version_number      IN NUMBER
525   ,p_check_type                 IN VARCHAR2
526   ,p_effective_date             IN DATE)
527 IS
528   --
529   CURSOR csr_check_type IS
530   SELECT start_date_active, end_date_active
531   FROM hr_lookups
532   WHERE lookup_type = 'BACKFEED_PD_CHECK_TYPE'
533     AND  lookup_code = p_check_type;
534   --
535   l_start_date 	DATE;
536   l_end_date 	DATE;
537   --
538   l_api_updating           BOOLEAN;
539 BEGIN
540   --
541   -- Only perform the tests if a check_type exists and we are inserting
542   --
543   l_api_updating := per_bpd_shd.api_updating
544     (p_payment_detail_id => p_payment_detail_id
545     ,p_object_version_number => p_object_version_number);
546   --
547   IF p_check_type IS NOT NULL AND NOT l_api_updating THEN
548     --
549     -- Cursor selects the start and end active dates rather than including them
550     -- as part of the where clause in order to give a more meaningful message.
551     --
552     OPEN csr_check_type;
553     FETCH csr_check_type INTO l_start_date, l_end_date;
554     --
555     IF csr_check_type%NOTFOUND THEN
556       --
557       -- The lookup code entered doesn't exist in hr_lookups
558       -- so error.
559       --
560       hr_utility.set_message(800, 'HR_52949_CT_NOT_EXIST');
561       hr_utility.raise_error;
562       --
563     END IF;
564     --
565     IF p_effective_date not between NVL (l_start_date, hr_api.g_sot)
566 				and NVL (l_end_date, hr_api.g_eot)  THEN
567       --
568       -- The lookup exists, but it isn't valid for the effective date
569       -- so error.
570       --
571       hr_utility.set_message(800,'HR_52351_CT_NOT_VALID');
572       hr_utility.raise_error;
573       --
574     END IF;
575     --
576   END IF;
577 END chk_check_type;
578 -- ----------------------------------------------------------------------------
579 -- ----------------------------< chk_ids_unique >---------------------------
580 -- ----------------------------------------------------------------------------
581 Procedure chk_ids_unique(p_processed_assignment_id     in number,
582                          p_personal_payment_method_id  in number) is
583 --
584 -- Procedure to check that p_processed_assignment_id and
585 -- p_personal_payment_method_id are unique
586 --
587   l_exists varchar2(1);
588   l_proc   varchar2(72):= g_package || 'chk_ids_unique';
589 --
590 -- Cursor to check p_processed_assignment_id and
591 -- p_personal_payment_method are unique
592 --
593 cursor csr_unique_ids is
594   select 'Y'
595   from per_bf_payment_details
596   where processed_assignment_id = p_processed_assignment_id
597   and personal_payment_method_id = p_personal_payment_method_id;
598 --
599 begin
600   hr_utility.set_location('Entering: '||l_proc, 10);
601 --
602   hr_api.mandatory_arg_error(p_api_name   => l_proc
603                     ,p_argument           => 'PROCESSED_ASSIGNMENT_ID'
604                     ,p_argument_value     => p_processed_assignment_id);
605 --
606   hr_api.mandatory_arg_error(p_api_name   => l_proc
607                     ,p_argument           => 'PERSONAL_PAYMENT_METHOD_ID'
608                     ,p_argument_value     => p_personal_payment_method_id);
609 --
610   open csr_unique_ids;
611   fetch csr_unique_ids into l_exists;
612   if csr_unique_ids%FOUND then
613   --ids are not unique - raise error by calling constraint error
614   close csr_unique_ids;
615   per_bpd_shd.constraint_error('PER_BF_PAYMENT_DETAILS_UK1');
616   end if;
617   close csr_unique_ids;
618 --
619 hr_utility.set_location(' Leaving: '||l_proc, 50);
620 --
621 end chk_ids_unique;
622 -- ----------------------------------------------------------------------------
623 -- |---------------------------< insert_validate >----------------------------|
624 -- ----------------------------------------------------------------------------
625 Procedure insert_validate(p_effective_date   in  date,
626                           p_rec in per_bpd_shd.g_rec_type
627                          ) is
628 --
629   l_proc  varchar2(72) := g_package||'insert_validate';
630 --
631 Begin
632   hr_utility.set_location('Entering:'||l_proc, 5);
633   --
634   -- Call all supporting business operations
635   --
636   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
637   --
638   chk_check_type
639   (p_payment_detail_id	 	=> p_rec.payment_detail_id
640   ,p_object_version_number      => p_rec.object_version_number
641   ,p_check_type                 => p_rec.check_type
642   ,p_effective_date             => p_effective_date);
643   --
644   --
645  CHK_PAYMENT_METHOD_ID
646   (p_personal_payment_method_id   => p_rec.personal_payment_method_id
647   ,p_business_group_id            => p_rec.business_group_id
648   );
649   --
650  CHK_PROCESSED_ASG_ID
651  (p_processed_assignment_id  => p_rec.processed_assignment_id);
652   --
653  chk_ids_unique
654  (p_processed_assignment_id     => p_rec.processed_assignment_id
655  ,p_personal_payment_method_id  => p_rec.personal_payment_method_id);
656   --
657   --
658   -- Validate flexfields
659   -- ===================
660   chk_df(p_rec => p_rec);
661   --
662   hr_utility.set_location(' Leaving:'||l_proc, 10);
663 End insert_validate;
664 --
665 -- ----------------------------------------------------------------------------
666 -- |---------------------------< update_validate >----------------------------|
667 -- ----------------------------------------------------------------------------
668 Procedure update_validate(p_effective_date   in  date,
669                           p_rec in per_bpd_shd.g_rec_type
670                          ) is
671 --
672   l_proc  varchar2(72) := g_package||'update_validate';
673 --
674 Begin
675   hr_utility.set_location('Entering:'||l_proc, 5);
676   --
677   -- Call all supporting business operations
678   --
679   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
680   --
681   chk_check_type
682   (p_payment_detail_id	 	=> p_rec.payment_detail_id
683   ,p_object_version_number      => p_rec.object_version_number
684   ,p_check_type                 => p_rec.check_type
685   ,p_effective_date             => p_effective_date);
686   --
687   chk_non_updateable_args
688      (p_rec => p_rec);
689   --
690   -- Validate flexfields
691   -- ===================
692   chk_df(p_rec => p_rec);
693   --
694   hr_utility.set_location(' Leaving:'||l_proc, 10);
695 End update_validate;
696 --
697 -- ----------------------------------------------------------------------------
698 -- |---------------------------< delete_validate >----------------------------|
699 -- ----------------------------------------------------------------------------
700 Procedure delete_validate(p_rec in per_bpd_shd.g_rec_type) is
701 --
702   l_proc  varchar2(72) := g_package||'delete_validate';
703 --
704 Begin
705   hr_utility.set_location('Entering:'||l_proc, 5);
706   --
707   -- Call all supporting business operations
708   --
709   hr_utility.set_location(' Leaving:'||l_proc, 10);
710 End delete_validate;
711 --
712 end per_bpd_bus;