DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_VLD_SHD

Source


1 Package Body pqh_vld_shd as
2 /* $Header: pqvldrhi.pkb 115.2 2002/12/13 00:33:20 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_vld_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_VLD_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_validation_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        validation_id
50       ,pension_fund_type_code
51       ,pension_fund_id
52       ,business_group_id
53       ,person_id
54       ,request_date
55       ,completion_date
56       ,previous_employer_id
57       ,previously_validated_flag
58       ,status
59       ,employer_amount
60       ,employer_currency_code
61       ,employee_amount
62       ,employee_currency_code
63       ,deduction_per_period
64       ,deduction_currency_code
65       ,percent_of_salary
66       ,object_version_number
67     from        pqh_fr_validations
68     where       validation_id = p_validation_id;
69   --
70   l_fct_ret     boolean;
71   --
72 Begin
73   --
74   If (p_validation_id is null and
75       p_object_version_number is null
76      ) Then
77     --
78     -- One of the primary key arguments is null therefore we must
79     -- set the returning function value to false
80     --
81     l_fct_ret := false;
82   Else
83     If (p_validation_id
84         = pqh_vld_shd.g_old_rec.validation_id and
85         p_object_version_number
86         = pqh_vld_shd.g_old_rec.object_version_number
87        ) Then
88       --
89       -- The g_old_rec is current therefore we must
90       -- set the returning function to true
91       --
92       l_fct_ret := true;
93     Else
94       --
95       -- Select the current row into g_old_rec
96       --
97       Open C_Sel1;
98       Fetch C_Sel1 Into pqh_vld_shd.g_old_rec;
99       If C_Sel1%notfound Then
100         Close C_Sel1;
101         --
102         -- The primary key is invalid therefore we must error
103         --
104         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
105         fnd_message.raise_error;
106       End If;
107       Close C_Sel1;
108       If (p_object_version_number
109           <> pqh_vld_shd.g_old_rec.object_version_number) Then
110         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
111         fnd_message.raise_error;
112       End If;
113       l_fct_ret := true;
114     End If;
115   End If;
116   Return (l_fct_ret);
117 --
118 End api_updating;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |---------------------------------< lck >----------------------------------|
122 -- ----------------------------------------------------------------------------
123 Procedure lck
124   (p_validation_id                        in     number
125   ,p_object_version_number                in     number
126   ) is
127 --
128 -- Cursor selects the 'current' row from the HR Schema
129 --
130   Cursor C_Sel1 is
131     select
132        validation_id
133       ,pension_fund_type_code
134       ,pension_fund_id
135       ,business_group_id
136       ,person_id
137       ,request_date
138       ,completion_date
139       ,previous_employer_id
140       ,previously_validated_flag
141       ,status
142       ,employer_amount
143       ,employer_currency_code
144       ,employee_amount
145       ,employee_currency_code
146       ,deduction_per_period
147       ,deduction_currency_code
148       ,percent_of_salary
149       ,object_version_number
150     from        pqh_fr_validations
151     where       validation_id = p_validation_id
152     for update nowait;
153 --
154   l_proc        varchar2(72) := g_package||'lck';
155 --
156 Begin
157   hr_utility.set_location('Entering:'||l_proc, 5);
158   --
159   hr_api.mandatory_arg_error
160     (p_api_name           => l_proc
161     ,p_argument           => 'VALIDATION_ID'
162     ,p_argument_value     => p_validation_id
163     );
164   hr_utility.set_location(l_proc,6);
165   hr_api.mandatory_arg_error
166     (p_api_name           => l_proc
167     ,p_argument           => 'OBJECT_VERSION_NUMBER'
168     ,p_argument_value     => p_object_version_number
169     );
170   --
171   Open  C_Sel1;
172   Fetch C_Sel1 Into pqh_vld_shd.g_old_rec;
173   If C_Sel1%notfound then
174     Close C_Sel1;
175     --
176     -- The primary key is invalid therefore we must error
177     --
178     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
179     fnd_message.raise_error;
180   End If;
181   Close C_Sel1;
182   If (p_object_version_number
183       <> pqh_vld_shd.g_old_rec.object_version_number) Then
184         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
185         fnd_message.raise_error;
186   End If;
187   --
188   hr_utility.set_location(' Leaving:'||l_proc, 10);
189   --
190   -- We need to trap the ORA LOCK exception
191   --
192 Exception
193   When HR_Api.Object_Locked then
194     --
195     -- The object is locked therefore we need to supply a meaningful
196     -- error message.
197     --
198     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
199     fnd_message.set_token('TABLE_NAME', 'pqh_fr_validations');
200     fnd_message.raise_error;
201 End lck;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |-----------------------------< convert_args >-----------------------------|
205 -- ----------------------------------------------------------------------------
206 Function convert_args
207   (p_validation_id                  in number
208   ,p_pension_fund_type_code         in varchar2
209   ,p_pension_fund_id                in number
210   ,p_business_group_id              in number
211   ,p_person_id                      in number
212   ,p_request_date                   in date
213   ,p_completion_date                in date
214   ,p_previous_employer_id           in number
215   ,p_previously_validated_flag      in varchar2
216   ,p_status                         in varchar2
217   ,p_employer_amount                in number
218   ,p_employer_currency_code         in varchar2
219   ,p_employee_amount                in number
220   ,p_employee_currency_code         in varchar2
221   ,p_deduction_per_period           in number
222   ,p_deduction_currency_code        in varchar2
223   ,p_percent_of_salary              in number
224   ,p_object_version_number          in number
225   )
226   Return g_rec_type is
227 --
228   l_rec   g_rec_type;
229 --
230 Begin
231   --
232   -- Convert arguments into local l_rec structure.
233   --
234   l_rec.validation_id                    := p_validation_id;
235   l_rec.pension_fund_type_code           := p_pension_fund_type_code;
236   l_rec.pension_fund_id                  := p_pension_fund_id;
237   l_rec.business_group_id                := p_business_group_id;
238   l_rec.person_id                        := p_person_id;
239   l_rec.request_date                     := p_request_date;
240   l_rec.completion_date                  := p_completion_date;
241   l_rec.previous_employer_id             := p_previous_employer_id;
242   l_rec.previously_validated_flag        := p_previously_validated_flag;
243   l_rec.status                           := p_status;
244   l_rec.employer_amount                  := p_employer_amount;
245   l_rec.employer_currency_code           := p_employer_currency_code;
246   l_rec.employee_amount                  := p_employee_amount;
247   l_rec.employee_currency_code           := p_employee_currency_code;
248   l_rec.deduction_per_period             := p_deduction_per_period;
249   l_rec.deduction_currency_code          := p_deduction_currency_code;
250   l_rec.percent_of_salary                := p_percent_of_salary;
251   l_rec.object_version_number            := p_object_version_number;
252   --
253   -- Return the plsql record structure.
254   --
255   Return(l_rec);
256 --
257 End convert_args;
258 --
259 end pqh_vld_shd;