[Home] [Help]
PACKAGE BODY: APPS.PER_CNL_SHD
Source
1 Package Body per_cnl_shd as
2 /* $Header: pecnlrhi.pkb 120.0 2005/05/31 06:55 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_cnl_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 = 'PER_RI_CONFIG_LOCATIONS_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_location_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 configuration_code
50 ,configuration_context
51 ,location_id
52 ,location_code
53 ,description
54 ,style
55 ,address_line_1
56 ,address_line_2
57 ,address_line_3
58 ,town_or_city
59 ,country
60 ,postal_code
61 ,region_1
62 ,region_2
63 ,region_3
64 ,telephone_number_1
65 ,telephone_number_2
66 ,telephone_number_3
67 ,loc_information13
68 ,loc_information14
69 ,loc_information15
70 ,loc_information16
71 ,loc_information17
72 ,loc_information18
73 ,loc_information19
74 ,loc_information20
75 ,object_version_number
76 from per_ri_config_locations
77 where location_id = p_location_id;
78 --
79 l_fct_ret boolean;
80 --
81 Begin
82 --
83 If (p_location_id is null and
84 p_object_version_number is null
85 ) Then
86 --
87 -- One of the primary key arguments is null therefore we must
88 -- set the returning function value to false
89 --
90 l_fct_ret := false;
91 Else
92 If (p_location_id
93 = per_cnl_shd.g_old_rec.location_id and
94 p_object_version_number
95 = per_cnl_shd.g_old_rec.object_version_number
96 ) Then
97 --
98 -- The g_old_rec is current therefore we must
99 -- set the returning function to true
100 --
101 l_fct_ret := true;
102 Else
103 --
104 -- Select the current row into g_old_rec
105 --
106 Open C_Sel1;
107 Fetch C_Sel1 Into per_cnl_shd.g_old_rec;
108 If C_Sel1%notfound Then
109 Close C_Sel1;
110 --
111 -- The primary key is invalid therefore we must error
112 --
113 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
114 fnd_message.raise_error;
115 End If;
116 Close C_Sel1;
117 If (p_object_version_number
118 <> per_cnl_shd.g_old_rec.object_version_number) Then
119 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
120 fnd_message.raise_error;
121 End If;
122 l_fct_ret := true;
123 End If;
124 End If;
125 Return (l_fct_ret);
126 --
127 End api_updating;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------------< lck >----------------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure lck
133 (p_location_id in number
134 ,p_object_version_number in number
135 ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139 Cursor C_Sel1 is
140 select
141 configuration_code
142 ,configuration_context
143 ,location_id
144 ,location_code
145 ,description
146 ,style
147 ,address_line_1
148 ,address_line_2
149 ,address_line_3
150 ,town_or_city
151 ,country
152 ,postal_code
153 ,region_1
154 ,region_2
155 ,region_3
156 ,telephone_number_1
157 ,telephone_number_2
158 ,telephone_number_3
159 ,loc_information13
160 ,loc_information14
161 ,loc_information15
162 ,loc_information16
163 ,loc_information17
164 ,loc_information18
165 ,loc_information19
166 ,loc_information20
167 ,object_version_number
168 from per_ri_config_locations
169 where location_id = p_location_id
170 for update nowait;
171 --
172 l_proc varchar2(72) := g_package||'lck';
173 --
174 Begin
175 hr_utility.set_location('Entering:'||l_proc, 5);
176 --
177 hr_api.mandatory_arg_error
178 (p_api_name => l_proc
179 ,p_argument => 'LOCATION_ID'
180 ,p_argument_value => p_location_id
181 );
182 hr_utility.set_location(l_proc,6);
183 hr_api.mandatory_arg_error
184 (p_api_name => l_proc
185 ,p_argument => 'OBJECT_VERSION_NUMBER'
186 ,p_argument_value => p_object_version_number
187 );
188 --
189 Open C_Sel1;
190 Fetch C_Sel1 Into per_cnl_shd.g_old_rec;
191 If C_Sel1%notfound then
192 Close C_Sel1;
193 --
194 -- The primary key is invalid therefore we must error
195 --
196 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
197 fnd_message.raise_error;
198 End If;
199 Close C_Sel1;
200 If (p_object_version_number
201 <> per_cnl_shd.g_old_rec.object_version_number) Then
202 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
203 fnd_message.raise_error;
204 End If;
205 --
206 hr_utility.set_location(' Leaving:'||l_proc, 10);
207 --
208 -- We need to trap the ORA LOCK exception
209 --
210 Exception
211 When HR_Api.Object_Locked then
212 --
213 -- The object is locked therefore we need to supply a meaningful
214 -- error message.
215 --
216 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
217 fnd_message.set_token('TABLE_NAME', 'per_ri_config_locations');
218 fnd_message.raise_error;
219 End lck;
220 --
221 -- ----------------------------------------------------------------------------
222 -- |-----------------------------< convert_args >-----------------------------|
223 -- ----------------------------------------------------------------------------
224 Function convert_args
225 (p_configuration_code in varchar2
226 ,p_configuration_context in varchar2
227 ,p_location_id in number
228 ,p_location_code in varchar2
229 ,p_description in varchar2
230 ,p_style in varchar2
231 ,p_address_line_1 in varchar2
232 ,p_address_line_2 in varchar2
233 ,p_address_line_3 in varchar2
234 ,p_town_or_city in varchar2
235 ,p_country in varchar2
236 ,p_postal_code in varchar2
237 ,p_region_1 in varchar2
238 ,p_region_2 in varchar2
239 ,p_region_3 in varchar2
240 ,p_telephone_number_1 in varchar2
241 ,p_telephone_number_2 in varchar2
242 ,p_telephone_number_3 in varchar2
243 ,p_loc_information13 in varchar2
244 ,p_loc_information14 in varchar2
245 ,p_loc_information15 in varchar2
246 ,p_loc_information16 in varchar2
247 ,p_loc_information17 in varchar2
248 ,p_loc_information18 in varchar2
249 ,p_loc_information19 in varchar2
250 ,p_loc_information20 in varchar2
251 ,p_object_version_number in number
252 )
253 Return g_rec_type is
254 --
255 l_rec g_rec_type;
256 --
257 Begin
258 --
259 -- Convert arguments into local l_rec structure.
260 --
261 l_rec.configuration_code := p_configuration_code;
262 l_rec.configuration_context := p_configuration_context;
263 l_rec.location_id := p_location_id;
264 l_rec.location_code := p_location_code;
265 l_rec.description := p_description;
266 l_rec.style := p_style;
267 l_rec.address_line_1 := p_address_line_1;
268 l_rec.address_line_2 := p_address_line_2;
269 l_rec.address_line_3 := p_address_line_3;
270 l_rec.town_or_city := p_town_or_city;
271 l_rec.country := p_country;
272 l_rec.postal_code := p_postal_code;
273 l_rec.region_1 := p_region_1;
274 l_rec.region_2 := p_region_2;
275 l_rec.region_3 := p_region_3;
276 l_rec.telephone_number_1 := p_telephone_number_1;
277 l_rec.telephone_number_2 := p_telephone_number_2;
278 l_rec.telephone_number_3 := p_telephone_number_3;
279 l_rec.loc_information13 := p_loc_information13;
280 l_rec.loc_information14 := p_loc_information14;
281 l_rec.loc_information15 := p_loc_information15;
282 l_rec.loc_information16 := p_loc_information16;
283 l_rec.loc_information17 := p_loc_information17;
284 l_rec.loc_information18 := p_loc_information18;
285 l_rec.loc_information19 := p_loc_information19;
286 l_rec.loc_information20 := p_loc_information20;
287 l_rec.object_version_number := p_object_version_number;
288 --
289 -- Return the plsql record structure.
290 --
291 Return(l_rec);
292 --
293 End convert_args;
294 --
295 end per_cnl_shd;