DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PQC_BUS

Source


1 Package Body ben_pqc_bus as
2 /* $Header: bepqcrhi.pkb 120.0.12010000.2 2008/08/05 15:17:32 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_pqc_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_prtt_rmt_rqst_ctfn_prvdd_id number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_prtt_rmt_rqst_ctfn_prvdd_id          in number
22   ) is
23   --
24   -- Declare cursor
25   --
26   cursor csr_sec_grp is
27     select pbg.security_group_id
28       from per_business_groups pbg
29          , ben_prtt_rmt_rqst_ctfn_prvdd_f pqc
30      where pqc.prtt_rmt_rqst_ctfn_prvdd_id = p_prtt_rmt_rqst_ctfn_prvdd_id
31        and pbg.business_group_id = pqc.business_group_id;
32   --
33   -- Declare local variables
34   --
35   l_security_group_id number;
36   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
37   --
38 begin
39   --
40   hr_utility.set_location('Entering:'|| l_proc, 10);
41   --
42   -- Ensure that all the mandatory parameter are not null
43   --
44   hr_api.mandatory_arg_error
45     (p_api_name           => l_proc
46     ,p_argument           => 'prtt_rmt_rqst_ctfn_prvdd_id'
47     ,p_argument_value     => p_prtt_rmt_rqst_ctfn_prvdd_id
48     );
49   --
50   open csr_sec_grp;
51   fetch csr_sec_grp into l_security_group_id;
52   --
53   if csr_sec_grp%notfound then
54      --
55      close csr_sec_grp;
56      --
57      -- The primary key is invalid therefore we must error
58      --
59      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60      fnd_message.raise_error;
61      --
62   end if;
63   close csr_sec_grp;
64   --
65   -- Set the security_group_id in CLIENT_INFO
66   --
67   hr_api.set_security_group_id
68     (p_security_group_id => l_security_group_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 20);
72   --
73 end set_security_group_id;
74 --
75 --  ---------------------------------------------------------------------------
76 --  |---------------------< return_legislation_code >-------------------------|
77 --  ---------------------------------------------------------------------------
78 --
79 Function return_legislation_code
80   (p_prtt_rmt_rqst_ctfn_prvdd_id          in     number
81   )
82   Return Varchar2 Is
83   --
84   -- Declare cursor
85   --
86   cursor csr_leg_code is
87     select pbg.legislation_code
88       from per_business_groups pbg
89          , ben_prtt_rmt_rqst_ctfn_prvdd_f pqc
90      where pqc.prtt_rmt_rqst_ctfn_prvdd_id = p_prtt_rmt_rqst_ctfn_prvdd_id
91        and pbg.business_group_id (+) = pqc.business_group_id;
92   --
93   -- Declare local variables
94   --
95   l_legislation_code  varchar2(150);
96   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
97   --
98 Begin
99   --
100   hr_utility.set_location('Entering:'|| l_proc, 10);
101   --
102   -- Ensure that all the mandatory parameter are not null
103   --
104   hr_api.mandatory_arg_error
105     (p_api_name           => l_proc
106     ,p_argument           => 'prtt_rmt_rqst_ctfn_prvdd_id'
107     ,p_argument_value     => p_prtt_rmt_rqst_ctfn_prvdd_id
108     );
109   --
110   if ( nvl(ben_pqc_bus.g_prtt_rmt_rqst_ctfn_prvdd_id, hr_api.g_number)
111        = p_prtt_rmt_rqst_ctfn_prvdd_id) then
112     --
113     -- The legislation code has already been found with a previous
114     -- call to this function. Just return the value in the global
115     -- variable.
116     --
117     l_legislation_code := ben_pqc_bus.g_legislation_code;
118     hr_utility.set_location(l_proc, 20);
119   else
120     --
121     -- The ID is different to the last call to this function
122     -- or this is the first call to this function.
123     --
124     open csr_leg_code;
125     fetch csr_leg_code into l_legislation_code;
126     --
127     if csr_leg_code%notfound then
128       --
129       -- The primary key is invalid therefore we must error
130       --
131       close csr_leg_code;
132       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133       fnd_message.raise_error;
134     end if;
135     hr_utility.set_location(l_proc,30);
136     --
137     -- Set the global variables so the values are
138     -- available for the next call to this function.
139     --
140     close csr_leg_code;
141     ben_pqc_bus.g_prtt_rmt_rqst_ctfn_prvdd_id := p_prtt_rmt_rqst_ctfn_prvdd_id;
142     ben_pqc_bus.g_legislation_code  := l_legislation_code;
143   end if;
144   hr_utility.set_location(' Leaving:'|| l_proc, 40);
145   return l_legislation_code;
146 end return_legislation_code;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |------------------------------< chk_df >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 --
152 -- Description:
153 --   Validates all the Descriptive Flexfield values.
154 --
155 -- Prerequisites:
156 --   All other columns have been validated.  Must be called as the
157 --   last step from insert_validate and update_validate.
158 --
159 -- In Arguments:
160 --   p_rec
161 --
162 -- Post Success:
163 --   If the Descriptive Flexfield structure column and data values are
164 --   all valid this procedure will end normally and processing will
165 --   continue.
166 --
167 -- Post Failure:
168 --   If the Descriptive Flexfield structure column value or any of
169 --   the data values are invalid then an application error is raised as
170 --   a PL/SQL exception.
171 --
172 -- Access Status:
173 --   Internal Row Handler Use Only.
174 --
175 -- ----------------------------------------------------------------------------
176 procedure chk_df
177   (p_rec in ben_pqc_shd.g_rec_type
178   ) is
179 --
180   l_proc   varchar2(72) := g_package || 'chk_df';
181 --
182 begin
183   hr_utility.set_location('Entering:'||l_proc,10);
184   --
185   if ((p_rec.prtt_rmt_rqst_ctfn_prvdd_id is not null)  and (
186     nvl(ben_pqc_shd.g_old_rec.pqc_attribute_category, hr_api.g_varchar2) <>
187     nvl(p_rec.pqc_attribute_category, hr_api.g_varchar2)  or
188     nvl(ben_pqc_shd.g_old_rec.pqc_attribute1, hr_api.g_varchar2) <>
189     nvl(p_rec.pqc_attribute1, hr_api.g_varchar2)  or
190     nvl(ben_pqc_shd.g_old_rec.pqc_attribute2, hr_api.g_varchar2) <>
191     nvl(p_rec.pqc_attribute2, hr_api.g_varchar2)  or
192     nvl(ben_pqc_shd.g_old_rec.pqc_attribute3, hr_api.g_varchar2) <>
193     nvl(p_rec.pqc_attribute3, hr_api.g_varchar2)  or
194     nvl(ben_pqc_shd.g_old_rec.pqc_attribute4, hr_api.g_varchar2) <>
195     nvl(p_rec.pqc_attribute4, hr_api.g_varchar2)  or
196     nvl(ben_pqc_shd.g_old_rec.pqc_attribute5, hr_api.g_varchar2) <>
197     nvl(p_rec.pqc_attribute5, hr_api.g_varchar2)  or
198     nvl(ben_pqc_shd.g_old_rec.pqc_attribute6, hr_api.g_varchar2) <>
199     nvl(p_rec.pqc_attribute6, hr_api.g_varchar2)  or
200     nvl(ben_pqc_shd.g_old_rec.pqc_attribute7, hr_api.g_varchar2) <>
201     nvl(p_rec.pqc_attribute7, hr_api.g_varchar2)  or
202     nvl(ben_pqc_shd.g_old_rec.pqc_attribute8, hr_api.g_varchar2) <>
203     nvl(p_rec.pqc_attribute8, hr_api.g_varchar2)  or
204     nvl(ben_pqc_shd.g_old_rec.pqc_attribute9, hr_api.g_varchar2) <>
205     nvl(p_rec.pqc_attribute9, hr_api.g_varchar2)  or
206     nvl(ben_pqc_shd.g_old_rec.pqc_attribute10, hr_api.g_varchar2) <>
207     nvl(p_rec.pqc_attribute10, hr_api.g_varchar2)  or
208     nvl(ben_pqc_shd.g_old_rec.pqc_attribute11, hr_api.g_varchar2) <>
209     nvl(p_rec.pqc_attribute11, hr_api.g_varchar2)  or
210     nvl(ben_pqc_shd.g_old_rec.pqc_attribute12, hr_api.g_varchar2) <>
211     nvl(p_rec.pqc_attribute12, hr_api.g_varchar2)  or
212     nvl(ben_pqc_shd.g_old_rec.pqc_attribute13, hr_api.g_varchar2) <>
213     nvl(p_rec.pqc_attribute13, hr_api.g_varchar2)  or
214     nvl(ben_pqc_shd.g_old_rec.pqc_attribute14, hr_api.g_varchar2) <>
215     nvl(p_rec.pqc_attribute14, hr_api.g_varchar2)  or
216     nvl(ben_pqc_shd.g_old_rec.pqc_attribute15, hr_api.g_varchar2) <>
217     nvl(p_rec.pqc_attribute15, hr_api.g_varchar2)  or
218     nvl(ben_pqc_shd.g_old_rec.pqc_attribute16, hr_api.g_varchar2) <>
219     nvl(p_rec.pqc_attribute16, hr_api.g_varchar2)  or
220     nvl(ben_pqc_shd.g_old_rec.pqc_attribute17, hr_api.g_varchar2) <>
221     nvl(p_rec.pqc_attribute17, hr_api.g_varchar2)  or
222     nvl(ben_pqc_shd.g_old_rec.pqc_attribute18, hr_api.g_varchar2) <>
223     nvl(p_rec.pqc_attribute18, hr_api.g_varchar2)  or
224     nvl(ben_pqc_shd.g_old_rec.pqc_attribute19, hr_api.g_varchar2) <>
225     nvl(p_rec.pqc_attribute19, hr_api.g_varchar2)  or
226     nvl(ben_pqc_shd.g_old_rec.pqc_attribute20, hr_api.g_varchar2) <>
227     nvl(p_rec.pqc_attribute20, hr_api.g_varchar2)  or
228     nvl(ben_pqc_shd.g_old_rec.pqc_attribute21, hr_api.g_varchar2) <>
229     nvl(p_rec.pqc_attribute21, hr_api.g_varchar2)  or
230     nvl(ben_pqc_shd.g_old_rec.pqc_attribute22, hr_api.g_varchar2) <>
231     nvl(p_rec.pqc_attribute22, hr_api.g_varchar2)  or
232     nvl(ben_pqc_shd.g_old_rec.pqc_attribute23, hr_api.g_varchar2) <>
233     nvl(p_rec.pqc_attribute23, hr_api.g_varchar2)  or
234     nvl(ben_pqc_shd.g_old_rec.pqc_attribute24, hr_api.g_varchar2) <>
235     nvl(p_rec.pqc_attribute24, hr_api.g_varchar2)  or
236     nvl(ben_pqc_shd.g_old_rec.pqc_attribute25, hr_api.g_varchar2) <>
237     nvl(p_rec.pqc_attribute25, hr_api.g_varchar2)  or
238     nvl(ben_pqc_shd.g_old_rec.pqc_attribute26, hr_api.g_varchar2) <>
239     nvl(p_rec.pqc_attribute26, hr_api.g_varchar2)  or
240     nvl(ben_pqc_shd.g_old_rec.pqc_attribute27, hr_api.g_varchar2) <>
241     nvl(p_rec.pqc_attribute27, hr_api.g_varchar2)  or
242     nvl(ben_pqc_shd.g_old_rec.pqc_attribute28, hr_api.g_varchar2) <>
243     nvl(p_rec.pqc_attribute28, hr_api.g_varchar2)  or
244     nvl(ben_pqc_shd.g_old_rec.pqc_attribute29, hr_api.g_varchar2) <>
245     nvl(p_rec.pqc_attribute29, hr_api.g_varchar2)  or
246     nvl(ben_pqc_shd.g_old_rec.pqc_attribute30, hr_api.g_varchar2) <>
247     nvl(p_rec.pqc_attribute30, hr_api.g_varchar2) ))
248     or (p_rec.prtt_rmt_rqst_ctfn_prvdd_id is null)  then
249     --
250     -- Only execute the validation if absolutely necessary:
251     -- a) During update, the structure column value or any
252     --    of the attribute values have actually changed.
253     -- b) During insert.
254     /*
255     --
256     hr_dflex_utility.ins_or_upd_descflex_attribs
257       (p_appl_short_name                 => 'BEN'
258       ,p_descflex_name                   => 'EDIT_HERE: Enter descflex name'
259       ,p_attribute_category              => 'PQC_ATTRIBUTE_CATEGORY'
260       ,p_attribute1_name                 => 'PQC_ATTRIBUTE1'
261       ,p_attribute1_value                => p_rec.pqc_attribute1
262       ,p_attribute2_name                 => 'PQC_ATTRIBUTE2'
263       ,p_attribute2_value                => p_rec.pqc_attribute2
264       ,p_attribute3_name                 => 'PQC_ATTRIBUTE3'
265       ,p_attribute3_value                => p_rec.pqc_attribute3
266       ,p_attribute4_name                 => 'PQC_ATTRIBUTE4'
267       ,p_attribute4_value                => p_rec.pqc_attribute4
268       ,p_attribute5_name                 => 'PQC_ATTRIBUTE5'
269       ,p_attribute5_value                => p_rec.pqc_attribute5
270       ,p_attribute6_name                 => 'PQC_ATTRIBUTE6'
271       ,p_attribute6_value                => p_rec.pqc_attribute6
272       ,p_attribute7_name                 => 'PQC_ATTRIBUTE7'
273       ,p_attribute7_value                => p_rec.pqc_attribute7
274       ,p_attribute8_name                 => 'PQC_ATTRIBUTE8'
275       ,p_attribute8_value                => p_rec.pqc_attribute8
276       ,p_attribute9_name                 => 'PQC_ATTRIBUTE9'
277       ,p_attribute9_value                => p_rec.pqc_attribute9
278       ,p_attribute10_name                => 'PQC_ATTRIBUTE10'
279       ,p_attribute10_value               => p_rec.pqc_attribute10
280       ,p_attribute11_name                => 'PQC_ATTRIBUTE11'
281       ,p_attribute11_value               => p_rec.pqc_attribute11
282       ,p_attribute12_name                => 'PQC_ATTRIBUTE12'
283       ,p_attribute12_value               => p_rec.pqc_attribute12
284       ,p_attribute13_name                => 'PQC_ATTRIBUTE13'
285       ,p_attribute13_value               => p_rec.pqc_attribute13
286       ,p_attribute14_name                => 'PQC_ATTRIBUTE14'
287       ,p_attribute14_value               => p_rec.pqc_attribute14
288       ,p_attribute15_name                => 'PQC_ATTRIBUTE15'
289       ,p_attribute15_value               => p_rec.pqc_attribute15
290       ,p_attribute16_name                => 'PQC_ATTRIBUTE16'
291       ,p_attribute16_value               => p_rec.pqc_attribute16
292       ,p_attribute17_name                => 'PQC_ATTRIBUTE17'
293       ,p_attribute17_value               => p_rec.pqc_attribute17
294       ,p_attribute18_name                => 'PQC_ATTRIBUTE18'
295       ,p_attribute18_value               => p_rec.pqc_attribute18
296       ,p_attribute19_name                => 'PQC_ATTRIBUTE19'
297       ,p_attribute19_value               => p_rec.pqc_attribute19
298       ,p_attribute20_name                => 'PQC_ATTRIBUTE20'
299       ,p_attribute20_value               => p_rec.pqc_attribute20
300       ,p_attribute21_name                => 'PQC_ATTRIBUTE21'
301       ,p_attribute21_value               => p_rec.pqc_attribute21
302       ,p_attribute22_name                => 'PQC_ATTRIBUTE22'
303       ,p_attribute22_value               => p_rec.pqc_attribute22
304       ,p_attribute23_name                => 'PQC_ATTRIBUTE23'
305       ,p_attribute23_value               => p_rec.pqc_attribute23
306       ,p_attribute24_name                => 'PQC_ATTRIBUTE24'
307       ,p_attribute24_value               => p_rec.pqc_attribute24
308       ,p_attribute25_name                => 'PQC_ATTRIBUTE25'
309       ,p_attribute25_value               => p_rec.pqc_attribute25
310       ,p_attribute26_name                => 'PQC_ATTRIBUTE26'
311       ,p_attribute26_value               => p_rec.pqc_attribute26
312       ,p_attribute27_name                => 'PQC_ATTRIBUTE27'
313       ,p_attribute27_value               => p_rec.pqc_attribute27
314       ,p_attribute28_name                => 'PQC_ATTRIBUTE28'
315       ,p_attribute28_value               => p_rec.pqc_attribute28
316       ,p_attribute29_name                => 'PQC_ATTRIBUTE29'
317       ,p_attribute29_value               => p_rec.pqc_attribute29
318       ,p_attribute30_name                => 'PQC_ATTRIBUTE30'
319       ,p_attribute30_value               => p_rec.pqc_attribute30
320       );
321   */
322   null ;
323   end if;
324   --
325   hr_utility.set_location(' Leaving:'||l_proc,20);
326 end chk_df;
327 --
328 -- ----------------------------------------------------------------------------
329 -- |-----------------------< chk_non_updateable_args >------------------------|
330 -- ----------------------------------------------------------------------------
331 -- {Start Of Comments}
332 --
333 -- Description:
334 --   This procedure is used to ensure that non updateable attributes have
335 --   not been updated. If an attribute has been updated an error is generated.
336 --
337 -- Pre Conditions:
338 --   g_old_rec has been populated with details of the values currently in
339 --   the database.
340 --
341 -- In Arguments:
342 --   p_rec has been populated with the updated values the user would like the
343 --   record set to.
344 --
345 -- Post Success:
346 --   Processing continues if all the non updateable attributes have not
347 --   changed.
348 --
349 -- Post Failure:
350 --   An application error is raised if any of the non updatable attributes
354 -- ----------------------------------------------------------------------------
351 --   have been altered.
352 --
353 -- {End Of Comments}
355 Procedure chk_non_updateable_args
356   (p_effective_date  in date
357   ,p_rec             in ben_pqc_shd.g_rec_type
358   ) IS
359 --
360   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
361   l_error    EXCEPTION;
362   l_argument varchar2(30);
363 --
364 Begin
365   --
366   -- Only proceed with the validation if a row exists for the current
367   -- record in the HR Schema.
368   --
369   IF NOT ben_pqc_shd.api_updating
370       (p_prtt_rmt_rqst_ctfn_prvdd_id      => p_rec.prtt_rmt_rqst_ctfn_prvdd_id
371       ,p_effective_date                   => p_effective_date
372       ,p_object_version_number            => p_rec.object_version_number
373       ) THEN
374      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
375      fnd_message.set_token('PROCEDURE ', l_proc);
376      fnd_message.set_token('STEP ', '5');
377      fnd_message.raise_error;
378   END IF;
379   --
380   -- EDIT_HERE: Add checks to ensure non-updateable args have
381   --            not been updated.
382   --
383   EXCEPTION
384     WHEN l_error THEN
385        hr_api.argument_changed_error
386          (p_api_name => l_proc
387          ,p_argument => l_argument);
388     WHEN OTHERS THEN
389        RAISE;
390 End chk_non_updateable_args;
391 --
392 -- ----------------------------------------------------------------------------
393 -- |--------------------------< dt_update_validate >--------------------------|
394 -- ----------------------------------------------------------------------------
395 -- {Start Of Comments}
396 --
397 -- Description:
398 --   This procedure is used for referential integrity of datetracked
399 --   parent entities when a datetrack update operation is taking place
400 --   and where there is no cascading of update defined for this entity.
401 --
402 -- Prerequisites:
403 --   This procedure is called from the update_validate.
404 --
405 -- In Parameters:
406 --
407 -- Post Success:
408 --   Processing continues.
409 --
410 -- Post Failure:
411 --
412 -- Developer Implementation Notes:
413 --   This procedure should not need maintenance unless the HR Schema model
414 --   changes.
415 --
416 -- Access Status:
417 --   Internal Row Handler Use Only.
418 --
419 -- {End Of Comments}
420 -- ----------------------------------------------------------------------------
421 Procedure dt_update_validate
422   (p_pl_gd_r_svc_ctfn_id           in number default hr_api.g_number
423   ,p_prtt_enrt_actn_id             in number default hr_api.g_number
424   ,p_datetrack_mode                in varchar2
425   ,p_validation_start_date         in date
426   ,p_validation_end_date           in date
427   ) Is
428 --
429   l_proc  varchar2(72) := g_package||'dt_update_validate';
430   l_integrity_error Exception;
431   l_table_name      all_tables.table_name%TYPE;
432 --
433 Begin
434   --
435   -- Ensure that the p_datetrack_mode argument is not null
436   --
437   hr_api.mandatory_arg_error
438     (p_api_name       => l_proc
439     ,p_argument       => 'datetrack_mode'
440     ,p_argument_value => p_datetrack_mode
441     );
442   --
443   -- Mode will be valid, as this is checked at the start of the upd.
444   --
445   -- Ensure the arguments are not null
446   --
447   hr_api.mandatory_arg_error
448     (p_api_name       => l_proc
449     ,p_argument       => 'validation_start_date'
450     ,p_argument_value => p_validation_start_date
451     );
452   --
453   hr_api.mandatory_arg_error
454     (p_api_name       => l_proc
455     ,p_argument       => 'validation_end_date'
456     ,p_argument_value => p_validation_end_date
457     );
458   --
459   If ((nvl(p_pl_gd_r_svc_ctfn_id, hr_api.g_number) <> hr_api.g_number) and
460       NOT (dt_api.check_min_max_dates
461             (p_base_table_name => 'ben_pl_gd_r_svc_ctfn_f'
462             ,p_base_key_column => 'PL_GD_R_SVC_CTFN_ID'
463             ,p_base_key_value  => p_pl_gd_r_svc_ctfn_id
464             ,p_from_date       => p_validation_start_date
465             ,p_to_date         => p_validation_end_date))) Then
466      l_table_name := 'pl gd r svc ctfn';
467      raise l_integrity_error;
468   End If;
469   If ((nvl(p_prtt_enrt_actn_id, hr_api.g_number) <> hr_api.g_number) and
470       NOT (dt_api.check_min_max_dates
471             (p_base_table_name => 'ben_prtt_enrt_actn_f'
472             ,p_base_key_column => 'PRTT_ENRT_ACTN_ID'
473             ,p_base_key_value  => p_prtt_enrt_actn_id
474             ,p_from_date       => p_validation_start_date
475             ,p_to_date         => p_validation_end_date))) Then
476      l_table_name := 'prtt enrt actn';
477      raise l_integrity_error;
478   End If;
479   --
480 Exception
481   When l_integrity_error Then
482     --
483     -- A referential integrity check was violated therefore
484     -- we must error
485     --
486     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
487     fnd_message.set_token('TABLE_NAME', l_table_name);
488     fnd_message.raise_error;
489   When Others Then
490     --
491     -- An unhandled or unexpected error has occurred which
492     -- we must report
493     --
497     fnd_message.raise_error;
494     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
495     fnd_message.set_token('PROCEDURE', l_proc);
496     fnd_message.set_token('STEP','15');
498 End dt_update_validate;
499 --
500 -- ----------------------------------------------------------------------------
501 -- |--------------------------< dt_delete_validate >--------------------------|
502 -- ----------------------------------------------------------------------------
503 -- {Start Of Comments}
504 --
505 -- Description:
506 --   This procedure is used for referential integrity of datetracked
507 --   child entities when either a datetrack DELETE or ZAP is in operation
508 --   and where there is no cascading of delete defined for this entity.
509 --   For the datetrack mode of DELETE or ZAP we must ensure that no
510 --   datetracked child rows exist between the validation start and end
511 --   dates.
512 --
513 -- Prerequisites:
514 --   This procedure is called from the delete_validate.
515 --
516 -- In Parameters:
517 --
518 -- Post Success:
519 --   Processing continues.
520 --
521 -- Post Failure:
522 --   If a row exists by determining the returning Boolean value from the
523 --   generic dt_api.rows_exist function then we must supply an error via
524 --   the use of the local exception handler l_rows_exist.
525 --
526 -- Developer Implementation Notes:
527 --   This procedure should not need maintenance unless the HR Schema model
528 --   changes.
529 --
530 -- Access Status:
531 --   Internal Row Handler Use Only.
532 --
533 -- {End Of Comments}
534 -- ----------------------------------------------------------------------------
535 Procedure dt_delete_validate
536   (p_prtt_rmt_rqst_ctfn_prvdd_id      in number
537   ,p_datetrack_mode                   in varchar2
538   ,p_validation_start_date            in date
539   ,p_validation_end_date              in date
540   ) Is
541 --
542   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
543   l_rows_exist  Exception;
544   l_table_name  all_tables.table_name%TYPE;
545 --
546 Begin
547   --
548   -- Ensure that the p_datetrack_mode argument is not null
549   --
550   hr_api.mandatory_arg_error
551     (p_api_name       => l_proc
552     ,p_argument       => 'datetrack_mode'
553     ,p_argument_value => p_datetrack_mode
554     );
555   --
556   -- Only perform the validation if the datetrack mode is either
557   -- DELETE or ZAP
558   --
559   If (p_datetrack_mode = hr_api.g_delete or
560       p_datetrack_mode = hr_api.g_zap) then
561     --
562     --
563     -- Ensure the arguments are not null
564     --
565     hr_api.mandatory_arg_error
566       (p_api_name       => l_proc
567       ,p_argument       => 'validation_start_date'
568       ,p_argument_value => p_validation_start_date
569       );
570     --
571     hr_api.mandatory_arg_error
572       (p_api_name       => l_proc
573       ,p_argument       => 'validation_end_date'
574       ,p_argument_value => p_validation_end_date
575       );
576     --
577     hr_api.mandatory_arg_error
578       (p_api_name       => l_proc
579       ,p_argument       => 'prtt_rmt_rqst_ctfn_prvdd_id'
580       ,p_argument_value => p_prtt_rmt_rqst_ctfn_prvdd_id
581       );
582     --
583   --
584     --
585   End If;
586   --
587 Exception
588   When l_rows_exist Then
589     --
590     -- A referential integrity check was violated therefore
591     -- we must error
592     --
593     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
594     fnd_message.set_token('TABLE_NAME', l_table_name);
595     fnd_message.raise_error;
596   When Others Then
597     --
598     -- An unhandled or unexpected error has occurred which
599     -- we must report
600     --
601     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
602     fnd_message.set_token('PROCEDURE', l_proc);
603     fnd_message.set_token('STEP','15');
604     fnd_message.raise_error;
605   --
606 End dt_delete_validate;
607 --
608 -- ----------------------------------------------------------------------------
609 -- |---------------------------< insert_validate >----------------------------|
610 -- ----------------------------------------------------------------------------
611 Procedure insert_validate
612   (p_rec                   in ben_pqc_shd.g_rec_type
613   ,p_effective_date        in date
614   ,p_datetrack_mode        in varchar2
615   ,p_validation_start_date in date
616   ,p_validation_end_date   in date
617   ) is
618 --
619   l_proc        varchar2(72) := g_package||'insert_validate';
620 --
621 Begin
622   hr_utility.set_location('Entering:'||l_proc, 5);
623   --
624   -- Call all supporting business operations
625   --
626   -- EDIT_HERE: The following call to hr_api.validate_bus_grp_id
627   -- will only be valid when the business_group_id is not null.
628   -- As this column is defined as optional on the table then
629   -- different logic will be required to handle the null case.
630   -- If this is a start-up data entity then:
631   --    a) add code to stop null values being processed by this
632   --       row handler
633   -- If this is not a start-up data entity then either:
634   --    b) ignore the security_group_id value held in
635   --       client_info.  This includes performing lookup
636   --       validation against the HR_STANDARD_LOOKUPS view.
637   -- or c) (less likely) ensure the correct security_group_id
638   --       value is set in client_info.
639   -- Remove this comment when the edit has been completed.
640   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
641   --
642   --
643   ben_pqc_bus.chk_df(p_rec);
644   --
645   hr_utility.set_location(' Leaving:'||l_proc, 10);
646 End insert_validate;
647 --
648 -- ----------------------------------------------------------------------------
649 -- |---------------------------< update_validate >----------------------------|
650 -- ----------------------------------------------------------------------------
651 Procedure update_validate
652   (p_rec                     in ben_pqc_shd.g_rec_type
653   ,p_effective_date          in date
654   ,p_datetrack_mode          in varchar2
655   ,p_validation_start_date   in date
656   ,p_validation_end_date     in date
657   ) is
658 --
659   l_proc        varchar2(72) := g_package||'update_validate';
660 --
661 Begin
662   hr_utility.set_location('Entering:'||l_proc, 5);
663   --
664   -- Call all supporting business operations
665   --
666   -- EDIT_HERE: The following call to hr_api.validate_bus_grp_id
667   -- will only be valid when the business_group_id is not null.
668   -- As this column is defined as optional on the table then
669   -- different logic will be required to handle the null case.
670   -- If this is a start-up data entity then:
671   --    a) add code to stop null values being processed by this
672   --       row handler
673   -- If this is not a start-up data entity then either:
674   --    b) ignore the security_group_id value held in
675   --       client_info.  This includes performing lookup
676   --       validation against the HR_STANDARD_LOOKUPS view.
677   -- or c) (less likely) ensure the correct security_group_id
678   --       value is set in client_info.
679   -- Remove this comment when the edit has been completed.
680   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
681   --
682   -- Call the datetrack update integrity operation
683   --
684   dt_update_validate
685     (p_pl_gd_r_svc_ctfn_id            => p_rec.pl_gd_r_svc_ctfn_id
686     ,p_prtt_enrt_actn_id              => p_rec.prtt_enrt_actn_id
687     ,p_datetrack_mode                 => p_datetrack_mode
688     ,p_validation_start_date          => p_validation_start_date
689     ,p_validation_end_date            => p_validation_end_date
690     );
691   --
692   chk_non_updateable_args
693     (p_effective_date  => p_effective_date
694     ,p_rec             => p_rec
695     );
696   --
697   --
698   ben_pqc_bus.chk_df(p_rec);
699   --
700   hr_utility.set_location(' Leaving:'||l_proc, 10);
701 End update_validate;
702 --
703 -- ----------------------------------------------------------------------------
704 -- |---------------------------< delete_validate >----------------------------|
705 -- ----------------------------------------------------------------------------
706 Procedure delete_validate
707   (p_rec                    in ben_pqc_shd.g_rec_type
708   ,p_effective_date         in date
709   ,p_datetrack_mode         in varchar2
710   ,p_validation_start_date  in date
711   ,p_validation_end_date    in date
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   dt_delete_validate
722     (p_datetrack_mode                   => p_datetrack_mode
723     ,p_validation_start_date            => p_validation_start_date
724     ,p_validation_end_date              => p_validation_end_date
725     ,p_prtt_rmt_rqst_ctfn_prvdd_id      => p_rec.prtt_rmt_rqst_ctfn_prvdd_id
726     );
727   --
728   hr_utility.set_location(' Leaving:'||l_proc, 10);
729 End delete_validate;
730 --
731 end ben_pqc_bus;