DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_VLP_SHD

Source


1 Package Body pqh_vlp_shd as
2 /* $Header: pqvlprhi.pkb 115.6 2004/03/31 00:31:40 kgowripe noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_vlp_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 = 'PQH_VLP_FK') 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 = 'PQH_VLP_PK') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_validation_period_id                 in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48   --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        validation_period_id
55       ,validation_id
56       ,start_date
57       ,end_date
58       ,previous_employer_id
59       ,assignment_category
60       ,normal_hours
61       ,frequency
62       ,period_years
63       ,period_months
64       ,period_days
65       ,comments
66       ,validation_status
67       ,object_version_number
68     from        pqh_fr_validation_periods
69     where       validation_period_id = p_validation_period_id;
70   --
71   l_fct_ret     boolean;
72   --
73 Begin
74   --
75   If (p_validation_period_id is null and
76       p_object_version_number is null
77      ) Then
78     --
79     -- One of the primary key arguments is null therefore we must
80     -- set the returning function value to false
81     --
82     l_fct_ret := false;
83   Else
84     If (p_validation_period_id
85         = pqh_vlp_shd.g_old_rec.validation_period_id and
86         p_object_version_number
87         = pqh_vlp_shd.g_old_rec.object_version_number
88        ) Then
89       --
90       -- The g_old_rec is current therefore we must
91       -- set the returning function to true
92       --
93       l_fct_ret := true;
94     Else
95       --
96       -- Select the current row into g_old_rec
97       --
98       Open C_Sel1;
99       Fetch C_Sel1 Into pqh_vlp_shd.g_old_rec;
100       If C_Sel1%notfound Then
101         Close C_Sel1;
102         --
103         -- The primary key is invalid therefore we must error
104         --
105         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
106         fnd_message.raise_error;
107       End If;
108       Close C_Sel1;
109       If (p_object_version_number
110           <> pqh_vlp_shd.g_old_rec.object_version_number) Then
111         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
112         fnd_message.raise_error;
113       End If;
114       l_fct_ret := true;
115     End If;
116   End If;
117   Return (l_fct_ret);
118 --
119 End api_updating;
120 --
121 -- ----------------------------------------------------------------------------
122 -- |---------------------------------< lck >----------------------------------|
123 -- ----------------------------------------------------------------------------
124 Procedure lck
125   (p_validation_period_id                 in     number
126   ,p_object_version_number                in     number
127   ) is
128 --
129 -- Cursor selects the 'current' row from the HR Schema
130 --
131   Cursor C_Sel1 is
132     select
133        validation_period_id
134       ,validation_id
135       ,start_date
136       ,end_date
137       ,previous_employer_id
138       ,assignment_category
139       ,normal_hours
140       ,frequency
141       ,period_years
142       ,period_months
143       ,period_days
144       ,comments
145       ,validation_status
146       ,object_version_number
147     from        pqh_fr_validation_periods
148     where       validation_period_id = p_validation_period_id
149     for update nowait;
150 --
151   l_proc        varchar2(72) := g_package||'lck';
152 --
153 Begin
154   hr_utility.set_location('Entering:'||l_proc, 5);
155   --
156   hr_api.mandatory_arg_error
157     (p_api_name           => l_proc
158     ,p_argument           => 'VALIDATION_PERIOD_ID'
159     ,p_argument_value     => p_validation_period_id
160     );
161   hr_utility.set_location(l_proc,6);
162   hr_api.mandatory_arg_error
163     (p_api_name           => l_proc
164     ,p_argument           => 'OBJECT_VERSION_NUMBER'
165     ,p_argument_value     => p_object_version_number
166     );
167   --
168   Open  C_Sel1;
169   Fetch C_Sel1 Into pqh_vlp_shd.g_old_rec;
170   If C_Sel1%notfound then
171     Close C_Sel1;
172     --
173     -- The primary key is invalid therefore we must error
174     --
175     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
176     fnd_message.raise_error;
177   End If;
178   Close C_Sel1;
179   If (p_object_version_number
180       <> pqh_vlp_shd.g_old_rec.object_version_number) Then
181         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
182         fnd_message.raise_error;
183   End If;
184   --
185   hr_utility.set_location(' Leaving:'||l_proc, 10);
186   --
187   -- We need to trap the ORA LOCK exception
188   --
189 Exception
190   When HR_Api.Object_Locked then
191     --
192     -- The object is locked therefore we need to supply a meaningful
193     -- error message.
194     --
195     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
196     fnd_message.set_token('TABLE_NAME', 'pqh_fr_validation_periods');
197     fnd_message.raise_error;
198 End lck;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< convert_args >-----------------------------|
202 -- ----------------------------------------------------------------------------
203 Function convert_args
204   (p_validation_period_id           in number
205   ,p_validation_id                  in number
206   ,p_start_date                     in date
207   ,p_end_date                       in date
208   ,p_previous_employer_id           in number
209   ,p_assignment_category	    in varchar2
210   ,p_normal_hours                   in number
211   ,p_frequency                      in varchar2
212   ,p_period_years                   in number
213   ,p_period_months                  in number
214   ,p_period_days                    in number
215   ,p_comments                       in varchar2
216   ,p_validation_status              in varchar2
217   ,p_object_version_number          in number
218   )
219   Return g_rec_type is
220 --
221   l_rec   g_rec_type;
222 --
223 Begin
224   --
225   -- Convert arguments into local l_rec structure.
226   --
227   l_rec.validation_period_id             := p_validation_period_id;
228   l_rec.validation_id                    := p_validation_id;
229   l_rec.start_date                       := p_start_date;
230   l_rec.end_date                         := p_end_date;
231   l_rec.previous_employer_id             := p_previous_employer_id;
232   l_rec.assignment_category		 := p_assignment_category;
233   l_rec.normal_hours                     := p_normal_hours;
234   l_rec.frequency                        := p_frequency;
235   l_rec.period_years                     := p_period_years;
236   l_rec.period_months                    := p_period_months;
237   l_rec.period_days                      := p_period_days;
238   l_rec.comments                         := p_comments;
239   l_rec.validation_status                := p_validation_status;
240   l_rec.object_version_number            := p_object_version_number;
241   --
242   -- Return the plsql record structure.
243   --
244   Return(l_rec);
245 --
246 End convert_args;
247 --
248 end pqh_vlp_shd;