DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_PSU_SHD

Source


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