DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_RESOURCE_SETUP_PUB

Source


1 PACKAGE BODY PA_RESOURCE_SETUP_PUB AS
2 /* $Header: PARESTPB.pls 120.2 2006/06/30 21:50:31 ramurthy noship $ */
3 
4 
5 -- API name                      : update_addition_staff_info
6 -- Type                          : Public procedure
7 -- Pre-reqs                      : None
8 -- Return Value                  : N/A
9 li_message_level NUMBER := 1;
10 
11 PROCEDURE UPDATE_ADDITIONAL_STAFF_INFO
12 ( p_api_version                  IN NUMBER     := 1.0
13  ,p_init_msg_list                IN VARCHAR2   := FND_API.G_TRUE
14  ,p_commit                       IN VARCHAR2   := FND_API.G_FALSE
15  ,p_validate_only                IN VARCHAR2   := FND_API.G_TRUE
16  ,p_project_id                   IN NUMBER
17  ,p_calendar_id                  IN NUMBER     := FND_API.G_MISS_NUM
18  ,p_calendar_name                IN VARCHAR2   := FND_API.G_MISS_CHAR
19  ,p_role_list_id                 IN NUMBER     := FND_API.G_MISS_NUM
20  ,p_adv_action_set_id            IN NUMBER     := FND_API.G_MISS_NUM
21  ,p_adv_action_set_name          IN VARCHAR2   := FND_API.G_MISS_CHAR
22  ,p_start_adv_action_set_flag    IN VARCHAR2   := FND_API.G_MISS_CHAR
23  ,p_record_version_number        IN NUMBER
24  ,p_initial_team_template_id     IN NUMBER     := FND_API.G_MISS_NUM  -- added for bug 2607631
25  ,p_proj_req_res_format_id       IN NUMBER     := FND_API.G_MISS_NUM
26  ,p_proj_asgmt_res_format_id     IN NUMBER     := FND_API.G_MISS_NUM
27  ,p_max_msg_count                IN NUMBER     := FND_API.G_MISS_NUM
28  ,x_return_status                OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
29  ,x_msg_count                    OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
30  ,x_msg_data                     OUT NOCOPY VARCHAR2) --File.Sql.39 bug 4440895
31 IS
32 
33 l_api_name           CONSTANT VARCHAR(30) := 'update_addition_staff_info';
34 l_api_version        CONSTANT NUMBER      := 1.0;
35 l_calendar_id              NUMBER := FND_API.G_MISS_NUM;
36 l_return_status            VARCHAR2(250);
37 l_error_msg_code           VARCHAR2(250);
38 l_msg_count                NUMBER;
39 l_msg_data                 VARCHAR2(250);
40 l_data                     VARCHAR2(250);
41 l_msg_index_out            NUMBER;
42 l_adv_action_set_id        NUMBER := FND_API.G_MISS_NUM;
43 l_debug_mode               VARCHAR2(10);
44 
45 BEGIN
46 l_debug_mode  := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
47 
48    IF p_commit = FND_API.G_TRUE THEN
49       SAVEPOINT update_addition_staff_info;
50    END IF;
51 
52 IF l_debug_mode = 'Y' THEN
53    pa_debug.init_err_stack('PA_RESOURCE_SETUP_PUB.update_addition_staff_info');
54    PA_DEBUG.write_log (x_module => 'pa.plsql.PA_RESOURCE_SETUP_PUB.update_addition_staff_info.begin'
55        ,x_msg => 'Beginning of PA_RESOURCE_SETUP_PUB.update_addition_staff_info'
56        ,x_log_level   => 5);
57 END IF;
58 
59    if FND_API.to_boolean(nvl(p_init_msg_list, FND_API.G_FALSE)) then
60       fnd_msg_pub.initialize;
61    end if;
62 
63    x_return_status := FND_API.G_RET_STS_SUCCESS;
64 
65 IF l_debug_mode = 'Y' THEN
66    pa_debug.write(x_module => 'pa.plsql.PA_RESOURCE_SETUP_PUB.update_addition_staff_info'
67 		 ,x_msg         => 'adv_id='||p_adv_action_set_id||
68 				   ' adv_name='||p_adv_action_set_name||
69 				   ' req_format='||p_proj_req_res_format_id||
70 				   ' asgmt_format='||p_proj_asgmt_res_format_id
71    	         ,x_log_level   => li_message_level);
72 END IF;
73 
74 
75    -- Validate Calendar
76    IF (p_calendar_id is not null AND p_calendar_id <> FND_API.G_MISS_NUM) OR
77       (p_calendar_name is not null AND p_calendar_name <> FND_API.G_MISS_CHAR)
78    THEN
79 
80      PA_CALENDAR_UTILS.CHECK_CALENDAR_NAME_OR_ID
81       ( p_calendar_id         => p_calendar_id
82        ,p_calendar_name       => p_calendar_name
83        ,p_check_id_flag       => PA_STARTUP.G_Check_ID_Flag
84        ,x_calendar_id         => l_calendar_id
85        ,x_return_status       => l_return_status
86        ,x_error_message_code  => l_error_msg_code);
87 
88      IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
89        PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
90                             p_msg_name       => l_error_msg_code);
91        x_return_status := l_return_status;
92      END IF;
93 
94     END IF;
95 
96    -- Validate Advertisement Action Set
97    IF (p_adv_action_set_id is not null AND p_adv_action_set_id <> FND_API.G_MISS_NUM) OR
98       (p_adv_action_set_name is not null AND p_adv_action_set_name <> FND_API.G_MISS_CHAR)
99    THEN
100 
101        PA_ACTION_SET_UTILS.Check_Action_Set_Name_or_Id(
102          p_action_set_id        => p_adv_action_set_id
103         ,p_action_set_name      => p_adv_action_set_name
104         ,p_action_set_type_code => 'ADVERTISEMENT'
105         ,p_check_id_flag        => PA_STARTUP.G_Check_ID_Flag
106         ,p_date                 => sysdate
107         ,x_action_set_id        => l_adv_action_set_id
108         ,x_return_status        => l_return_status
109         ,x_error_message_code   => l_error_msg_code
110        );
111 
112      IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
113        PA_UTILS.ADD_MESSAGE(p_app_short_name => 'PA',
114                             p_msg_name       => l_error_msg_code);
115        x_return_status := l_return_status;
116      END IF;
117 
118    END IF;
119 
120 
121    IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
122 
123      PA_RESOURCE_SETUP_PVT.UPDATE_ADDITIONAL_STAFF_INFO
124      (
125       p_commit                       => FND_API.G_FALSE,
126       p_validate_only                => p_validate_only,
127       p_project_id                   => p_project_id,
128       p_calendar_id                  => l_calendar_id,
129       p_role_list_id                 => p_role_list_id,
130       p_adv_action_set_id            => l_adv_action_set_id,
131       p_start_adv_action_set_flag    => p_start_adv_action_set_flag,
132       p_record_version_number        => p_record_version_number,
133       p_initial_team_template_id     => p_initial_team_template_id, -- added for bug 2607631
134       p_proj_req_res_format_id       => p_proj_req_res_format_id,
135       p_proj_asgmt_res_format_id     => p_proj_asgmt_res_format_id,
136       p_max_msg_count                => p_max_msg_count,
137       x_return_status                => l_return_status,
138       x_msg_count                    => l_msg_count,
139       x_msg_data                     => l_msg_data);
140 
141    END IF;
142 
143    l_msg_count := FND_MSG_PUB.count_msg;
144    If l_msg_count > 0 THEN
145      x_msg_count := l_msg_count;
146      If l_msg_count = 1 THEN
147        pa_interface_utils_pub.get_messages
148          (p_encoded        => FND_API.G_TRUE ,
149           p_msg_index      => 1,
150           p_msg_count      => l_msg_count ,
151           p_msg_data       => l_msg_data,
152           p_data           => l_data,
153           p_msg_index_out  => l_msg_index_out );
154         x_msg_data := l_data;
155      End if;
156      RAISE  FND_API.G_EXC_ERROR;
157    End if;
158 
159 EXCEPTION
160     WHEN FND_API.G_EXC_ERROR THEN
161 
162       IF p_commit = FND_API.G_TRUE THEN
163         ROLLBACK TO update_addition_staff_info;
164       END IF;
165       x_return_status := FND_API.G_RET_STS_ERROR;
166 
167     WHEN OTHERS THEN
168 
169       IF p_commit = FND_API.G_TRUE THEN
170          ROLLBACK TO update_addition_staff_info;
171       END IF;
172       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
173       fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_RESOURCE_SETUP_PUB',
174                               p_procedure_name => 'UPDATE_ADDITIONAL_STAFF_INFO',
175                               p_error_text     => SUBSTRB(SQLERRM,1,240));
176 
177     raise;
178 
179 END UPDATE_ADDITIONAL_STAFF_INFO;
180 
181 
182 END PA_RESOURCE_SETUP_PUB;