139: SAVEPOINT Workorder_Login_Pvt;
140:
141: -- Initialize message list if p_init_msg_list is set to TRUE
142: IF FND_API.To_Boolean(p_init_msg_list) THEN
143: FND_MSG_PUB.Initialize;
144: END IF;
145:
146: -- Initialize Procedure return status to success
147: x_return_status := FND_API.G_RET_STS_SUCCESS;
194:
195: IF (NVL(FND_PROFILE.value('AHL_MANUAL_RES_TXN'),'N') = 'Y') OR
196: (l_user_role = AHL_PRD_UTIL_PKG.G_DATA_CLERK) THEN
197: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_AUTOTXN_DSBLD');
198: FND_MSG_PUB.ADD;
199: RAISE FND_API.G_EXC_ERROR;
200: END IF;
201:
202: -- Initialize local variables.
246: -- Validate workorder.
247: IF (l_workorder_id IS NULL) THEN
248: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_NULL');
249: --FND_MESSAGE.set_token('WO_ID',l_workorder_id);
250: FND_MSG_PUB.ADD;
251: RAISE FND_API.G_EXC_ERROR;
252: ELSE
253: -- get WO number to display error message.
254: OPEN c_wo_name(p_workorder_id);
256: IF (c_wo_name%NOTFOUND) THEN
257: CLOSE c_wo_name;
258: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_INVALID');
259: FND_MESSAGE.set_token('WO_ID',l_workorder_id);
260: FND_MSG_PUB.ADD;
261: RAISE FND_API.G_EXC_ERROR;
262:
263: END IF;
264:
359: COMMIT WORK;
360: END IF;
361:
362: -- Standard call to get message count and if count is 1, get message info
363: FND_MSG_PUB.Count_And_Get
364: ( p_count => x_msg_count,
365: p_data => x_msg_data,
366: p_encoded => fnd_api.g_false
367: );
376: EXCEPTION
377: WHEN FND_API.G_EXC_ERROR THEN
378: x_return_status := FND_API.G_RET_STS_ERROR;
379: Rollback to Workorder_Login_PVT;
380: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
381: p_data => x_msg_data,
382: p_encoded => fnd_api.g_false);
383:
384:
384:
385: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
386: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
387: Rollback to Workorder_Login_PVT;
388: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
389: p_data => x_msg_data,
390: p_encoded => fnd_api.g_false);
391:
392: WHEN OTHERS THEN
392: WHEN OTHERS THEN
393:
394: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
395: Rollback to Workorder_Login_PVT;
396: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
397: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
398: p_procedure_name => 'Workorder_Login',
399: p_error_text => SUBSTR(SQLERRM,1,240));
400: END IF;
393:
394: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
395: Rollback to Workorder_Login_PVT;
396: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
397: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
398: p_procedure_name => 'Workorder_Login',
399: p_error_text => SUBSTR(SQLERRM,1,240));
400: END IF;
401: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
397: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
398: p_procedure_name => 'Workorder_Login',
399: p_error_text => SUBSTR(SQLERRM,1,240));
400: END IF;
401: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
402: p_data => x_msg_data,
403: p_encoded => fnd_api.g_false);
404:
405:
446: -- Workorder Num/ID
447: IF (p_x_workorder_id IS NULL) THEN
448: IF (p_workorder_name IS NULL OR p_org_code IS NULL) THEN
449: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_NULL');
450: FND_MSG_PUB.ADD;
451: x_return_status := FND_API.G_RET_STS_ERROR;
452: ELSE
453: OPEN c_get_wo_id(p_workorder_name, p_org_code);
454: FETCH c_get_wo_id INTO l_workorder_id;
455: IF (c_get_wo_id%NOTFOUND) THEN
456: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_INVALID');
457: FND_MESSAGE.set_token('WO_NUM', p_workorder_name);
458: FND_MESSAGE.set_token('ORG_CODE', p_org_code);
459: FND_MSG_PUB.ADD;
460: x_return_status := FND_API.G_RET_STS_ERROR;
461: ELSE
462: p_x_workorder_id := l_workorder_id;
463: END IF;
611: -- add error to stack.
612: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_INVALID');
613: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
614: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
615: FND_MSG_PUB.ADD;
616: RAISE FND_API.G_EXC_ERROR;
617: END IF;
618: CLOSE c_lock_wo_oper;
619:
622: -- add error to stack.
623: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_INVALID');
624: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
625: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
626: FND_MSG_PUB.ADD;
627: RAISE FND_API.G_EXC_ERROR;
628: END IF;
629:
630: END IF; -- p_operation_seq_num IS NOT NULL
661: -- add error to stack.
662: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_RES_NULL');
663: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
664: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
665: FND_MSG_PUB.ADD;
666: RAISE FND_API.G_EXC_ERROR;
667: END IF;
668:
669:
746: -- add error to stack.
747: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_RES_INVALID');
748: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
749: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
750: FND_MSG_PUB.ADD;
751: RAISE FND_API.G_EXC_ERROR;
752:
753: END IF; -- c_qualified_req%FOUND
754: CLOSE c_qualified_req;
967: -- add error to stack.
968: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_INVALID');
969: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
970: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
971: FND_MSG_PUB.ADD;
972: RAISE FND_API.G_EXC_ERROR;
973: ELSIF (l_oper_status <> 2) THEN
974: CLOSE c_lock_wo_oper;
975:
976: -- add error to stack.
977: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_INVALID');
978: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
979: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
980: FND_MSG_PUB.ADD;
981: RAISE FND_API.G_EXC_ERROR;
982: END IF;
983: CLOSE c_lock_wo_oper;
984:
986:
987: -- add error to stack.
988: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_NULL');
989: FND_MESSAGE.set_token('WO_NUM' , p_workorder_name);
990: FND_MSG_PUB.ADD;
991: RAISE FND_API.G_EXC_ERROR;
992: END IF; -- p_operation_seq_num IS NOT NULL
993:
994: IF (G_DEBUG_STMT >= G_DEBUG_LEVEL) THEN
1274: OPEN c_lock_wo (p_workorder_id);
1275: FETCH c_lock_wo INTO l_wo_status;
1276: IF (c_lock_wo%NOTFOUND) THEN
1277: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_INVALID');
1278: FND_MSG_PUB.ADD;
1279: END IF;
1280: CLOSE c_lock_wo;
1281:
1282: -- Lock all operation records.
1511: SAVEPOINT Workorder_Logout_Pvt;
1512:
1513: -- Initialize message list if p_init_msg_list is set to TRUE
1514: IF FND_API.To_Boolean(p_init_msg_list) THEN
1515: FND_MSG_PUB.Initialize;
1516: END IF;
1517:
1518: -- Initialize Procedure return status to success
1519: x_return_status := FND_API.G_RET_STS_SUCCESS;
1569: should be logged out
1570: IF (NVL(FND_PROFILE.value('AHL_MANUAL_RES_TXN'),'N') = 'Y') OR
1571: (l_user_role = AHL_PRD_UTIL_PKG.G_DATA_CLERK) THEN
1572: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_AUTOTXN_DSBLD');
1573: FND_MSG_PUB.ADD;
1574: RAISE FND_API.G_EXC_ERROR;
1575: END IF; */
1576:
1577: -- Initialize local variables.
1619:
1620: -- Check required parameters.
1621: IF (l_workorder_id IS NULL) THEN
1622: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_NULL');
1623: FND_MSG_PUB.ADD;
1624: RAISE FND_API.G_EXC_ERROR;
1625: END IF;
1626:
1627: IF (l_employee_id IS NULL) THEN
1625: END IF;
1626:
1627: IF (l_employee_id IS NULL) THEN
1628: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_EMPID_NULL');
1629: FND_MSG_PUB.ADD;
1630: RAISE FND_API.G_EXC_ERROR;
1631: END IF;
1632:
1633: -- debug checkpoint.
1663: COMMIT WORK;
1664: END IF;
1665:
1666: -- Standard call to get message count and if count is 1, get message info
1667: FND_MSG_PUB.Count_And_Get
1668: ( p_count => x_msg_count,
1669: p_data => x_msg_data,
1670: p_encoded => fnd_api.g_false
1671: );
1680: EXCEPTION
1681: WHEN FND_API.G_EXC_ERROR THEN
1682: x_return_status := FND_API.G_RET_STS_ERROR;
1683: Rollback to Workorder_Logout_PVT;
1684: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
1685: p_data => x_msg_data,
1686: p_encoded => fnd_api.g_false);
1687:
1688:
1688:
1689: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1690: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1691: Rollback to Workorder_Logout_PVT;
1692: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
1693: p_data => x_msg_data,
1694: p_encoded => fnd_api.g_false);
1695:
1696: WHEN OTHERS THEN
1696: WHEN OTHERS THEN
1697:
1698: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1699: Rollback to Workorder_Logout_PVT;
1700: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1701: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1702: p_procedure_name => 'Workorder_Logout',
1703: p_error_text => SUBSTR(SQLERRM,1,240));
1704: END IF;
1697:
1698: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1699: Rollback to Workorder_Logout_PVT;
1700: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1701: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1702: p_procedure_name => 'Workorder_Logout',
1703: p_error_text => SUBSTR(SQLERRM,1,240));
1704: END IF;
1705: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
1701: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1702: p_procedure_name => 'Workorder_Logout',
1703: p_error_text => SUBSTR(SQLERRM,1,240));
1704: END IF;
1705: FND_MSG_PUB.count_and_get( p_count => x_msg_count,
1706: p_data => x_msg_data,
1707: p_encoded => fnd_api.g_false);
1708:
1709:
1979:
1980: IF (c_emp_login_details%NOTFOUND) THEN
1981: CLOSE c_emp_login_details;
1982: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_NOTLOGGEDIN');
1983: FND_MSG_PUB.ADD;
1984: RAISE FND_API.G_EXC_ERROR;
1985: END IF;
1986:
1987: -- Check login WO matches input WO.
1987: -- Check login WO matches input WO.
1988: IF (l_login_workorder_id IS NULL) THEN
1989: -- user is not logged in any workorder.
1990: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_NOTLOGGEDIN');
1991: FND_MSG_PUB.ADD;
1992: RAISE FND_API.G_EXC_ERROR;
1993: ELSIF (l_login_workorder_id <> p_workorder_id) THEN
1994: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_WO_INVALID');
1995: FND_MESSAGE.set_token('WO_NAME', l_workorder_name);
1992: RAISE FND_API.G_EXC_ERROR;
1993: ELSIF (l_login_workorder_id <> p_workorder_id) THEN
1994: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_WO_INVALID');
1995: FND_MESSAGE.set_token('WO_NAME', l_workorder_name);
1996: FND_MSG_PUB.ADD;
1997: RAISE FND_API.G_EXC_ERROR;
1998: END IF;
1999:
2000: IF (G_DEBUG_STMT >= G_DEBUG_LEVEL) THEN
2004:
2005: -- For 'R' and 'O' logins, operation_seq_num is mandatory.
2006: IF (l_login_level <> 'W' AND p_operation_seq_num IS NULL) THEN
2007: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_OP_NULL');
2008: FND_MSG_PUB.ADD;
2009: RAISE FND_API.G_EXC_ERROR;
2010: ELSIF (p_operation_seq_num <> l_operation_seq_num) THEN
2011: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_OP_INVALID');
2012: FND_MESSAGE.set_token('OP_NUM', p_operation_seq_num);
2009: RAISE FND_API.G_EXC_ERROR;
2010: ELSIF (p_operation_seq_num <> l_operation_seq_num) THEN
2011: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_OP_INVALID');
2012: FND_MESSAGE.set_token('OP_NUM', p_operation_seq_num);
2013: FND_MSG_PUB.ADD;
2014: RAISE FND_API.G_EXC_ERROR;
2015: END IF;
2016:
2017: IF (G_DEBUG_STMT >= G_DEBUG_LEVEL) THEN
2022: -- For 'R' login, resource is mandatory.
2023: IF (l_login_level = 'R' AND
2024: p_resource_seq_num IS NULL AND p_resource_id IS NULL) THEN
2025: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RES_NULL');
2026: FND_MSG_PUB.ADD;
2027: RAISE FND_API.G_EXC_ERROR;
2028: ELSIF (p_resource_seq_num IS NOT NULL) AND
2029: (p_resource_seq_num <> nvl(l_resource_seq_num, -1) ) THEN
2030: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RES_INVALID');
2028: ELSIF (p_resource_seq_num IS NOT NULL) AND
2029: (p_resource_seq_num <> nvl(l_resource_seq_num, -1) ) THEN
2030: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RES_INVALID');
2031: FND_MESSAGE.set_token('RES_NUM', p_resource_seq_num);
2032: FND_MSG_PUB.ADD;
2033: RAISE FND_API.G_EXC_ERROR;
2034: ELSIF (p_resource_id IS NOT NULL) THEN
2035: IF (p_resource_id <> nvl(l_resource_id,-1)) THEN
2036: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RESID_INVALID');
2034: ELSIF (p_resource_id IS NOT NULL) THEN
2035: IF (p_resource_id <> nvl(l_resource_id,-1)) THEN
2036: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RESID_INVALID');
2037: FND_MESSAGE.set_token('RES_ID', p_resource_id);
2038: FND_MSG_PUB.ADD;
2039: RAISE FND_API.G_EXC_ERROR;
2040: /* jkjain, Bug No 8325834, FP for Bug No 7759348
2041:
2042: ELSE
2046: IF (c_get_resrc_seq%NOTFOUND) THEN
2047: CLOSE c_get_resrc_seq;
2048: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGNOUT_RES_INVALID');
2049: FND_MESSAGE.set_token('RES_ID', p_resource_id);
2050: FND_MSG_PUB.ADD;
2051: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2052: END IF; -- c_get_resrc_seq
2053: CLOSE c_get_resrc_seq;
2054: */
2068: -- Unit is locked, therefore cannot perform resource transactions
2069: -- and cannot login to the workorder
2070: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_UNTLCKD');
2071: FND_MESSAGE.set_token('WO_NUM' , l_workorder_name);
2072: FND_MSG_PUB.ADD;
2073: RAISE FND_API.G_EXC_ERROR;
2074: END IF;
2075:
2076: IF (G_DEBUG_STMT >= G_DEBUG_LEVEL) THEN
2357: RETURN l_user_role;
2358:
2359: EXCEPTION
2360: WHEN OTHERS THEN
2361: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2362: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2363: p_procedure_name => 'Get_User_Role',
2364: p_error_text => SUBSTR(SQLERRM,1,240));
2365: END IF;
2358:
2359: EXCEPTION
2360: WHEN OTHERS THEN
2361: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2362: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2363: p_procedure_name => 'Get_User_Role',
2364: p_error_text => SUBSTR(SQLERRM,1,240));
2365: END IF;
2366: RETURN NULL;
2424: RETURN l_employee_id;
2425:
2426: EXCEPTION
2427: WHEN OTHERS THEN
2428: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2429: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2430: p_procedure_name => 'Get_Employee_ID',
2431: p_error_text => SUBSTR(SQLERRM,1,240));
2432: END IF;
2425:
2426: EXCEPTION
2427: WHEN OTHERS THEN
2428: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2429: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2430: p_procedure_name => 'Get_Employee_ID',
2431: p_error_text => SUBSTR(SQLERRM,1,240));
2432: END IF;
2433: RETURN NULL;
2527:
2528: -- Return error if employee id not found.
2529: IF (l_employee_id IS NULL) THEN
2530: FND_MESSAGE.Set_Name('AHL','AHL_PRD_LGN_EMP_NULL');
2531: FND_MSG_PUB.ADD;
2532: RAISE FND_API.G_EXC_ERROR;
2533: END IF;
2534:
2535: -- Get login info.
2578:
2579: EXCEPTION
2580: WHEN FND_API.G_EXC_ERROR THEN
2581: x_return_status := FND_API.G_RET_STS_ERROR;
2582: FND_MSG_PUB.count_and_get
2583: (
2584: p_count => x_msg_count,
2585: p_data => x_msg_data,
2586: p_encoded => fnd_api.g_false
2588:
2589:
2590: WHEN OTHERS THEN
2591: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2592: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2593: fnd_msg_pub.add_exc_msg
2594: (
2595: p_pkg_name => G_PKG_NAME,
2596: p_procedure_name => 'Get_Current_Emp_Login',
2589:
2590: WHEN OTHERS THEN
2591: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2592: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2593: fnd_msg_pub.add_exc_msg
2594: (
2595: p_pkg_name => G_PKG_NAME,
2596: p_procedure_name => 'Get_Current_Emp_Login',
2597: p_error_text => SUBSTR(SQLERRM,1,240)
2596: p_procedure_name => 'Get_Current_Emp_Login',
2597: p_error_text => SUBSTR(SQLERRM,1,240)
2598: );
2599: END IF;
2600: FND_MSG_PUB.count_and_get
2601: (
2602: p_count => x_msg_count,
2603: p_data => x_msg_data,
2604: p_encoded => fnd_api.g_false
2905: -- Check if login enabled.
2906: IF (NVL(FND_PROFILE.value('AHL_PRD_MANUAL_RES_TXN'),'N') = 'Y') OR
2907: (l_fnd_function_name = AHL_PRD_UTIL_PKG.G_DATA_CLERK) THEN
2908: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_AUTOTXN_DSBLD');
2909: FND_MSG_PUB.ADD;
2910: Return FND_API.G_FALSE;
2911: END IF;
2912:
2913: -- Debug Checkpoint.
2918:
2919: -- Check required parameters.
2920: IF p_workorder_id IS NULL THEN
2921: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_NULL');
2922: FND_MSG_PUB.ADD;
2923: Return FND_API.G_FALSE;
2924: END IF;
2925:
2926: -- Debug Checkpoint.
2934: FETCH c_is_wo_valid INTO l_wo_status, l_wo_name, l_wip_entity_id, l_org_id;
2935: IF c_is_wo_valid%NOTFOUND THEN
2936: CLOSE c_is_wo_valid;
2937: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_INVALID');
2938: FND_MSG_PUB.ADD;
2939: RETURN FND_API.G_FALSE;
2940: END IF;
2941: CLOSE c_is_wo_valid;
2942:
2943: -- Validate WO status.
2944: IF l_wo_status in ('1','6','7','22','12','4','5') THEN
2945: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WOSTS_INVLD');
2946: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
2947: FND_MSG_PUB.ADD;
2948: RETURN FND_API.G_FALSE;
2949: END IF;
2950:
2951: -- Debug Checkpoint.
2964: IF (c_is_emp_valid%NOTFOUND) THEN
2965: CLOSE c_is_emp_valid;
2966: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_EMPID_INVALID');
2967: FND_MESSAGE.set_token('EMP_ID' , p_employee_id);
2968: FND_MSG_PUB.ADD;
2969: RETURN FND_API.G_FALSE;
2970: END IF;
2971: CLOSE c_is_emp_valid;
2972: END IF;
2996:
2997: -- Check for login WO. If user already logged in, then do not allow login into another WO.
2998: IF (l_login_workorder_id IS NOT NULL) THEN
2999: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_USER_LOGGED_IN');
3000: FND_MSG_PUB.ADD;
3001: RETURN FND_API.G_FALSE;
3002: END IF;
3003:
3004: -- Debug Checkpoint.
3015: -- Unit is locked, therefore cannot perform resource transactions
3016: -- and hence cannot login to the workorder
3017: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_UNTLCKD');
3018: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3019: FND_MSG_PUB.ADD;
3020: RETURN FND_API.G_FALSE;
3021: END IF;
3022:
3023: IF (p_fnd_function_name IS NULL) THEN
3027: END IF;
3028:
3029: IF (l_fnd_function_name IS NULL) THEN
3030: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_FUNC_NULL');
3031: FND_MSG_PUB.ADD;
3032: Return FND_API.G_FALSE;
3033: END IF;
3034:
3035: -- Debug Checkpoint.
3054: IF (c_workorder_oper%FOUND) THEN
3055: CLOSE c_workorder_oper;
3056: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WOOPS_COMPLETE');
3057: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3058: FND_MSG_PUB.ADD;
3059: RETURN FND_API.G_FALSE;
3060: END IF;
3061: CLOSE c_workorder_oper;
3062:
3067: -- Login at the workorder level will be disabled.
3068: CLOSE c_check_res_reqd;
3069: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WO_NO_RESREQ');
3070: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3071: FND_MSG_PUB.ADD;
3072: RETURN FND_API.G_FALSE;
3073: END IF; -- c_check_res_reqd.
3074: CLOSE c_check_res_reqd;
3075:
3083: IF c_qualified_for_one_res%NOTFOUND THEN
3084: CLOSE c_qualified_for_one_res;
3085: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_WOOPS_NOTQUAL');
3086: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3087: FND_MSG_PUB.ADD;
3088: RETURN FND_API.G_FALSE;
3089: END IF; -- c_qualified_for_one_ops
3090: CLOSE c_qualified_for_one_res;
3091: END LOOP; -- operation_rec
3101: -- disable login at WO level.
3102: CLOSE c_check_res_multiple_wo;
3103: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_MULTI_RES_WO');
3104: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3105: FND_MSG_PUB.ADD;
3106: RETURN FND_API.G_FALSE;
3107: END IF;
3108: CLOSE c_check_res_multiple_wo;
3109: END IF;
3128: CLOSE c_is_op_seq_valid;
3129: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_INVALID');
3130: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
3131: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3132: FND_MSG_PUB.ADD;
3133: RETURN FND_API.G_FALSE;
3134: END IF; -- c_is_op_seq_valid.
3135: CLOSE c_is_op_seq_valid;
3136:
3156: CLOSE c_qualified_for_one_res;
3157: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_NOT_QUAL');
3158: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
3159: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3160: FND_MSG_PUB.ADD;
3161: RETURN FND_API.G_FALSE;
3162: END IF; -- c_qualified_for_one_res
3163: CLOSE c_qualified_for_one_res;
3164: -- END IF; -- l_fnd_function_name = AHL_PRD_UTIL_PKG.G_TECH_MYWO
3173: -- disable login at WO level.
3174: CLOSE c_check_res_multiple_op;
3175: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_MULTI_RES_OP');
3176: FND_MESSAGE.set_token('OP_NUM' , p_operation_seq_num);
3177: FND_MSG_PUB.ADD;
3178: RETURN FND_API.G_FALSE;
3179: END IF;
3180: CLOSE c_check_res_multiple_op;
3181: END IF;
3198: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_RESSEQ_INVALID');
3199: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
3200: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3201: FND_MESSAGE.set_token('RES_NAME' ,p_resource_seq_num);
3202: FND_MSG_PUB.ADD;
3203: RETURN FND_API.G_FALSE;
3204: END IF;
3205: CLOSE c_get_resrc_id;
3206: ELSE
3215: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_RESID_INVALID');
3216: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
3217: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3218: FND_MESSAGE.set_token('RES_ID' , l_resource_id);
3219: FND_MSG_PUB.ADD;
3220: RETURN FND_API.G_FALSE;
3221: END IF; -- c_is_resource_valid
3222: CLOSE c_is_resource_valid;
3223:
3232: FND_MESSAGE.set_name('AHL', 'AHL_PRD_LGN_OP_NOTQUAL');
3233: FND_MESSAGE.SET_TOKEN('OP_NUM', p_operation_seq_num);
3234: FND_MESSAGE.set_token('WO_NUM' , l_wo_name);
3235: FND_MESSAGE.set_token('RES_NUM', l_resource_code);
3236: FND_MSG_PUB.ADD;
3237: RETURN FND_API.G_FALSE;
3238: END IF;
3239: CLOSE c_qualify_res;
3240: -- END IF; -- l_fnd_function_name = AHL_PRD_UTIL_PKG.G_TECH_MYWO
3265: RETURN FND_API.G_FALSE;
3266:
3267: WHEN OTHERS THEN
3268: --x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3269: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3270: fnd_msg_pub.add_exc_msg
3271: (
3272: p_pkg_name => G_PKG_NAME,
3273: p_procedure_name => 'Is_Login_Allowed',
3266:
3267: WHEN OTHERS THEN
3268: --x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3269: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3270: fnd_msg_pub.add_exc_msg
3271: (
3272: p_pkg_name => G_PKG_NAME,
3273: p_procedure_name => 'Is_Login_Allowed',
3274: p_error_text => SUBSTR(SQLERRM,1,240)