DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CHK_SHD

Source


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