DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TMP_SHD

Source


1 Package Body hr_tmp_shd as
2 /* $Header: hrtmprhi.pkb 115.6 2002/12/03 11:31:46 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_tmp_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 = 'HR_FORM_TEMPLATES_B_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   ElsIf (p_constraint_name = 'HR_FORM_TEMPLATES_B_UK') Then
27     fnd_message.set_name('PER', 'HR_52648_TMP_NOT_UNIQUE');
28     fnd_message.raise_error;
29   ElsIf (p_constraint_name = 'HR_TEMPLATE_DATA_GROUPS_FK1') Then
30     fnd_message.set_name('PER', 'HR_52644_TMP_TDG_EXIST');
31     fnd_message.raise_error;
32   ElsIf (p_constraint_name = 'HR_TEMPLATE_ITEMS_B_FK1') Then
33     fnd_message.set_name('PER', 'HR_52643_TMP_TIM_EXIST');
34     fnd_message.raise_error;
35   ElsIf (p_constraint_name = 'HR_TEMPLATE_WINDOWS_B_FK1') Then
36     fnd_message.set_name('PER', 'HR_52642_TMP_TWN_EXIST');
37     fnd_message.raise_error;
38   ElsIf (p_constraint_name = 'HR_SOURCE_FORM_TEMPLATES_FK1') Then
39     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
40     fnd_message.set_token('PROCEDURE', l_proc);
41     fnd_message.set_token('STEP','30');
42     fnd_message.raise_error;
43   ElsIf (p_constraint_name = 'HR_SOURCE_FORM_TEMPLATES_FK2') Then
44     fnd_message.set_name('PER', 'HR_52647_TMP_SFT_EXIST');
45     fnd_message.raise_error;
46   Else
47     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
50     fnd_message.raise_error;
51   End If;
52   --
53 End constraint_error;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |-----------------------------< api_updating >-----------------------------|
57 -- ----------------------------------------------------------------------------
58 Function api_updating
59   (p_form_template_id                     in     number
60   ,p_object_version_number                in     number
61   )
62   Return Boolean Is
63 --
64   --
65   -- Cursor selects the 'current' row from the HR Schema
66   --
67   Cursor C_Sel1 is
68     select
69        form_template_id
70       ,object_version_number
71       ,application_id
72       ,form_id
73       ,template_name
74       ,enabled_flag
75       ,legislation_code
76       ,attribute_category
77       ,attribute1
78       ,attribute2
79       ,attribute3
80       ,attribute4
81       ,attribute5
82       ,attribute6
83       ,attribute7
84       ,attribute8
85       ,attribute9
86       ,attribute10
87       ,attribute11
88       ,attribute12
89       ,attribute13
90       ,attribute14
91       ,attribute15
92       ,attribute16
93       ,attribute17
94       ,attribute18
95       ,attribute19
96       ,attribute20
97       ,attribute21
98       ,attribute22
99       ,attribute23
100       ,attribute24
101       ,attribute25
102       ,attribute26
103       ,attribute27
104       ,attribute28
105       ,attribute29
106       ,attribute30
107     from	hr_form_templates_b
108     where	form_template_id = p_form_template_id;
109 --
110   l_fct_ret	boolean;
111 --
112 Begin
113   --
114   If (p_form_template_id is null and
115       p_object_version_number is null
116      ) Then
117     --
118     -- One of the primary key arguments is null therefore we must
119     -- set the returning function value to false
120     --
121     l_fct_ret := false;
122   Else
123     If (p_form_template_id
124         = hr_tmp_shd.g_old_rec.form_template_id and
125         p_object_version_number
126         = hr_tmp_shd.g_old_rec.object_version_number
127        ) Then
128       --
129       -- The g_old_rec is current therefore we must
130       -- set the returning function to true
131       --
132       l_fct_ret := true;
133     Else
134       --
135       -- Select the current row into g_old_rec
136       --
137       Open C_Sel1;
138       Fetch C_Sel1 Into hr_tmp_shd.g_old_rec;
139       If C_Sel1%notfound Then
140         Close C_Sel1;
141         --
142         -- The primary key is invalid therefore we must error
143         --
144         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
145         fnd_message.raise_error;
146       End If;
147       Close C_Sel1;
148       If (p_object_version_number
149           <> hr_tmp_shd.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       l_fct_ret := true;
154     End If;
155   End If;
156   Return (l_fct_ret);
157 --
158 End api_updating;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |---------------------------------< lck >----------------------------------|
162 -- ----------------------------------------------------------------------------
163 Procedure lck
164   (p_form_template_id                     in     number
165   ,p_object_version_number                in     number
166   ) is
167 --
168 -- Cursor selects the 'current' row from the HR Schema
169 --
170   Cursor C_Sel1 is
171     select
172        form_template_id
173       ,object_version_number
174       ,application_id
175       ,form_id
176       ,template_name
177       ,enabled_flag
178       ,legislation_code
179       ,attribute_category
180       ,attribute1
181       ,attribute2
182       ,attribute3
183       ,attribute4
184       ,attribute5
185       ,attribute6
186       ,attribute7
187       ,attribute8
188       ,attribute9
189       ,attribute10
190       ,attribute11
191       ,attribute12
192       ,attribute13
193       ,attribute14
194       ,attribute15
195       ,attribute16
196       ,attribute17
197       ,attribute18
198       ,attribute19
199       ,attribute20
200       ,attribute21
201       ,attribute22
202       ,attribute23
203       ,attribute24
204       ,attribute25
205       ,attribute26
206       ,attribute27
207       ,attribute28
208       ,attribute29
209       ,attribute30
210     from	hr_form_templates_b
211     where	form_template_id = p_form_template_id
212     for	update nowait;
213 --
214   l_proc	varchar2(72) := g_package||'lck';
215 --
216 Begin
217   hr_utility.set_location('Entering:'||l_proc, 5);
218   --
219   hr_api.mandatory_arg_error
220     (p_api_name           => l_proc
221     ,p_argument           => 'FORM_TEMPLATE_ID'
222     ,p_argument_value     => p_form_template_id
223     );
224   --Bug:1790746 fix Start
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   --Bug:1790746 fix End
231   Open  C_Sel1;
232   Fetch C_Sel1 Into hr_tmp_shd.g_old_rec;
233   If C_Sel1%notfound then
234     Close C_Sel1;
235     --
236     -- The primary key is invalid therefore we must error
237     --
238     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
239     fnd_message.raise_error;
240   End If;
241   Close C_Sel1;
242   If (p_object_version_number
243       <> hr_tmp_shd.g_old_rec.object_version_number) Then
244         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
245         fnd_message.raise_error;
246   End If;
247   --
248   hr_utility.set_location(' Leaving:'||l_proc, 10);
249   --
250   -- We need to trap the ORA LOCK exception
251   --
252 Exception
253   When HR_Api.Object_Locked then
254     --
255     -- The object is locked therefore we need to supply a meaningful
256     -- error message.
257     --
258     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
259     fnd_message.set_token('TABLE_NAME', 'hr_form_templates_b');
260     fnd_message.raise_error;
261 End lck;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |-----------------------------< convert_args >-----------------------------|
265 -- ----------------------------------------------------------------------------
266 Function convert_args
267   (p_form_template_id               in number
268   ,p_object_version_number          in number
269   ,p_application_id                 in number
270   ,p_form_id                        in number
271   ,p_template_name                  in varchar2
272   ,p_enabled_flag                   in varchar2
273   ,p_legislation_code               in varchar2
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 --
310 Begin
311   --
312   -- Convert arguments into local l_rec structure.
313   --
314   l_rec.form_template_id                 := p_form_template_id;
315   l_rec.object_version_number            := p_object_version_number;
316   l_rec.application_id                   := p_application_id;
317   l_rec.form_id                          := p_form_id;
318   IF p_template_name <> hr_api.g_varchar2 THEN
319     l_rec.template_name                    := UPPER(p_template_name);
320   ELSE
321     l_rec.template_name                    := p_template_name;
322   END IF;
323   l_rec.enabled_flag                     := p_enabled_flag;
324   l_rec.legislation_code                 := p_legislation_code;
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   Return(l_rec);
360 --
361 End convert_args;
362 --
363 end hr_tmp_shd;