DBA Data[Home] [Help]

PACKAGE BODY: APPS.SSP_STP_SHD

Source


1 Package Body ssp_stp_shd as
2 /* $Header: spstprhi.pkb 115.3 99/10/13 01:54:40 porting ship  $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ssp_stp_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_STOPPAGES_FK1') Then
37     fnd_message.set_name ('SSP', 'SSP_35069_STOPPAGES_FK1');
38   ElsIf (p_constraint_name = 'SSP_STOPPAGES_FK2') Then
39     fnd_message.set_name ('SSP', 'SSP_35070_STOPPAGES_FK2');
40   ElsIf (p_constraint_name = 'SSP_STOPPAGES_FK3') Then
41     fnd_message.set_name ('SSP', 'SSP_35071_STOPPAGES_FK3');
42   ElsIf (p_constraint_name = 'SSP_STOPPAGES_PK') Then
43     fnd_message.set_name ('SSP', 'SSP_35072_STOPPAGES_PK');
44   ElsIf (p_constraint_name = 'SSP_STP_ARC_ABS_MAT') Then
45     fnd_message.set_name ('SSP', 'SSP_35073_STP_ARC_ABS_MAT');
46   ElsIf (p_constraint_name = 'SSP_STP_SMP_STOPPAGE_DATES') Then
47     fnd_message.set_name ('SSP', 'SSP_35074_STOPPAGE_DATES');
48   ElsIf (p_constraint_name = 'SSP_STP_WITHHOLD_TO_PERMANENT') Then
49     fnd_message.set_name ('SSP', 'SSP_35075_PERMANENT_STOPPAGE');
50   ElsIf (p_constraint_name = 'SSP_STP_SYSTEM_NOT_OVERRIDE') Then
51     fnd_message.set_name ('SSP', 'SSP_35076_SYSTEM_NOT_OVERRIDE');
52   Else
53     fnd_message.set_name ('SSP', 'HR_7877_API_INVALID_CONSTRAINT');
54   End If;
55   --
56   fnd_message.raise_error;
57   --
58   hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65   (
66   p_stoppage_id                        in number,
67   p_object_version_number              in number
68   )      Return Boolean Is
69 --
70   --
71   -- Cursor selects the 'current' row from the HR Schema
72   --
73   Cursor C_Sel1 is
74     select
75 		stoppage_id,
76 	object_version_number,
77 	absence_attendance_id,
78 	maternity_id,
79 	reason_id,
80 	user_entered,
81 	override_stoppage,
82 	employee_notified,
83 	withhold_from,
84 	withhold_to
85     from	ssp_stoppages
86     where	stoppage_id = p_stoppage_id;
87 --
88   l_proc	varchar2(72)	:= g_package||'api_updating';
89   l_fct_ret	boolean;
90 --
91 Begin
92   hr_utility.set_location('Entering:'||l_proc, 5);
93   --
94   If (
95 	p_stoppage_id is null and
96 	p_object_version_number is null
97      ) Then
98     --
99     -- One of the primary key arguments is null therefore we must
100     -- set the returning function value to false
101     --
102     l_fct_ret := false;
103   Else
104     If (
105 	p_stoppage_id = g_old_rec.stoppage_id and
106 	p_object_version_number = g_old_rec.object_version_number
107        ) Then
108       hr_utility.set_location(l_proc, 10);
109       --
110       -- The g_old_rec is current therefore we must
111       -- set the returning function to true
112       --
113       l_fct_ret := true;
114     Else
115       --
116       -- Select the current row into g_old_rec
117       --
118       Open C_Sel1;
119       Fetch C_Sel1 Into g_old_rec;
120       If C_Sel1%notfound Then
121         Close C_Sel1;
122         --
123         -- The primary key is invalid therefore we must error
124         --
125         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
126         hr_utility.raise_error;
127       End If;
128       Close C_Sel1;
129       If (p_object_version_number <> g_old_rec.object_version_number) Then
130         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
131         hr_utility.raise_error;
132       End If;
133       hr_utility.set_location(l_proc, 15);
134       l_fct_ret := true;
135     End If;
136   End If;
137   hr_utility.set_location(' Leaving:'||l_proc, 20);
138   Return (l_fct_ret);
139 --
140 End api_updating;
141 --
142 -- ----------------------------------------------------------------------------
143 -- |---------------------------------< lck >----------------------------------|
144 -- ----------------------------------------------------------------------------
145 Procedure lck
146   (
147   p_stoppage_id                        in number,
148   p_object_version_number              in number
149   ) is
150 --
151 -- Cursor selects the 'current' row from the HR Schema
152 --
153   Cursor C_Sel1 is
154     select 	stoppage_id,
155 	object_version_number,
156 	absence_attendance_id,
157 	maternity_id,
158 	reason_id,
159 	user_entered,
160 	override_stoppage,
161 	employee_notified,
162 	withhold_from,
163 	withhold_to
164     from	ssp_stoppages
165     where	stoppage_id = p_stoppage_id
166     for	update nowait;
167 --
168   l_proc	varchar2(72) := g_package||'lck';
169 --
170 Begin
171   hr_utility.set_location('Entering:'||l_proc, 5);
172   --
173   -- Add any mandatory argument checking here:
174   -- Example:
175   -- hr_api.mandatory_arg_error
176   --   (p_api_name       => l_proc,
177   --    p_argument       => 'object_version_number',
178   --    p_argument_value => p_object_version_number);
179   --
180   Open  C_Sel1;
181   Fetch C_Sel1 Into g_old_rec;
182   If C_Sel1%notfound then
183     Close C_Sel1;
184     --
185     -- The primary key is invalid therefore we must error
186     --
187     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
188     hr_utility.raise_error;
189   End If;
190   Close C_Sel1;
191   If (p_object_version_number <> g_old_rec.object_version_number) Then
192         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
193         hr_utility.raise_error;
194       End If;
195 --
196   hr_utility.set_location(' Leaving:'||l_proc, 10);
197 --
198 -- We need to trap the ORA LOCK exception
199 --
200 Exception
201   When HR_Api.Object_Locked then
202     --
203     -- The object is locked therefore we need to supply a meaningful
204     -- error message.
205     --
206     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
207     hr_utility.set_message_token('TABLE_NAME', 'ssp_stoppages');
208     hr_utility.raise_error;
209 End lck;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------------< convert_args >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 Function convert_args
215 	(
216 	p_stoppage_id                   in number,
217 	p_object_version_number         in number,
218 	p_absence_attendance_id         in number,
219 	p_maternity_id                  in number,
220 	p_reason_id                     in number,
221 	p_user_entered                  in varchar2,
222 	p_override_stoppage             in varchar2,
223 	p_employee_notified             in varchar2,
224 	p_withhold_from                 in date,
225 	p_withhold_to                   in date
226 	)
227 	Return g_rec_type is
228 --
229   l_rec	  g_rec_type;
230   l_proc  varchar2(72) := g_package||'convert_args';
231 --
232 Begin
233   --
234   hr_utility.set_location('Entering:'||l_proc, 5);
235   --
236   -- Convert arguments into local l_rec structure.
237   --
238   l_rec.stoppage_id                      := p_stoppage_id;
239   l_rec.object_version_number            := p_object_version_number;
240   l_rec.absence_attendance_id            := p_absence_attendance_id;
241   l_rec.maternity_id                     := p_maternity_id;
242   l_rec.reason_id                        := p_reason_id;
243   l_rec.user_entered                     := p_user_entered;
244   l_rec.override_stoppage                := p_override_stoppage;
245   l_rec.employee_notified                := p_employee_notified;
246   l_rec.withhold_from                    := p_withhold_from;
247   l_rec.withhold_to                      := p_withhold_to;
248   --
249   -- Return the plsql record structure.
250   --
251   hr_utility.set_location(' Leaving:'||l_proc, 10);
252   Return(l_rec);
253 --
254 End convert_args;
255 --
256 end ssp_stp_shd;