DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_STS_SHD

Source


1 Package Body pqh_sts_shd as
2 /* $Header: pqstsrhi.pkb 120.0 2005/05/29 02:43 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_sts_shd.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15   (p_constraint_name in all_constraints.constraint_name%TYPE
16   ) Is
17 --
18   l_proc        varchar2(72) := g_package||'constraint_error';
19 
20 --
21 Begin
22   --
23   If (p_constraint_name = 'PQH_FR_STAT_SITUATIONS_PK') Then
24     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
25     fnd_message.set_token('PROCEDURE', l_proc);
26     fnd_message.set_token('STEP','5');
27     fnd_message.raise_error;
28   Else
29     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
30     fnd_message.set_token('PROCEDURE', l_proc);
31     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
32     fnd_message.raise_error;
33   End If;
34   --
35 End constraint_error;
36 --
37 -- ----------------------------------------------------------------------------
38 -- |-----------------------------< api_updating >-----------------------------|
39 -- ----------------------------------------------------------------------------
40 Function api_updating
41   (p_statutory_situation_id               in     number
42   ,p_object_version_number                in     number
43   )
44   Return Boolean Is
45   --
46   --
47   -- Cursor selects the 'current' row from the HR Schema
48   --
49   Cursor C_Sel1 is
50     select
51        statutory_situation_id
52       ,business_group_id
53       ,situation_name
54       ,type_of_ps
55       ,situation_type
56       ,sub_type
57       ,source
58       ,location
59       ,reason
60       ,default_flag
61       ,date_from
62       ,date_to
63       ,request_type
64       ,employee_agreement_needed
65       ,manager_agreement_needed
66       ,print_arrette
67       ,reserve_position
68       ,allow_progression_flag
69       ,extend_probation_period_flag
70       ,remuneration_paid
71       ,pay_share
72       ,pay_periods
73       ,frequency
74       ,first_period_max_duration
75       ,min_duration_per_request
76       ,max_duration_per_request
77       ,max_duration_whole_career
78       ,renewable_allowed
79       ,max_no_of_renewals
80       ,max_duration_per_renewal
81       ,max_tot_continuous_duration
82       ,object_version_number
83       ,remunerate_assign_status_id
84     from        pqh_fr_stat_situations
85     where       statutory_situation_id = p_statutory_situation_id;
86   --
87   l_fct_ret     boolean;
88   --
89 Begin
90   --
91   If (p_statutory_situation_id is null and
92       p_object_version_number is null
93      ) Then
94     --
95     -- One of the primary key arguments is null therefore we must
96     -- set the returning function value to false
97     --
98     l_fct_ret := false;
99   Else
100     If (p_statutory_situation_id
101         = pqh_sts_shd.g_old_rec.statutory_situation_id and
102         p_object_version_number
103         = pqh_sts_shd.g_old_rec.object_version_number
104        ) Then
105       --
106       -- The g_old_rec is current therefore we must
107       -- set the returning function to true
108       --
109       l_fct_ret := true;
110     Else
111       --
112       -- Select the current row into g_old_rec
113       --
114       Open C_Sel1;
115       Fetch C_Sel1 Into pqh_sts_shd.g_old_rec;
116       If C_Sel1%notfound Then
117         Close C_Sel1;
118         --
119         -- The primary key is invalid therefore we must error
120         --
121         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
122         fnd_message.raise_error;
123       End If;
124       Close C_Sel1;
125       If (p_object_version_number
126           <> pqh_sts_shd.g_old_rec.object_version_number) Then
127         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
128         fnd_message.raise_error;
129       End If;
130       l_fct_ret := true;
131     End If;
132   End If;
133   Return (l_fct_ret);
134 --
135 End api_updating;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------------< lck >----------------------------------|
139 -- ----------------------------------------------------------------------------
140 Procedure lck
141   (p_statutory_situation_id               in     number
142   ,p_object_version_number                in     number
143   ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147   Cursor C_Sel1 is
148     select
149        statutory_situation_id
150       ,business_group_id
151       ,situation_name
152       ,type_of_ps
153       ,situation_type
154       ,sub_type
155       ,source
156       ,location
157       ,reason
158       ,default_flag
159       ,date_from
160       ,date_to
161       ,request_type
162       ,employee_agreement_needed
163       ,manager_agreement_needed
164       ,print_arrette
165       ,reserve_position
166       ,allow_progression_flag
167       ,extend_probation_period_flag
168       ,remuneration_paid
169       ,pay_share
170       ,pay_periods
171       ,frequency
172       ,first_period_max_duration
173       ,min_duration_per_request
174       ,max_duration_per_request
175       ,max_duration_whole_career
176       ,renewable_allowed
177       ,max_no_of_renewals
178       ,max_duration_per_renewal
179       ,max_tot_continuous_duration
180       ,object_version_number
181       ,remunerate_assign_status_id
182     from        pqh_fr_stat_situations
183     where       statutory_situation_id = p_statutory_situation_id
184     for update nowait;
185 --
186   l_proc        varchar2(72) := g_package||'lck';
187 --
188 Begin
189 
190   if g_debug then
191   --
192     hr_utility.set_location('Entering:'||l_proc, 5);
193   --
194   end if;
195 
196   --
197   hr_api.mandatory_arg_error
198     (p_api_name           => l_proc
199     ,p_argument           => 'STATUTORY_SITUATION_ID'
200     ,p_argument_value     => p_statutory_situation_id
201     );
202 
203   if g_debug then
204   --
205      hr_utility.set_location(l_proc,6);
206   --
207   end if;
208 
209   hr_api.mandatory_arg_error
210     (p_api_name           => l_proc
211     ,p_argument           => 'OBJECT_VERSION_NUMBER'
212     ,p_argument_value     => p_object_version_number
213     );
214   --
215   Open  C_Sel1;
216   Fetch C_Sel1 Into pqh_sts_shd.g_old_rec;
217   If C_Sel1%notfound then
218     Close C_Sel1;
219     --
220     -- The primary key is invalid therefore we must error
221     --
222     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
223     fnd_message.raise_error;
224   End If;
225   Close C_Sel1;
226   If (p_object_version_number
227       <> pqh_sts_shd.g_old_rec.object_version_number) Then
228         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
229         fnd_message.raise_error;
230   End If;
231   --
232   if g_debug then
233   --
234     hr_utility.set_location(' Leaving:'||l_proc, 10);
235   --
236   end if;
237   --
238   -- We need to trap the ORA LOCK exception
239   --
240 Exception
241   When HR_Api.Object_Locked then
242     --
243     -- The object is locked therefore we need to supply a meaningful
244     -- error message.
245     --
246     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
247     fnd_message.set_token('TABLE_NAME', 'pqh_fr_stat_situations');
248     fnd_message.raise_error;
249 End lck;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< convert_args >-----------------------------|
253 -- ----------------------------------------------------------------------------
254 Function convert_args
255   (p_statutory_situation_id         in number
256   ,p_business_group_id              in number
257   ,p_situation_name                 in varchar2
258   ,p_type_of_ps                     in varchar2
259   ,p_situation_type                 in varchar2
260   ,p_sub_type                       in varchar2
261   ,p_source                         in varchar2
262   ,p_location                       in varchar2
263   ,p_reason                         in varchar2
264   ,p_is_default                     in varchar2
265   ,p_date_from                      in date
266   ,p_date_to                        in date
267   ,p_request_type                   in varchar2
268   ,p_employee_agreement_needed      in varchar2
269   ,p_manager_agreement_needed       in varchar2
270   ,p_print_arrette                  in varchar2
271   ,p_reserve_position               in varchar2
272   ,p_allow_progressions             in varchar2
273   ,p_extend_probation_period        in varchar2
274   ,p_remuneration_paid              in varchar2
275   ,p_pay_share                      in number
276   ,p_pay_periods                    in number
277   ,p_frequency                      in varchar2
278   ,p_first_period_max_duration      in number
279   ,p_min_duration_per_request       in number
280   ,p_max_duration_per_request       in number
281   ,p_max_duration_whole_career      in number
282   ,p_renewable_allowed              in varchar2
283   ,p_max_no_of_renewals             in number
284   ,p_max_duration_per_renewal       in number
285   ,p_max_tot_continuous_duration    in number
286   ,p_object_version_number          in number
287   ,p_remunerate_assign_status_id    in number
288   )
289   Return g_rec_type is
290 --
291   l_rec   g_rec_type;
292 --
293 Begin
294   --
295   -- Convert arguments into local l_rec structure.
296   --
297   l_rec.statutory_situation_id           := p_statutory_situation_id;
298   l_rec.business_group_id                := p_business_group_id;
299   l_rec.situation_name                   := p_situation_name;
300   l_rec.type_of_ps                       := p_type_of_ps;
301   l_rec.situation_type                   := p_situation_type;
302   l_rec.sub_type                         := p_sub_type;
303   l_rec.source                           := p_source;
304   l_rec.location                         := p_location;
305   l_rec.reason                           := p_reason;
306   l_rec.is_default                       := p_is_default;
307   l_rec.date_from                        := p_date_from;
308   l_rec.date_to                          := p_date_to;
309   l_rec.request_type                     := p_request_type;
310   l_rec.employee_agreement_needed        := p_employee_agreement_needed;
311   l_rec.manager_agreement_needed         := p_manager_agreement_needed;
312   l_rec.print_arrette                    := p_print_arrette;
313   l_rec.reserve_position                 := p_reserve_position;
314   l_rec.allow_progressions               := p_allow_progressions;
315   l_rec.extend_probation_period          := p_extend_probation_period;
316   l_rec.remuneration_paid                := p_remuneration_paid;
317   l_rec.pay_share                        := p_pay_share;
318   l_rec.pay_periods                      := p_pay_periods;
319   l_rec.frequency                        := p_frequency;
320   l_rec.first_period_max_duration        := p_first_period_max_duration;
321   l_rec.min_duration_per_request         := p_min_duration_per_request;
322   l_rec.max_duration_per_request         := p_max_duration_per_request;
323   l_rec.max_duration_whole_career        := p_max_duration_whole_career;
324   l_rec.renewable_allowed                := p_renewable_allowed;
325   l_rec.max_no_of_renewals               := p_max_no_of_renewals;
326   l_rec.max_duration_per_renewal         := p_max_duration_per_renewal;
327   l_rec.max_tot_continuous_duration      := p_max_tot_continuous_duration;
328   l_rec.object_version_number            := p_object_version_number;
329   l_rec.remunerate_assign_status_id      := p_remunerate_assign_status_id;
330   --
331   -- Return the plsql record structure.
332   --
333   Return(l_rec);
334 --
335 End convert_args;
336 --
337 end pqh_sts_shd;