[Home] [Help]
PACKAGE BODY: APPS.PQP_GB_PSI_LOCATION_CODES
Source
1 PACKAGE BODY PQP_GB_PSI_LOCATION_CODES AS
2 -- /* $Header: pqpgbpsiloc.pkb 120.0 2006/04/13 05:02:20 anshghos noship $ */
3
4 -- Exceptions
5 hr_application_error exception;
6 pragma exception_init (hr_application_error, -20001);
7
8
9 g_nested_level NUMBER(5) := pqp_utilities.g_nested_level;
10 -- ----------------------------------------------------------------------------
11 -- |--------------------------------< debug >---------------------------------|
12 -- ----------------------------------------------------------------------------
13
14 PROCEDURE DEBUG (p_trace_message IN VARCHAR2, p_trace_location IN NUMBER)
15 IS
16
17 --
18 BEGIN
19 --
20
21 pqp_utilities.DEBUG (
22 p_trace_message => p_trace_message
23 ,p_trace_location => p_trace_location
24 );
25 --
26 END DEBUG;
27
28
29 -- This procedure is used for debug purposes
30 -- debug_enter checks the debug flag and sets the trace on/off
31 --
32 -- ----------------------------------------------------------------------------
33 -- |----------------------------< debug_enter >-------------------------------|
34 -- ----------------------------------------------------------------------------
35
36 PROCEDURE debug_enter (p_proc_name IN VARCHAR2, p_trace_on IN VARCHAR2)
37 IS
38 BEGIN
39 --
40 IF g_debug THEN
41 IF pqp_utilities.g_nested_level = 0 THEN
42 hr_utility.trace_on(NULL, 'REQID'); -- Pipe name REQIDnnnnn
43 END IF;
44 pqp_utilities.debug_enter (
45 p_proc_name => p_proc_name
46 ,p_trace_on => p_trace_on
47 );
48 END IF;
49 --
50
51 END debug_enter;
52
53
54 -- This procedure is used for debug purposes
55 --
56 -- ----------------------------------------------------------------------------
57 -- |----------------------------< debug_exit >--------------------------------|
58 -- ----------------------------------------------------------------------------
59
60 PROCEDURE debug_exit (p_proc_name IN VARCHAR2, p_trace_off IN VARCHAR2)
61 IS
62 BEGIN
63 --
64 IF g_debug THEN
65 pqp_utilities.debug_exit (
66 p_proc_name => p_proc_name
67 ,p_trace_off => p_trace_off
68 );
69
70 IF pqp_utilities.g_nested_level = 0 THEN
71 hr_utility.trace_off;
72 END IF;
73 END IF;
74 --
75 END debug_exit;
76
77 -- This procedure is used for debug purposes
78 --
79 -- ----------------------------------------------------------------------------
80 -- |----------------------------< debug_others >------------------------------|
81 -- ----------------------------------------------------------------------------
82
83 PROCEDURE debug_others (p_proc_name IN VARCHAR2, p_proc_step IN NUMBER)
84 IS
85 BEGIN
86 --
87 pqp_utilities.debug_others (
88 p_proc_name => p_proc_name
89 ,p_proc_step => p_proc_step
90 );
91 --
92 END debug_others;
93
94
95
96 -- This procedure is used to clear all cached global variables
97 --
98 -- ----------------------------------------------------------------------------
99 -- |----------------------------< clear_cache >-------------------------------|
100 -- ----------------------------------------------------------------------------
101 PROCEDURE clear_cache
102 IS
103 --
104 l_proc_name VARCHAR2(80) := g_proc_name || 'clear_cache';
105 l_proc_step PLS_INTEGER;
106 --
107 BEGIN
108 --
109 IF g_debug
110 THEN
111 l_proc_step := 10;
112 debug_enter(l_proc_name);
113 END IF;
114
115
116
117 IF g_debug
118 THEN
119 debug_exit(l_proc_name);
120 END IF;
121 EXCEPTION
122 WHEN others THEN
123 IF SQLCODE <> hr_utility.hr_error_number
124 THEN
125 debug_others (l_proc_name, l_proc_step);
126 IF g_debug
127 THEN
128 DEBUG ( 'Leaving: '
129 || l_proc_name, -999);
130 END IF;
131 fnd_message.raise_error;
132 ELSE
133 RAISE;
134 END IF;
135 END clear_cache;
136
137
138 -- ----------------------------------------------------------------------------
139 -- |------------------------< chk_location_codes_crit >-------------------|
140 -- ----------------------------------------------------------------------------
141
142 FUNCTION chk_location_codes_crit
143 (p_business_group_id IN NUMBER
144 ,p_loc_id IN VARCHAR2
145 )
146 RETURN VARCHAR2
147 IS
148 --
149 l_proc_name VARCHAR2(61):=
150 g_proc_name||'chk_location_codes_crit';
151
152 l_return VARCHAR2(1) := 'N';
153 l_loc_id NUMBER;
154 l_location_name VARCHAR2(80) := NULL;
155 l_value NUMBER;
156 --
157 BEGIN
158 --
159
160 debug_enter(l_proc_name);
161
162 IF g_business_group_id IS NULL
163 THEN
164 clear_cache;
165 g_business_group_id := p_business_group_id;
166 g_paypoint := PQP_GB_PSI_FUNCTIONS.paypoint(p_business_group_id);
167
168 g_debug := pqp_gb_psi_functions.check_debug(g_business_group_id);
169
170 IF g_paypoint = ''
171 or
172 NOT PQP_GB_PSI_FUNCTIONS.is_alphanumeric(p_string=> g_paypoint)
173 THEN
174 l_value := PQP_GB_PSI_FUNCTIONS.raise_extract_warning
175 (p_assignment_id => -1
176 ,p_error_number => 94453
177 ,p_error_text => 'BEN_94453_INV_PAYPOINT'
178 );
179 END IF;
180
181 END IF;
182
183 debug('Entering chk_location_codes_crit ...',10);
184
185 l_loc_id := FND_NUMBER.canonical_to_number(p_loc_id);
186
187
188 IF l_loc_id = -1
189 THEN
190 l_return := 'Y';
191 debug('l_loc_id (was null) : ' || l_loc_id, 14);
192 ELSE
193 OPEN csr_location_code(l_loc_id);
194 FETCH csr_location_code into g_loc_code;
195 IF csr_location_code%FOUND THEN
196
197 l_return := 'Y';
198 -- check for special characters
199 IF NOT PQP_GB_PSI_FUNCTIONS.is_alphanumeric(p_string=> g_loc_code) THEN
200 -- store warning
201 OPEN csr_location_name(l_loc_id);
202 FETCH csr_location_name into l_location_name;
203 IF csr_location_name%FOUND THEN
204 l_value := PQP_GB_PSI_FUNCTIONS.raise_extract_warning
205 (p_assignment_id => -(l_loc_id)
206 ,p_error_number => 94451
207 ,p_error_text => 'BEN_94451_INV_LOC_CODE'
208 ,p_token1 => l_location_name
209 );
210 END IF;
211 CLOSE csr_location_name;
212
213 END IF;
214 ELSE
215 l_return := 'N';
216 END IF;
217 CLOSE csr_location_code;
218 END IF;
219
220 debug('l_return : ' || l_return,17);
221
222 debug('Exiting chk_location_codes_crit ...',20);
223 debug_exit(l_proc_name);
224
225 return l_return;
226
227 EXCEPTION
228 WHEN others THEN
229 IF SQLCODE <> hr_utility.hr_error_number
230 THEN
231 debug_others (l_proc_name, 10);
232 IF g_debug
233 THEN
234 DEBUG ( 'Leaving: '
235 || l_proc_name, -999);
236 END IF;
237 fnd_message.raise_error;
238 ELSE
239 RAISE;
240 END IF;
241
242 END chk_location_codes_crit;
243
244
245
246
247 -- ----------------------------------------------------------------------------
248 -- |------------------------< location_extract_main >----------------------------|
249 -- ----------------------------------------------------------------------------
250
251 FUNCTION location_extract_main
252 (p_rule_parameter IN VARCHAR2 -- parameter
253 ,p_output OUT NOCOPY VARCHAR2
254 )
255 RETURN number IS
256 --
257
258 l_proc_name VARCHAR2(61):=
259 g_proc_name||'location_extract_main';
260 l_value number;
261 l_effective_date DATE;
262 --
263 BEGIN
264
265 debug_enter(l_proc_name);
266
267 -- switch on the trace
268
269 debug('Entering basic_extract_main ...',0);
270 debug('p_rule_parameter'||p_rule_parameter,1);
271
272
273 -- select the function call based on the parameter being passed to the rule
274 IF p_rule_parameter = 'PayPoint' THEN
275 debug('About to enter PayPoint location',20);
276 p_output := g_paypoint;
277 debug('paypoint : '|| p_output,25);
278
279 ELSIF p_rule_parameter = 'LocCode' THEN
280 debug('About to enter LocCode function',30);
281 p_output := g_loc_code;
282 debug('LocCode : '|| p_output,25);
283
284 END IF;
285 debug_exit(l_proc_name);
286
287 RETURN 0;
288
289 EXCEPTION
290 WHEN others THEN
291 IF SQLCODE <> hr_utility.hr_error_number
292 THEN
293 debug_others (l_proc_name, 10);
294 IF g_debug
295 THEN
296 DEBUG ( 'Leaving: '
297 || l_proc_name, -999);
298 END IF;
299 fnd_message.raise_error;
300 ELSE
301 RAISE;
302 END IF;
303
304 END location_extract_main;
305
306
307 -- ----------------------------------------------------------------------------
308 -- |------------------------< location_codes_post_processing >------------------|
309 -- ----------------------------------------------------------------------------
310
311 FUNCTION location_codes_post_processing RETURN VARCHAR2
312 IS
313
314 l_proc_name VARCHAR2(61):=
315 g_proc_name||'location_codes_post_processing';
316
317 BEGIN -- basic_data_post_proc_rule
318
319 debug_enter(l_proc_name);
320
321 debug_exit(l_proc_name);
322
323 RETURN 'Y';
324
325
326 EXCEPTION
327 WHEN others THEN
328 IF SQLCODE <> hr_utility.hr_error_number
329 THEN
330 debug_others (l_proc_name, 10);
331 IF g_debug
332 THEN
333 DEBUG ( 'Leaving: '
334 || l_proc_name, -999);
335 END IF;
336 fnd_message.raise_error;
337 ELSE
338 RAISE;
339 END IF;
340
341 END location_codes_post_processing; -- basic_data_post_proc_rule
342
343
344 END PQP_GB_PSI_LOCATION_CODES;