DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CPD_SHD

Source


1 Package Body pqh_cpd_shd as
2 /* $Header: pqcpdrhi.pkb 120.0 2005/05/29 01:44:39 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_cpd_shd.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 Begin
17   --
18   Return (nvl(g_api_dml, false));
19   --
20 End return_api_dml_status;
21 --
22 -- ----------------------------------------------------------------------------
23 -- |---------------------------< constraint_error >---------------------------|
24 -- ----------------------------------------------------------------------------
25 Procedure constraint_error
26   (p_constraint_name in all_constraints.constraint_name%TYPE
27   ) Is
28 --
29   l_proc        varchar2(72) := g_package||'constraint_error';
30 --
31 Begin
32   --
33   If (p_constraint_name = 'PQH_CORPS_DEFINITIONS_PK') Then
34     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
35     fnd_message.set_token('PROCEDURE', l_proc);
36     fnd_message.set_token('STEP','5');
37     fnd_message.raise_error;
38   Else
39     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
40     fnd_message.set_token('PROCEDURE', l_proc);
41     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
42     fnd_message.raise_error;
43   End If;
44   --
45 End constraint_error;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |-----------------------------< api_updating >-----------------------------|
49 -- ----------------------------------------------------------------------------
50 Function api_updating
51   (p_corps_definition_id                  in     number
52   ,p_object_version_number                in     number
53   )
54   Return Boolean Is
55   --
56   --
57   -- Cursor selects the 'current' row from the HR Schema
58   --
59   Cursor C_Sel1 is
60     select
61        corps_definition_id
62       ,business_group_id
63       ,name
64       ,status_cd
65       ,retirement_age
66       ,category_cd
67       ,recruitment_end_date
68       ,corps_type_cd
69       ,starting_grade_step_id
70       ,task_desc
71       ,secondment_threshold
75       ,minimum_hours_frequency
72       ,normal_hours
73       ,normal_hours_frequency
74       ,minimum_hours
76       ,attribute1
77       ,attribute2
78       ,attribute3
79       ,attribute4
80       ,attribute5
81       ,attribute6
82       ,attribute7
83       ,attribute8
84       ,attribute9
85       ,attribute10
86       ,attribute11
87       ,attribute12
88       ,attribute13
89       ,attribute14
90       ,attribute15
91       ,attribute16
92       ,attribute17
93       ,attribute18
94       ,attribute19
95       ,attribute20
96       ,attribute21
97       ,attribute22
98       ,attribute23
99       ,attribute24
100       ,attribute25
101       ,attribute26
102       ,attribute27
103       ,attribute28
104       ,attribute29
105       ,attribute30
106       ,attribute_category
107       ,object_version_number
108       ,type_of_ps
109       ,date_from
110       ,date_to
111       ,primary_prof_field_id
112       ,starting_grade_id
113       ,ben_pgm_id
114       ,probation_period
115       ,probation_units
116     from        pqh_corps_definitions
117     where       corps_definition_id = p_corps_definition_id;
118   --
119   l_fct_ret     boolean;
120   --
121 Begin
122   --
123   If (p_corps_definition_id is null and
124       p_object_version_number is null
125      ) Then
126     --
127     -- One of the primary key arguments is null therefore we must
128     -- set the returning function value to false
129     --
130     l_fct_ret := false;
131   Else
132     If (p_corps_definition_id
133         = pqh_cpd_shd.g_old_rec.corps_definition_id and
134         p_object_version_number
135         = pqh_cpd_shd.g_old_rec.object_version_number
136        ) Then
137       --
138       -- The g_old_rec is current therefore we must
139       -- set the returning function to true
140       --
141       l_fct_ret := true;
142     Else
143       --
144       -- Select the current row into g_old_rec
145       --
146       Open C_Sel1;
147       Fetch C_Sel1 Into pqh_cpd_shd.g_old_rec;
148       If C_Sel1%notfound Then
149         Close C_Sel1;
150         --
151         -- The primary key is invalid therefore we must error
152         --
153         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
154         fnd_message.raise_error;
155       End If;
156       Close C_Sel1;
157       If (p_object_version_number
158           <> pqh_cpd_shd.g_old_rec.object_version_number) Then
159         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
160         fnd_message.raise_error;
161       End If;
162       l_fct_ret := true;
163     End If;
164   End If;
165   Return (l_fct_ret);
166 --
167 End api_updating;
168 --
169 -- ----------------------------------------------------------------------------
170 -- |---------------------------------< lck >----------------------------------|
171 -- ----------------------------------------------------------------------------
172 Procedure lck
173   (p_corps_definition_id                  in     number
174   ,p_object_version_number                in     number
175   ) is
176 --
177 -- Cursor selects the 'current' row from the HR Schema
178 --
179   Cursor C_Sel1 is
180     select
181        corps_definition_id
182       ,business_group_id
183       ,name
184       ,status_cd
185       ,retirement_age
186       ,category_cd
187       ,recruitment_end_date
188       ,corps_type_cd
189       ,starting_grade_step_id
190       ,task_desc
191       ,secondment_threshold
192       ,normal_hours
193       ,normal_hours_frequency
194       ,minimum_hours
195       ,minimum_hours_frequency
196       ,attribute1
197       ,attribute2
198       ,attribute3
199       ,attribute4
200       ,attribute5
201       ,attribute6
202       ,attribute7
203       ,attribute8
204       ,attribute9
205       ,attribute10
206       ,attribute11
207       ,attribute12
208       ,attribute13
209       ,attribute14
210       ,attribute15
211       ,attribute16
212       ,attribute17
213       ,attribute18
214       ,attribute19
215       ,attribute20
216       ,attribute21
217       ,attribute22
218       ,attribute23
219       ,attribute24
220       ,attribute25
221       ,attribute26
222       ,attribute27
223       ,attribute28
224       ,attribute29
225       ,attribute30
226       ,attribute_category
227       ,object_version_number
228       ,type_of_ps
229       ,date_from
230       ,date_to
231       ,primary_prof_field_id
232       ,starting_grade_id
233       ,ben_pgm_id
234       ,probation_period
235       ,probation_units
236     from        pqh_corps_definitions
237     where       corps_definition_id = p_corps_definition_id
238     for update nowait;
239 --
240   l_proc        varchar2(72) ;
241 --
242 Begin
243   g_debug := hr_utility.debug_enabled;
244   if g_debug then
245     l_proc := g_package||'lck';
246     hr_utility.set_location('Entering:'||l_proc, 5);
247   end if;
248   --
249   hr_api.mandatory_arg_error
250     (p_api_name           => l_proc
251     ,p_argument           => 'CORPS_DEFINITION_ID'
255     hr_utility.set_location(l_proc,6);
252     ,p_argument_value     => p_corps_definition_id
253     );
254   if g_debug then
256   end if;
257   hr_api.mandatory_arg_error
258     (p_api_name           => l_proc
259     ,p_argument           => 'OBJECT_VERSION_NUMBER'
260     ,p_argument_value     => p_object_version_number
261     );
262   --
263   Open  C_Sel1;
264   Fetch C_Sel1 Into pqh_cpd_shd.g_old_rec;
265   If C_Sel1%notfound then
266     Close C_Sel1;
267     --
268     -- The primary key is invalid therefore we must error
269     --
270     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
271     fnd_message.raise_error;
272   End If;
273   Close C_Sel1;
274   If (p_object_version_number
275       <> pqh_cpd_shd.g_old_rec.object_version_number) Then
276         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
277         fnd_message.raise_error;
278   End If;
279   --
280   if g_debug then
281     hr_utility.set_location(' Leaving:'||l_proc, 10);
282   end if;
283   --
284   -- We need to trap the ORA LOCK exception
285   --
286 Exception
287   When HR_Api.Object_Locked then
288     --
289     -- The object is locked therefore we need to supply a meaningful
290     -- error message.
291     --
292     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
293     fnd_message.set_token('TABLE_NAME', 'pqh_corps_definitions');
294     fnd_message.raise_error;
295 End lck;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |-----------------------------< convert_args >-----------------------------|
299 -- ----------------------------------------------------------------------------
300 Function convert_args
301   (p_corps_definition_id            in number
302   ,p_business_group_id              in number
303   ,p_name                           in varchar2
304   ,p_status_cd                      in varchar2
305   ,p_retirement_age                 in number
306   ,p_category_cd                    in varchar2
307   ,p_recruitment_end_date           in date
308   ,p_corps_type_cd                  in varchar2
309   ,p_starting_grade_step_id         in number
310   ,p_task_desc                      in varchar2
311   ,p_secondment_threshold           in number
312   ,p_normal_hours                   in number
313   ,p_normal_hours_frequency         in varchar2
314   ,p_minimum_hours                  in number
315   ,p_minimum_hours_frequency        in varchar2
316   ,p_attribute1                     in varchar2
317   ,p_attribute2                     in varchar2
318   ,p_attribute3                     in varchar2
319   ,p_attribute4                     in varchar2
320   ,p_attribute5                     in varchar2
321   ,p_attribute6                     in varchar2
322   ,p_attribute7                     in varchar2
323   ,p_attribute8                     in varchar2
324   ,p_attribute9                     in varchar2
325   ,p_attribute10                    in varchar2
326   ,p_attribute11                    in varchar2
327   ,p_attribute12                    in varchar2
328   ,p_attribute13                    in varchar2
329   ,p_attribute14                    in varchar2
330   ,p_attribute15                    in varchar2
331   ,p_attribute16                    in varchar2
332   ,p_attribute17                    in varchar2
333   ,p_attribute18                    in varchar2
334   ,p_attribute19                    in varchar2
335   ,p_attribute20                    in varchar2
336   ,p_attribute21                    in varchar2
337   ,p_attribute22                    in varchar2
338   ,p_attribute23                    in varchar2
339   ,p_attribute24                    in varchar2
340   ,p_attribute25                    in varchar2
341   ,p_attribute26                    in varchar2
342   ,p_attribute27                    in varchar2
343   ,p_attribute28                    in varchar2
344   ,p_attribute29                    in varchar2
345   ,p_attribute30                    in varchar2
346   ,p_attribute_category             in varchar2
347   ,p_object_version_number          in number
348   ,p_type_of_ps                     in varchar2
349   ,p_date_from                      in date
350   ,p_date_to                        in date
351   ,p_primary_prof_field_id          in number
352   ,p_starting_grade_id              in number
353   ,p_ben_pgm_id                     in number
354   ,p_probation_period               in number
355   ,p_probation_units                in varchar2
356   )
357   Return g_rec_type is
358 --
359   l_rec   g_rec_type;
360 --
361 Begin
362   --
363   -- Convert arguments into local l_rec structure.
364   --
365   l_rec.corps_definition_id              := p_corps_definition_id;
366   l_rec.business_group_id                := p_business_group_id;
367   l_rec.name                             := p_name;
368   l_rec.status_cd                        := p_status_cd;
369   l_rec.retirement_age                   := p_retirement_age;
370   l_rec.category_cd                      := p_category_cd;
371   l_rec.recruitment_end_date             := p_recruitment_end_date;
372   l_rec.corps_type_cd                    := p_corps_type_cd;
373   l_rec.starting_grade_step_id           := p_starting_grade_step_id;
374   l_rec.task_desc                        := p_task_desc;
375   l_rec.secondment_threshold             := p_secondment_threshold;
376   l_rec.normal_hours                     := p_normal_hours;
377   l_rec.normal_hours_frequency           := p_normal_hours_frequency;
378   l_rec.minimum_hours                    := p_minimum_hours;
379   l_rec.minimum_hours_frequency          := p_minimum_hours_frequency;
380   l_rec.attribute1                       := p_attribute1;
381   l_rec.attribute2                       := p_attribute2;
382   l_rec.attribute3                       := p_attribute3;
383   l_rec.attribute4                       := p_attribute4;
384   l_rec.attribute5                       := p_attribute5;
385   l_rec.attribute6                       := p_attribute6;
386   l_rec.attribute7                       := p_attribute7;
387   l_rec.attribute8                       := p_attribute8;
388   l_rec.attribute9                       := p_attribute9;
389   l_rec.attribute10                      := p_attribute10;
390   l_rec.attribute11                      := p_attribute11;
391   l_rec.attribute12                      := p_attribute12;
392   l_rec.attribute13                      := p_attribute13;
393   l_rec.attribute14                      := p_attribute14;
394   l_rec.attribute15                      := p_attribute15;
395   l_rec.attribute16                      := p_attribute16;
396   l_rec.attribute17                      := p_attribute17;
397   l_rec.attribute18                      := p_attribute18;
398   l_rec.attribute19                      := p_attribute19;
399   l_rec.attribute20                      := p_attribute20;
400   l_rec.attribute21                      := p_attribute21;
401   l_rec.attribute22                      := p_attribute22;
402   l_rec.attribute23                      := p_attribute23;
403   l_rec.attribute24                      := p_attribute24;
404   l_rec.attribute25                      := p_attribute25;
405   l_rec.attribute26                      := p_attribute26;
406   l_rec.attribute27                      := p_attribute27;
407   l_rec.attribute28                      := p_attribute28;
408   l_rec.attribute29                      := p_attribute29;
409   l_rec.attribute30                      := p_attribute30;
410   l_rec.attribute_category               := p_attribute_category;
411   l_rec.object_version_number            := p_object_version_number;
412   l_rec.type_of_ps                       := p_type_of_ps;
413   l_rec.date_from                        := p_date_from;
414   l_rec.date_to                          := p_date_to;
415   l_rec.primary_prof_field_id            := p_primary_prof_field_id;
416   l_rec.starting_grade_id                := p_starting_grade_id;
417   l_rec.ben_pgm_id                       := p_ben_pgm_id;
418   l_rec.probation_period                 := p_probation_period;
419   l_rec.probation_units                  := p_probation_units;
420   --
421   -- Return the plsql record structure.
422   --
423   Return(l_rec);
424 --
425 End convert_args;
426 --
427 end pqh_cpd_shd;