94: and person_id = p_person_id;
95:
96: CURSOR cFndUser(cp_user_id NUMBER) is
97: SELECT 'x'
98: FROM fnd_user
99: WHERE sysdate between start_date and nvl(end_date, sysdate)
100: and user_id = cp_user_id;
101:
102: l_op_enabled Varchar2(1) := 'Y'; -- Added for bug 11800630
172: END IF;
173:
174: IF l_requestor_type IS NULL -- For Backward compatibility
175: THEN
176: l_requestor_type := 'FND_USER/EMPLOYEE';
177: ELSIF l_requestor_type IS NOT NULL AND
178: l_requestor_type NOT IN ('EMPLOYEE', 'FND_USER')
179: THEN
180: IF pg_debug = 'Y'
174: IF l_requestor_type IS NULL -- For Backward compatibility
175: THEN
176: l_requestor_type := 'FND_USER/EMPLOYEE';
177: ELSIF l_requestor_type IS NOT NULL AND
178: l_requestor_type NOT IN ('EMPLOYEE', 'FND_USER')
179: THEN
180: IF pg_debug = 'Y'
181: THEN
182: debug ( 'Invalid Requestor Type ' || l_requestor_type );
189: END IF;
190:
191: debug ( 'l_requestor_type ' || l_requestor_type );
192:
193: IF l_requestor_type = 'FND_USER/EMPLOYEE'
194: THEN
195: /* Not Sure of the Source since p_request_type is passed as NULL
196: In that case first check the requestor ID, if its passed as -1
197: or NULL then take the FND_GLOBAL.USER_ID and set the request
194: THEN
195: /* Not Sure of the Source since p_request_type is passed as NULL
196: In that case first check the requestor ID, if its passed as -1
197: or NULL then take the FND_GLOBAL.USER_ID and set the request
198: type as FND_USER.
199:
200: If the Requestor ID is not NULL or <> -1 then check if the
201: Requestor is an Employee
202: Else check if the Requestor is a FND User
198: type as FND_USER.
199:
200: If the Requestor ID is not NULL or <> -1 then check if the
201: Requestor is an Employee
202: Else check if the Requestor is a FND User
203: */
204:
205: IF l_requestor_id IS NULL OR l_requestor_id = -1
206: THEN
203: */
204:
205: IF l_requestor_id IS NULL OR l_requestor_id = -1
206: THEN
207: debug('p_requestor_type is passed as NULL, p_requestor_id is NULL or -1, use FND USER');
208: l_requestor_id := FND_GLOBAL.USER_ID;
209: l_requestor_type := 'FND_USER';
210: debug('p_requestor_type is passed as NULL, l_requestor_id:'||
211: l_requestor_id||' l_requestor_type :'||l_requestor_type);
205: IF l_requestor_id IS NULL OR l_requestor_id = -1
206: THEN
207: debug('p_requestor_type is passed as NULL, p_requestor_id is NULL or -1, use FND USER');
208: l_requestor_id := FND_GLOBAL.USER_ID;
209: l_requestor_type := 'FND_USER';
210: debug('p_requestor_type is passed as NULL, l_requestor_id:'||
211: l_requestor_id||' l_requestor_type :'||l_requestor_type);
212: ELSE
213: debug('p_requestor_type is passed as NULL, check both EMPLOYEE and FND_USER');
209: l_requestor_type := 'FND_USER';
210: debug('p_requestor_type is passed as NULL, l_requestor_id:'||
211: l_requestor_id||' l_requestor_type :'||l_requestor_type);
212: ELSE
213: debug('p_requestor_type is passed as NULL, check both EMPLOYEE and FND_USER');
214: OPEN employee(l_requestor_id);
215: FETCH employee INTO l_char;
216: IF employee%NOTFOUND
217: THEN
219: OPEN cFndUser(l_requestor_id);
220: FETCH cFndUser INTO l_char;
221: IF cFndUser%NOTFOUND
222: THEN
223: debug('p_requestor_type is passed as NULL, FND_USER check failed');
224: x_return_status := FND_API.G_RET_STS_ERROR;
225: ELSE
226: -- The Requestor is a FND User, set the Requestor Type
227: l_requestor_type := 'FND_USER';
222: THEN
223: debug('p_requestor_type is passed as NULL, FND_USER check failed');
224: x_return_status := FND_API.G_RET_STS_ERROR;
225: ELSE
226: -- The Requestor is a FND User, set the Requestor Type
227: l_requestor_type := 'FND_USER';
228: END IF;
229: CLOSE cFndUser;
230:
223: debug('p_requestor_type is passed as NULL, FND_USER check failed');
224: x_return_status := FND_API.G_RET_STS_ERROR;
225: ELSE
226: -- The Requestor is a FND User, set the Requestor Type
227: l_requestor_type := 'FND_USER';
228: END IF;
229: CLOSE cFndUser;
230:
231: ELSE
247: debug('p_requestor_type is passed, Employee check is failed');
248: x_return_status := FND_API.G_RET_STS_ERROR;
249: END IF;
250: CLOSE employee;
251: ELSIF l_requestor_id IS NOT NULL and l_requestor_type = 'FND_USER'
252: THEN
253: OPEN cFndUser(l_requestor_id);
254: FETCH cFndUser INTO l_char;
255: IF cFndUser%NOTFOUND
253: OPEN cFndUser(l_requestor_id);
254: FETCH cFndUser INTO l_char;
255: IF cFndUser%NOTFOUND
256: THEN
257: debug('p_requestor_type is passed, FND USER check is failed');
258: x_return_status := FND_API.G_RET_STS_ERROR;
259: END IF;
260: CLOSE cFndUser;
261: ELSE
592: x_return_status := FND_API.G_RET_STS_ERROR;
593: END IF;
594: CLOSE employee;
595: ELSIF l_requestor_id IS NOT NULL and l_requestor_type =
596: 'FND_USER'
597: THEN
598: OPEN cFndUser(l_requestor_id);
599: FETCH cFndUser INTO l_char;
600: IF cFndUser%NOTFOUND