[Home] [Help]
PACKAGE BODY: APPS.GHR_PRH_SHD
Source
1 Package Body ghr_prh_shd as
2 /* $Header: ghprhrhi.pkb 120.2.12000000.1 2007/03/27 09:52:58 managarw noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_prh_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16 l_proc varchar2(72);
17 --
18 Begin
19 l_proc := g_package||'constraint_error';
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'GHR_PA_ROUTING_HIST_FK1') Then
23 hr_utility.set_message(8301,'GHR_38048_INV_PA_REQUEST_ID' );
24 hr_utility.raise_error;
25 ElsIf (p_constraint_name = 'GHR_PA_ROUTING_HIST_FK2') Then
26 hr_utility.set_message(8301,'GHR_38100_INV_ROUT_LIST_ID');
27 hr_utility.raise_error;
28 ElsIf (p_constraint_name = 'GHR_PA_ROUTING_HIST_PK') Then
29 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
30 hr_utility.set_message_token('PROCEDURE', l_proc);
31 hr_utility.set_message_token('STEP','15');
32 hr_utility.raise_error;
33 Else
34 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT'); --
35 hr_utility.set_message_token('PROCEDURE', l_proc);
36 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
37 hr_utility.raise_error;
38 End If;
39 --
40 hr_utility.set_location(' Leaving:'||l_proc, 10);
41 End constraint_error;
42 --
43 -- ----------------------------------------------------------------------------
44 -- |-----------------------------< api_updating >-----------------------------|
45 -- ----------------------------------------------------------------------------
46 Function api_updating
47 (
48 p_pa_routing_history_id in number,
49 p_object_version_number in number
50 ) Return Boolean Is
51 --
52 --
53 -- Cursor selects the 'current' row from the HR Schema
54 --
55 Cursor C_Sel1 is
56 select pa_routing_history_id,
57 pa_request_id,
58 attachment_modified_flag,
59 initiator_flag,
60 approver_flag,
61 reviewer_flag,
62 requester_flag,
63 authorizer_flag,
64 personnelist_flag,
65 approved_flag,
66 user_name,
67 user_name_employee_id ,
68 user_name_emp_first_name,
69 user_name_emp_last_name,
70 user_name_emp_middle_names,
71 notepad,
72 action_taken,
73 groupbox_id,
74 routing_list_id,
75 routing_seq_number,
76 noa_family_code,
77 nature_of_action_id,
78 second_nature_of_action_id,
79 approval_status,
80 date_notification_sent,
81 object_version_number from ghr_pa_routing_history
82 where pa_routing_history_id = p_pa_routing_history_id;
83 --
84 l_proc varchar2(72);
85 l_fct_ret boolean;
86 --
87 Begin
88 l_proc := g_package||'api_updating';
89 hr_utility.set_location('Entering:'||l_proc, 5);
90 --
91 If (
92 p_pa_routing_history_id is null and
93 p_object_version_number is null
94 ) Then
95 --
96 -- One of the primary key arguments is null therefore we must
97 -- set the returning function value to false
98 --
99 l_fct_ret := false;
100 Else
101 If (
102 p_pa_routing_history_id = g_old_rec.pa_routing_history_id and
103 p_object_version_number = g_old_rec.object_version_number
104 ) Then
105 hr_utility.set_location(l_proc, 10);
106 --
107 -- The g_old_rec is current therefore we must
108 -- set the returning function to true
109 --
110 l_fct_ret := true;
111 Else
112 --
113 -- Select the current row into g_old_rec
114 --
115 Open C_Sel1;
116 Fetch C_Sel1 Into g_old_rec;
117 If C_Sel1%notfound Then
118 Close C_Sel1;
119 --
120 -- The primary key is invalid therefore we must error
121 --
122 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
123 hr_utility.raise_error;
124 End If;
125 Close C_Sel1;
126 If (p_object_version_number <> g_old_rec.object_version_number) Then
127 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
128 hr_utility.raise_error;
129 End If;
130 hr_utility.set_location(l_proc, 15);
131 l_fct_ret := true;
132 End If;
133 End If;
134 hr_utility.set_location(' Leaving:'||l_proc, 20);
135 Return (l_fct_ret);
136 --
137 End api_updating;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |---------------------------------< lck >----------------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure lck
143 (
144 p_pa_routing_history_id in number,
145 p_object_version_number in number
146 ) is
147 --
148 -- Cursor selects the 'current' row from the HR Schema
149 --
150 Cursor C_Sel1 is
151 select pa_routing_history_id,
152 pa_request_id,
153 attachment_modified_flag,
154 initiator_flag,
155 approver_flag,
156 reviewer_flag,
157 requester_flag,
158 authorizer_flag,
159 personnelist_flag,
160 approved_flag,
161 user_name,
162 user_name_employee_id ,
163 user_name_emp_first_name,
164 user_name_emp_last_name,
165 user_name_emp_middle_names,
166 notepad,
167 action_taken,
168 groupbox_id,
169 routing_list_id,
170 routing_seq_number,
171 noa_family_code,
172 nature_of_action_id,
173 second_nature_of_action_id,
174 approval_Status,
175 date_notification_sent,
176 object_version_number
177 from ghr_pa_routing_history
178 where pa_routing_history_id = p_pa_routing_history_id
179 for update nowait;
180 --
181 l_proc varchar2(72) := g_package||'lck';
182 --
183 Begin
184 hr_utility.set_location('Entering:'||l_proc, 5);
185 --
186 -- Add any mandatory argument checking here:
187 -- Example:
188 -- hr_api.mandatory_arg_error
189 -- (p_api_name => l_proc,
190 -- p_argument => 'object_version_number',
191 -- p_argument_value => p_object_version_number);
192 --
193 Open C_Sel1;
194 Fetch C_Sel1 Into g_old_rec;
195 If C_Sel1%notfound then
196 Close C_Sel1;
197 --
198 -- The primary key is invalid therefore we must error
199 --
200 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
201 hr_utility.raise_error;
202 End If;
203 Close C_Sel1;
204 If (p_object_version_number <> g_old_rec.object_version_number) Then
205 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
206 hr_utility.raise_error;
207 End If;
208 --
209 hr_utility.set_location(' Leaving:'||l_proc, 10);
210 --
211 -- We need to trap the ORA LOCK exception
212 --
213 Exception
214 When HR_Api.Object_Locked then
215 --
216 -- The object is locked therefore we need to supply a meaningful
217 -- error message.
218 --
219 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
220 hr_utility.set_message_token('TABLE_NAME', 'ghr_pa_routing_history');
221 hr_utility.raise_error;
222 End lck;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< convert_args >-----------------------------|
226 -- ----------------------------------------------------------------------------
227 Function convert_args
228 (
229 p_pa_routing_history_id in number,
230 p_pa_request_id in number,
231 p_attachment_modified_flag in varchar2,
232 p_initiator_flag in varchar2,
233 p_approver_flag in varchar2,
234 p_reviewer_flag in varchar2,
235 p_requester_flag in varchar2,
236 p_authorizer_flag in varchar2,
237 p_personnelist_flag in varchar2,
238 p_approved_flag in varchar2,
239 p_user_name in varchar2,
240 p_user_name_employee_id in number,
241 p_user_name_emp_first_name in varchar2,
242 p_user_name_emp_last_name in varchar2,
243 p_user_name_emp_middle_names in varchar2,
244 p_notepad in varchar2,
245 p_action_taken in varchar2,
246 p_groupbox_id in number,
247 p_routing_list_id in number,
248 p_routing_seq_number in number,
249 p_noa_family_code in varchar2,
250 p_nature_of_action_id in number,
251 p_second_nature_of_action_id in number,
252 p_approval_status in varchar2,
253 p_date_notification_sent in date,
254 p_object_version_number in number
255 )
256 Return g_rec_type is
257 --
258 l_rec g_rec_type;
259 l_proc varchar2(72) ;
260 --
261 Begin
262 --
263 l_proc := g_package||'convert_args';
264 hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266 -- Convert arguments into local l_rec structure.
267 --
268 l_rec.pa_routing_history_id := p_pa_routing_history_id;
269 l_rec.pa_request_id := p_pa_request_id;
270 l_rec.attachment_modified_flag := p_attachment_modified_flag;
271 l_rec.initiator_flag := p_initiator_flag;
272 l_rec.approver_flag := p_approver_flag;
273 l_rec.reviewer_flag := p_reviewer_flag;
274 l_rec.requester_flag := p_requester_flag;
275 l_rec.authorizer_flag := p_authorizer_flag;
276 l_rec.personnelist_flag := p_personnelist_flag;
277 l_rec.approved_flag := p_approved_flag;
278 l_rec.user_name := p_user_name;
279 l_rec.user_name_employee_id := p_user_name_employee_id;
280 l_rec.user_name_emp_first_name := p_user_name_emp_first_name;
281 l_rec.user_name_emp_last_name := p_user_name_emp_last_name;
282 l_rec.user_name_emp_middle_names := p_user_name_emp_middle_names;
283 l_rec.notepad := p_notepad;
284 l_rec.action_taken := p_action_taken;
285 l_rec.groupbox_id := p_groupbox_id;
286 l_rec.routing_list_id := p_routing_list_id;
287 l_rec.routing_seq_number := p_routing_seq_number;
288 l_rec.noa_family_code := p_noa_family_code;
289 l_rec.nature_of_action_id := p_nature_of_action_id;
290 l_rec.second_nature_of_action_id := p_second_nature_of_action_id;
291 l_rec.approval_status := p_approval_status;
292 l_rec.date_notification_sent := p_date_notification_sent;
293 l_rec.object_version_number := p_object_version_number;
294 --
295 -- Return the plsql record structure.
296 --
297 hr_utility.set_location(' Leaving:'||l_proc, 10);
298 Return(l_rec);
299 --
300 End convert_args;
301 --
302 end ghr_prh_shd;