DBA Data[Home] [Help]

PACKAGE BODY: APPS.SSP_MAT_SHD

Source


1 Package Body ssp_mat_shd as
2 /* $Header: spmatrhi.pkb 120.5.12010000.3 2008/08/13 13:27:41 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ssp_mat_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 = 'SSP_MAT_NOTE_OF_BIRTH_TOO_SOON') Then
37     fnd_message.set_name ('SSP', 'SSP_35012_EARLY_BIRTH_NOTIFIC');
38     --
39   ElsIf (p_constraint_name = 'SSP_MAT_MPP_MUST_START_SUNDAY') Then
40     fnd_message.set_name ('SSP', 'SSP_35054_MPP_NOT_SUNDAY');
41     --
42   ElsIf (p_constraint_name = 'SSP_MAT_INTEND_TO_RETURN_DATE') Then
43     fnd_message.set_name ('SSP', 'SSP_35013_INV_EVNT_RET_DATE');
44     --
45   ElsIf (p_constraint_name = 'SSP_MAT_STILLBIRTH_NEEDS_DATE') Then
46     fnd_message.set_name ('SSP', 'SSP_35004_LIVE_BIRTH_FLAG');
47     --
48   ElsIf (p_constraint_name = 'SSP_MAT_MPP_SMA_START_DATES') Then
49     fnd_message.set_name ('SSP', 'SSP_35014_FWD_MPP_START');
50     --
51   ElsIf (p_constraint_name = 'SSP_MAT_UNFIT_TO_RETURN_DATE') Then
52     fnd_message.set_name ('SSP', 'SSP_35058_UNFIT_TO_RETURN');
53     --
54   ElsIf (p_constraint_name = 'SSP_MATERNITIES_PK') Then
55     fnd_message.set_name ('SSP', 'SSP_35041_DUP_MATERNITY_PK');
56     --
57   ElsIf (p_constraint_name = 'SSP_MATERNITIES_UK1') Then
58     fnd_message.set_name ('SSP', 'SSP_35009_DUP_DUE_DATE');
59     --
60   ElsIf (p_constraint_name = 'SSP_MAT_MPP_START_BIRTH_DATE') Then
61     fnd_message.set_name ('SSP', 'SSP_35055_MPP_SUN_FOLLW_BIRTH');
62     --
63   ElsIf (p_constraint_name = 'SSP_MAT_NOTIFICATION_OF_BIRTH') Then
64     fnd_message.set_name ('SSP', 'SSP_35059_NOTIF_OF_BIRTH');
65     --
66   ElsIf (p_constraint_name = 'SSP_MATERNITIES_FK1') Then
67     fnd_message.set_name('SSP', 'SSP_35057_BAD_PERSON_ID');
68     --
69   Else
70     fnd_message.set_name ('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
71     fnd_message.set_token('PROCEDURE', l_proc);
72     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
73   End If;
74   --
75   fnd_message.raise_error;
76   --
77   hr_utility.set_location(' Leaving:'||l_proc, 10);
78 End constraint_error;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |-----------------------------< api_updating >-----------------------------|
82 -- ----------------------------------------------------------------------------
83 Function api_updating
84   (
85   p_maternity_id                       in number,
86   p_object_version_number              in number
87   )      Return Boolean Is
88 --
89   --
90   -- Cursor selects the 'current' row from the HR Schema
91   --
92   Cursor C_Sel1 is
93     select
94     maternity_id,
95     due_date,
96     person_id,
97     start_date_maternity_allowance,
98     notification_of_birth_date,
99     unfit_for_scheduled_return,
100     stated_return_date,
101     intend_to_return_flag,
102     start_date_with_new_employer,
103     smp_must_be_paid_by_date,
104     pay_smp_as_lump_sum,
105     live_birth_flag,
106     actual_birth_date,
107     mpp_start_date,
108     object_version_number,
109     attribute_category,
110     attribute1,
111     attribute2,
112     attribute3,
113     attribute4,
114     attribute5,
115     attribute6,
116     attribute7,
117     attribute8,
118     attribute9,
119     attribute10,
120     attribute11,
121     attribute12,
122     attribute13,
123     attribute14,
124     attribute15,
125     attribute16,
126     attribute17,
127     attribute18,
128     attribute19,
129     attribute20,
130     LEAVE_TYPE,
131     MATCHING_DATE,
132     PLACEMENT_DATE,
133     DISRUPTED_PLACEMENT_DATE,
134     mat_information_category,
135     mat_information1,
136     mat_information2,
137     mat_information3,
138     mat_information4,
139     mat_information5,
140     mat_information6,
141     mat_information7,
142     mat_information8,
143     mat_information9,
144     mat_information10,
145     mat_information11,
146     mat_information12,
147     mat_information13,
148     mat_information14,
149     mat_information15,
150     mat_information16,
151     mat_information17,
152     mat_information18,
153     mat_information19,
154     mat_information20,
155     mat_information21,
156     mat_information22,
157     mat_information23,
158     mat_information24,
159     mat_information25,
160     mat_information26,
161     mat_information27,
162     mat_information28,
163     mat_information29,
164     mat_information30
165     from	ssp_maternities
166     where	maternity_id = p_maternity_id;
167 --
168   l_proc	varchar2(72)	:= g_package||'api_updating';
169   l_fct_ret	boolean;
170 --
171 Begin
172   hr_utility.set_location('Entering:'||l_proc, 5);
173   --
174   If (
175 	p_maternity_id is null and
176 	p_object_version_number is null
177      ) Then
178     --
179     -- One of the primary key arguments is null therefore we must
180     -- set the returning function value to false
181     --
182     l_fct_ret := false;
183   Else
184     If (
185 	p_maternity_id = g_old_rec.maternity_id and
186 	p_object_version_number = g_old_rec.object_version_number
187        ) Then
188       hr_utility.set_location(l_proc, 10);
189       --
190       -- The g_old_rec is current therefore we must
191       -- set the returning function to true
192       --
193       l_fct_ret := true;
194     Else
195       --
196       -- Select the current row into g_old_rec
197       --
198       Open C_Sel1;
199       Fetch C_Sel1 Into g_old_rec;
200       If C_Sel1%notfound Then
201         Close C_Sel1;
202         --
203         -- The primary key is invalid therefore we must error
204         --
205         fnd_message.set_name ('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
206         fnd_message.raise_error;
207       End If;
208       Close C_Sel1;
209       If (p_object_version_number <> g_old_rec.object_version_number) Then
210         fnd_message.set_name ('PAY', 'HR_7155_OBJECT_INVALID');
211         fnd_message.raise_error;
212       End If;
213       hr_utility.set_location(l_proc, 15);
214       l_fct_ret := true;
215     End If;
216   End If;
217   hr_utility.set_location(' Leaving:'||l_proc, 20);
218   Return (l_fct_ret);
219 --
220 End api_updating;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |---------------------------------< lck >----------------------------------|
224 -- ----------------------------------------------------------------------------
225 Procedure lck
226   (
227   p_maternity_id                       in number,
228   p_object_version_number              in number
229   ) is
230 --
231 -- Cursor selects the 'current' row from the HR Schema
232 --
233   Cursor C_Sel1 is
234     select maternity_id,
235            due_date,
236            person_id,
237            start_date_maternity_allowance,
238            notification_of_birth_date,
239            unfit_for_scheduled_return,
240            stated_return_date,
241            intend_to_return_flag,
242            start_date_with_new_employer,
243            smp_must_be_paid_by_date,
244            pay_smp_as_lump_sum,
245            live_birth_flag,
246            actual_birth_date,
247            mpp_start_date,
248            object_version_number,
249            attribute_category,
250            attribute1,
251            attribute2,
252            attribute3,
253            attribute4,
254            attribute5,
255            attribute6,
256            attribute7,
257            attribute8,
258            attribute9,
259            attribute10,
260            attribute11,
261            attribute12,
262            attribute13,
263            attribute14,
264            attribute15,
265            attribute16,
266            attribute17,
267            attribute18,
268            attribute19,
269            attribute20,
270            LEAVE_TYPE,
271            MATCHING_DATE,
272            PLACEMENT_DATE,
273            DISRUPTED_PLACEMENT_DATE,
274            mat_information_category,
275            mat_information1,
276            mat_information2,
277            mat_information3,
278            mat_information4,
279            mat_information5,
280            mat_information6,
281            mat_information7,
282            mat_information8,
283            mat_information9,
284            mat_information10,
285            mat_information11,
286            mat_information12,
287            mat_information13,
288            mat_information14,
289            mat_information15,
290            mat_information16,
291            mat_information17,
292            mat_information18,
293            mat_information19,
294            mat_information20,
295            mat_information21,
296            mat_information22,
297            mat_information23,
298            mat_information24,
299            mat_information25,
300            mat_information26,
301            mat_information27,
302            mat_information28,
303            mat_information29,
304            mat_information30
305     from	ssp_maternities
306     where	maternity_id = p_maternity_id
307     for	update nowait;
308 --
309   l_proc	varchar2(72) := g_package||'lck';
310 --
311 Begin
312   hr_utility.set_location('Entering:'||l_proc, 5);
313   --
314   -- Add any mandatory argument checking here:
315   -- Example:
316   -- hr_api.mandatory_arg_error
317   --   (p_api_name       => l_proc,
318   --    p_argument       => 'object_version_number',
319   --    p_argument_value => p_object_version_number);
320   --
321   Open  C_Sel1;
322   Fetch C_Sel1 Into g_old_rec;
323   If C_Sel1%notfound then
324     Close C_Sel1;
325     --
326     -- The primary key is invalid therefore we must error
327     --
328     fnd_message.set_name ('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
329     fnd_message.raise_error;
330   End If;
331   Close C_Sel1;
332   If (p_object_version_number <> g_old_rec.object_version_number) Then
333         fnd_message.set_name ('PAY', 'HR_7155_OBJECT_INVALID');
334         fnd_message.raise_error;
335       End If;
336 --
337   hr_utility.set_location(' Leaving:'||l_proc, 10);
338 --
339 -- We need to trap the ORA LOCK exception
340 --
341 Exception
342   When HR_Api.Object_Locked then
343     --
344     -- The object is locked therefore we need to supply a meaningful
345     -- error message.
346     --
347     fnd_message.set_name ('PAY', 'HR_7165_OBJECT_LOCKED');
348     fnd_message.set_token('TABLE_NAME', 'ssp_maternities');
349     fnd_message.raise_error;
350 End lck;
351 --
352 -- ----------------------------------------------------------------------------
353 -- |-----------------------------< convert_args >-----------------------------|
354 -- ----------------------------------------------------------------------------
355 Function convert_args
356 	(
357 	p_maternity_id                  in number,
358 	p_due_date                      in date,
359 	p_person_id                     in number,
360 	p_start_date_SMA  in date,
361 	p_notification_of_birth_date    in date,
362 	p_unfit_for_scheduled_return    in varchar2,
363 	p_stated_return_date            in date,
364 	p_intend_to_return_flag         in varchar2,
365 	p_start_date_with_new_employer  in date,
366 	p_smp_must_be_paid_by_date      in date,
367 	p_pay_smp_as_lump_sum           in varchar2,
368 	p_live_birth_flag               in varchar2,
369 	p_actual_birth_date             in date,
370 	p_mpp_start_date                in date,
371 	p_object_version_number         in number,
372 	p_attribute_category            in varchar2,
373 	p_attribute1                    in varchar2,
374 	p_attribute2                    in varchar2,
375 	p_attribute3                    in varchar2,
376 	p_attribute4                    in varchar2,
377 	p_attribute5                    in varchar2,
378 	p_attribute6                    in varchar2,
379 	p_attribute7                    in varchar2,
380 	p_attribute8                    in varchar2,
381 	p_attribute9                    in varchar2,
382 	p_attribute10                   in varchar2,
383 	p_attribute11                   in varchar2,
384 	p_attribute12                   in varchar2,
385 	p_attribute13                   in varchar2,
386 	p_attribute14                   in varchar2,
387 	p_attribute15                   in varchar2,
388 	p_attribute16                   in varchar2,
389 	p_attribute17                   in varchar2,
390 	p_attribute18                   in varchar2,
391 	p_attribute19                   in varchar2,
392 	p_attribute20                   in varchar2,
393         p_LEAVE_TYPE                    in VARCHAR2 default 'MA',
394         p_MATCHING_DATE                 in DATE default null,
395         p_PLACEMENT_DATE                in DATE default null,
396         p_DISRUPTED_PLACEMENT_DATE      in DATE default null,
397         p_mat_information_category      in varchar2,
398         p_mat_information1              in varchar2,
399         p_mat_information2              in varchar2,
400         p_mat_information3              in varchar2,
401         p_mat_information4              in varchar2,
402         p_mat_information5              in varchar2,
403         p_mat_information6              in varchar2,
404         p_mat_information7              in varchar2,
405         p_mat_information8              in varchar2,
406         p_mat_information9              in varchar2,
407         p_mat_information10             in varchar2,
408         p_mat_information11             in varchar2,
409         p_mat_information12             in varchar2,
410         p_mat_information13             in varchar2,
411         p_mat_information14             in varchar2,
412         p_mat_information15             in varchar2,
413         p_mat_information16             in varchar2,
414         p_mat_information17             in varchar2,
415         p_mat_information18             in varchar2,
416         p_mat_information19             in varchar2,
417         p_mat_information20             in varchar2,
418         p_mat_information21             in varchar2,
419         p_mat_information22             in varchar2,
420         p_mat_information23             in varchar2,
421         p_mat_information24             in varchar2,
422         p_mat_information25             in varchar2,
423         p_mat_information26             in varchar2,
424         p_mat_information27             in varchar2,
425         p_mat_information28             in varchar2,
426         p_mat_information29             in varchar2,
427         p_mat_information30             in varchar2
428 )
429 	Return g_rec_type is
430 --
431   l_rec	  g_rec_type;
432   l_proc  varchar2(72) := g_package||'convert_args';
433 --
434 Begin
435   --
436   hr_utility.set_location('Entering:'||l_proc, 5);
437   --
438   -- Convert arguments into local l_rec structure.
439   --
440   l_rec.maternity_id                     := p_maternity_id;
441   l_rec.due_date                         := p_due_date;
442   l_rec.person_id                        := p_person_id;
443   l_rec.start_date_maternity_allowance   := p_start_date_SMA;
444   l_rec.notification_of_birth_date       := p_notification_of_birth_date;
445   l_rec.unfit_for_scheduled_return       := p_unfit_for_scheduled_return;
446   l_rec.stated_return_date               := p_stated_return_date;
447   l_rec.intend_to_return_flag            := p_intend_to_return_flag;
448   l_rec.start_date_with_new_employer     := p_start_date_with_new_employer;
449   l_rec.smp_must_be_paid_by_date         := p_smp_must_be_paid_by_date;
450   l_rec.pay_smp_as_lump_sum              := p_pay_smp_as_lump_sum;
451   l_rec.live_birth_flag                  := p_live_birth_flag;
452   l_rec.actual_birth_date                := p_actual_birth_date;
453   l_rec.mpp_start_date                   := p_mpp_start_date;
454   l_rec.object_version_number            := p_object_version_number;
455   l_rec.attribute_category               := p_attribute_category;
456   l_rec.attribute1                       := p_attribute1;
457   l_rec.attribute2                       := p_attribute2;
458   l_rec.attribute3                       := p_attribute3;
459   l_rec.attribute4                       := p_attribute4;
460   l_rec.attribute5                       := p_attribute5;
461   l_rec.attribute6                       := p_attribute6;
462   l_rec.attribute7                       := p_attribute7;
463   l_rec.attribute8                       := p_attribute8;
464   l_rec.attribute9                       := p_attribute9;
465   l_rec.attribute10                      := p_attribute10;
466   l_rec.attribute11                      := p_attribute11;
467   l_rec.attribute12                      := p_attribute12;
468   l_rec.attribute13                      := p_attribute13;
469   l_rec.attribute14                      := p_attribute14;
470   l_rec.attribute15                      := p_attribute15;
471   l_rec.attribute16                      := p_attribute16;
472   l_rec.attribute17                      := p_attribute17;
473   l_rec.attribute18                      := p_attribute18;
474   l_rec.attribute19                      := p_attribute19;
475   l_rec.attribute20                      := p_attribute20;
476   l_rec.LEAVE_TYPE                       := p_LEAVE_TYPE;
477   l_rec.MATCHING_DATE                    := p_MATCHING_DATE;
478   l_rec.PLACEMENT_DATE                   := p_PLACEMENT_DATE;
479   l_rec.DISRUPTED_PLACEMENT_DATE         := p_DISRUPTED_PLACEMENT_DATE;
480   l_rec.mat_information_category         := p_mat_information_category;
481   l_rec.mat_information1                 := p_mat_information1;
482   l_rec.mat_information2                 := p_mat_information2;
483   l_rec.mat_information3                 := p_mat_information3;
484   l_rec.mat_information4                 := p_mat_information4;
485   l_rec.mat_information5                 := p_mat_information5;
486   l_rec.mat_information6                 := p_mat_information6;
487   l_rec.mat_information7                 := p_mat_information7;
488   l_rec.mat_information8                 := p_mat_information8;
489   l_rec.mat_information9                 := p_mat_information9;
490   l_rec.mat_information10                := p_mat_information10;
491   l_rec.mat_information11                := p_mat_information11;
492   l_rec.mat_information12                := p_mat_information12;
493   l_rec.mat_information13                := p_mat_information13;
494   l_rec.mat_information14                := p_mat_information14;
495   l_rec.mat_information15                := p_mat_information15;
496   l_rec.mat_information16                := p_mat_information16;
497   l_rec.mat_information17                := p_mat_information17;
498   l_rec.mat_information18                := p_mat_information18;
499   l_rec.mat_information19                := p_mat_information19;
500   l_rec.mat_information20                := p_mat_information20;
501   l_rec.mat_information21                := p_mat_information21;
502   l_rec.mat_information22                := p_mat_information22;
503   l_rec.mat_information23                := p_mat_information23;
504   l_rec.mat_information24                := p_mat_information24;
505   l_rec.mat_information25                := p_mat_information25;
506   l_rec.mat_information26                := p_mat_information26;
507   l_rec.mat_information27                := p_mat_information27;
508   l_rec.mat_information28                := p_mat_information28;
509   l_rec.mat_information29                := p_mat_information29;
510   l_rec.mat_information30                := p_mat_information30;
511   --
512   -- Return the plsql record structure.
513   --
514   hr_utility.set_location(' Leaving:'||l_proc, 10);
515   Return(l_rec);
516 --
517 End convert_args;
518 --
519 end ssp_mat_shd;