DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_GDA_SHD

Source


1 Package Body pqp_gda_shd as
2 /* $Header: pqgdarhi.pkb 120.0 2005/05/29 01:52:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_gda_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 = 'PQP_GAP_DAILY_ABSENCES_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   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_gap_daily_absence_id                 in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        gap_daily_absence_id
50       ,gap_absence_plan_id
51       ,absence_date
52       ,work_pattern_day_type
53       ,level_of_entitlement
54       ,level_of_pay
55       ,duration
56       ,duration_in_hours
57       ,working_days_per_week
58       ,fte -- LG
59       ,object_version_number
60     from        pqp_gap_daily_absences
61     where       gap_daily_absence_id = p_gap_daily_absence_id;
62   --
63   l_fct_ret     boolean;
64   --
65 Begin
66   --
67   If (p_gap_daily_absence_id is null and
68       p_object_version_number is null
69      ) Then
70     --
71     -- One of the primary key arguments is null therefore we must
72     -- set the returning function value to false
73     --
74     l_fct_ret := false;
75   Else
76     If (p_gap_daily_absence_id
77         = pqp_gda_shd.g_old_rec.gap_daily_absence_id and
78         p_object_version_number
79         = pqp_gda_shd.g_old_rec.object_version_number
80        ) Then
81       --
82       -- The g_old_rec is current therefore we must
83       -- set the returning function to true
84       --
85       l_fct_ret := true;
86     Else
87       --
88       -- Select the current row into g_old_rec
89       --
90       Open C_Sel1;
91       Fetch C_Sel1 Into pqp_gda_shd.g_old_rec;
92       If C_Sel1%notfound Then
93         Close C_Sel1;
94         --
95         -- The primary key is invalid therefore we must error
96         --
97         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
98         fnd_message.raise_error;
99       End If;
100       Close C_Sel1;
101       If (p_object_version_number
102           <> pqp_gda_shd.g_old_rec.object_version_number) Then
103         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
104         fnd_message.raise_error;
105       End If;
106       l_fct_ret := true;
107     End If;
108   End If;
109   Return (l_fct_ret);
110 --
111 End api_updating;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |---------------------------------< lck >----------------------------------|
115 -- ----------------------------------------------------------------------------
116 Procedure lck
117   (p_gap_daily_absence_id                 in     number
118   ,p_object_version_number                in     number
119   ) is
120 --
121 -- Cursor selects the 'current' row from the HR Schema
122 --
123   Cursor C_Sel1 is
124     select
125        gap_daily_absence_id
126       ,gap_absence_plan_id
127       ,absence_date
128       ,work_pattern_day_type
129       ,level_of_entitlement
130       ,level_of_pay
131       ,duration
132       ,duration_in_hours
133       ,working_days_per_week
134       ,fte -- LG
135       ,object_version_number
136     from        pqp_gap_daily_absences
137     where       gap_daily_absence_id = p_gap_daily_absence_id
138     for update nowait;
139 --
140   l_proc        varchar2(72) := g_package||'lck';
141 --
142 Begin
143   hr_utility.set_location('Entering:'||l_proc, 5);
144   --
145   hr_api.mandatory_arg_error
146     (p_api_name           => l_proc
147     ,p_argument           => 'GAP_DAILY_ABSENCE_ID'
148     ,p_argument_value     => p_gap_daily_absence_id
149     );
150   hr_utility.set_location(l_proc,6);
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'OBJECT_VERSION_NUMBER'
154     ,p_argument_value     => p_object_version_number
155     );
156   --
157   Open  C_Sel1;
158   Fetch C_Sel1 Into pqp_gda_shd.g_old_rec;
159   If C_Sel1%notfound then
160     Close C_Sel1;
161     --
162     -- The primary key is invalid therefore we must error
163     --
164     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
165     fnd_message.raise_error;
166   End If;
167   Close C_Sel1;
168   If (p_object_version_number
169       <> pqp_gda_shd.g_old_rec.object_version_number) Then
170         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
171         fnd_message.raise_error;
172   End If;
173   --
174   hr_utility.set_location(' Leaving:'||l_proc, 10);
175   --
176   -- We need to trap the ORA LOCK exception
177   --
178 Exception
179   When HR_Api.Object_Locked then
180     --
181     -- The object is locked therefore we need to supply a meaningful
182     -- error message.
183     --
184     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
185     fnd_message.set_token('TABLE_NAME', 'pqp_gap_daily_absences');
186     fnd_message.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193   (p_gap_daily_absence_id           in number
194   ,p_gap_absence_plan_id            in number
195   ,p_absence_date                   in date
196   ,p_work_pattern_day_type          in varchar2
197   ,p_level_of_entitlement           in varchar2
198   ,p_level_of_pay                   in varchar2
199   ,p_duration                       in number
200   ,p_duration_in_hours              in number
201   ,p_working_days_per_week          in number
202   ,p_fte                            in number -- LG
203   ,p_object_version_number          in number
204   )
205   Return g_rec_type is
206 --
207   l_rec   g_rec_type;
208 --
209 Begin
210   --
211   -- Convert arguments into local l_rec structure.
212   --
213   l_rec.gap_daily_absence_id             := p_gap_daily_absence_id;
214   l_rec.gap_absence_plan_id              := p_gap_absence_plan_id;
215   l_rec.absence_date                     := p_absence_date;
216   l_rec.work_pattern_day_type            := p_work_pattern_day_type;
217   l_rec.level_of_entitlement             := p_level_of_entitlement;
218   l_rec.level_of_pay                     := p_level_of_pay;
219   l_rec.duration                         := p_duration;
220   l_rec.duration_in_hours                := p_duration_in_hours;
221   l_rec.working_days_per_week            := p_working_days_per_week;
222   l_rec.fte                              := p_fte;
223   l_rec.object_version_number            := p_object_version_number;
224   --
225   -- Return the plsql record structure.
226   --
227   Return(l_rec);
228 --
229 End convert_args;
230 --
231 end pqp_gda_shd;