[Home] [Help]
PACKAGE BODY: APPS.HR_WPM_MASS_SCORE_CARD_TRNSF
Source
1 PACKAGE BODY HR_WPM_MASS_SCORE_CARD_TRNSF AS
2 /* $Header: hrwpmtrnsf.pkb 120.1 2008/04/01 12:13:15 arumukhe ship $*/
3
4
5 FUNCTION Split
6 (
7 PC$Chaine IN VARCHAR2, -- input string
8 PN$Pos IN PLS_INTEGER, -- token number
9 PC$Sep IN VARCHAR2 DEFAULT ',' -- separator character
10 )
11 RETURN VARCHAR2
12 IS
13 LC$Chaine VARCHAR2(32767) := PC$Sep || PC$Chaine ;
14 LI$I PLS_INTEGER ;
15 LI$I2 PLS_INTEGER ;
16 BEGIN
17 LI$I := INSTR( LC$Chaine, PC$Sep, 1, PN$Pos ) ;
18 IF LI$I > 0 THEN
19 LI$I2 := INSTR( LC$Chaine, PC$Sep, 1, PN$Pos + 1) ;
20 IF LI$I2 = 0 THEN LI$I2 := LENGTH( LC$Chaine ) + 1 ; END IF ;
21 RETURN( SUBSTR( LC$Chaine, LI$I+1, LI$I2 - LI$I-1 ) ) ;
22 ELSE
23 RETURN NULL ;
24 END IF ;
25 END;
26
27
28
29 procedure update_score_cards(p_score_card_list varchar2 default null,
30 p_sc_ovn_list varchar2 default null,
31 p_sc_latest_ovn_list in out nocopy varchar2)
32 is
33 l_sc_ovn_list varchar2(1000);
34
35 cursor get_score_cards ( p_sc_id varchar2 )
36 is
37 select scorecard_id, object_version_number from per_personal_scorecards
38 where scorecard_id = p_sc_id;
39
40
41 api_return_status varchar2(10);
42 l_temp_ovn number default null;
43 formatted_sc_list varchar2(1000) default null;
44
45 i PLS_INTEGER := 1 ;
46 temp_str varchar2(20);
47 l_sc_id per_personal_scorecards.scorecard_id%TYPE;
48 l_sc_ovn per_personal_scorecards.object_version_number%TYPE;
49 l_sc_latest_ovn per_personal_scorecards.object_version_number%TYPE;
50 l_sc_latest_id per_personal_scorecards.scorecard_id%TYPE;
51
52 begin
53 --l_sc_list := p_score_card_list;
54 --OPEN :sc_cursor FOR select scorecard_id, object_version_number from per_personal_scorecards
55 --where scorecard_id in (p_score_card_list);
56 --dbms_output.put_line( ' p_score_card_list ' || p_score_card_list);
57
58
59 LOOP
60 temp_str := Split(p_score_card_list, i , ',') ;
61 EXIT WHEN temp_str IS NULL ;
62 --dbms_output.put_line(' temp_str ' || temp_str);
63 open get_score_cards(to_number(temp_str));
64 fetch get_score_cards into l_sc_id, l_sc_ovn;
65 close get_score_cards;
66 if( l_sc_id is not null ) then
67 hr_personal_scorecard_swi.update_scorecard_status
68 (p_validate => hr_Api.g_false_num
69 ,p_effective_date => trunc(sysdate) -- to be
70 ,p_scorecard_id => l_sc_id
71 ,p_object_version_number => l_sc_ovn
72 ,p_status_code => 'TRANSFER'
73 ,p_return_status => api_return_status
74 );
75
76 open get_score_cards(to_number(temp_str));
77 fetch get_score_cards into l_sc_latest_id, l_sc_latest_ovn;
78 close get_score_cards;
79
80 if(p_sc_latest_ovn_list is null or length(p_sc_latest_ovn_list) <= 0) then
81 p_sc_latest_ovn_list := p_sc_latest_ovn_list || l_sc_latest_ovn;
82 else
83 p_sc_latest_ovn_list := p_sc_latest_ovn_list || ',' || l_sc_latest_ovn;
84 end if;
85 end if;
86 i := i + 1 ;
87 END LOOP ;
88 /*
89 open format_sc_list(p_score_card_list);
90 fetch format_sc_list into formatted_sc_list;
91 close format_sc_list;
92
93 formatted_sc_list := '''' || formatted_sc_list || '''';
94
95 --dbms_output.put_line(' formatted_sc_list ' || formatted_sc_list);
96
97
98 for score_card_list in get_score_cards(p_score_card_list)
99 loop
100 begin
101 l_temp_ovn := score_card_list.object_version_number;
102 api_return_status := null;
103
104 --dbms_output.put_line( ' processing score_card_list.scorecard_id ');
105 hr_personal_scorecard_swi.update_scorecard_status
106 (p_validate => hr_Api.g_false_num
107 ,p_effective_date => trunc(sysdate) -- to be
108 ,p_scorecard_id => score_card_list.scorecard_id
109 ,p_object_version_number => l_temp_ovn
110 ,p_status_code => 'TRANSFER'
111 ,p_return_status => api_return_status
112 );
113
114 --dbms_output.put_line( ' api_return_status ' || api_return_status);
115
116 if(p_sc_latest_ovn_list is null or length(p_sc_latest_ovn_list) <= 0) then
117 p_sc_latest_ovn_list := p_sc_latest_ovn_list || l_temp_ovn;
118 else
119 p_sc_latest_ovn_list := p_sc_latest_ovn_list || ',' || l_temp_ovn;
120 end if;
121
122 exception when others then
123 raise;
124 -- to be
125
126 end;
127 end loop;
128
129 */
130 exception when others then
131 --dbms_output.put_line(' ERROR ' || sqlerrm || sqlcode);
132 raise;
133
134 end update_score_cards;
135
136 /* txn_owner_person_id is the actual owner of the txn, this is needed as
137 there is switch functionality where the HR rep can perform the txn, in this
138 case it is decided that the whole process as to use the actual manager rather
139 than who is acting */
140
141 PROCEDURE MassScoreCardTransfer
142 ( score_card_list IN VARCHAR2 DEFAULT null,
143 sc_ovn_list IN VARCHAR2 DEFAULT null,
144 txn_owner_person_id in per_all_people_f.person_id%TYPE,
145 comments in varchar2,
146 result_code out nocopy VARCHAR2 )
147 IS
148 cursor get_person_name(p_person_id per_all_people_f.person_id%TYPE)
149 is
150 select global_name from per_people_f
151 where person_id = p_person_id
152 and trunc(sysdate) between effective_start_date and effective_end_date;
153
154 cursor get_wf_role(p_person_id per_all_people_f.person_id%TYPE)
155 is
156 select name from wf_roles
157 where orig_system_id = p_person_id
158 and orig_system = 'PER';
159
160 item_key_number number;
161 item_key hr_api_transactions.item_key%type default '';
162 item_type hr_api_transactions.item_type%type default 'HRWPM';
163 mgr_name per_all_people_f.global_name%TYPE;
164 mgr_role wf_local_roles.name%TYPE;
165
166 l_sc_latest_ovn_list varchar2(1000) default null;
167 BEGIN
168
169 select hr_workflow_item_key_s.NEXTVAL into item_key_number from dual ;
170 item_key := item_key || item_key_number;
171 --dbms_output.put_line(' item_key = ' || item_key);
172
173 open get_wf_role(txn_owner_person_id);
174 fetch get_wf_role into mgr_role;
175 close get_wf_role;
176
177 open get_person_name(txn_owner_person_id);
178 fetch get_person_name into mgr_name;
179 close get_person_name;
180
181 savepoint start_process;
182
183 update_score_cards(score_card_list, sc_ovn_list, l_sc_latest_ovn_list);
184
185 --dbms_output.put_line(' l_sc_latest_ovn_list ' || l_sc_latest_ovn_list);
186
187 --dbms_output.put_line(' mgr_role ' || mgr_role || ' mgr_name ' || mgr_name);
188 wf_engine.CreateProcess (itemtype => item_type,
189 itemkey => item_key,
190 process => 'MASS_SCORE_CARD_TRANSFER',
191 user_key => 'Mass Score Card Transfer',
192 owner_role => mgr_role);
193 -- owner_role => fnd_global.user_name);
194
195 --dbms_output.put_line(' Created Process ' );
196
197 --- to be substituted
198 wf_engine.setitemattrtext(item_type,item_key,SC_LIST_WF_ATTR_NAME,score_card_list);
199 wf_engine.setitemattrtext(item_type,item_key,SC_OVN_LIST_WF_ATTR_NAME,l_sc_latest_ovn_list);
200 -- wf_engine.setitemattrtext(item_type,item_key,'HR_WPM_MASS_SC_TRNSF_PERFORMER',fnd_global.user_name);
201 wf_engine.SetItemAttrNumber(item_type,item_key,'HR_WPM_TXN_OWNER_PERSON_ID',txn_owner_person_id);
202 wf_engine.setitemattrtext(item_type,item_key,'HR_WPM_MASS_SC_TRNSF_PERFORMER',mgr_role);
203 wf_engine.setitemattrtext(item_type,item_key,'HR_WPM_MGR_NAME',mgr_name);
204 wf_engine.setitemattrtext(item_type,item_key,'HR_WPM_MASS_TRNSF_COMMENTS',comments);
205 -- As we could not use ScoreCardHeaderCO because of encryption problem
206 -- we have to differentiate the caller whether it is from Mass Score Card Process or
207 -- normal.
208 wf_engine.setitemattrtext(item_type,item_key,'HR_WPM_SC_SOURCE_TYPE','WF');
209
210
211 wf_engine.StartProcess (itemtype => item_type,
212 itemkey => item_key );
213
214 --dbms_output.put_line(' Start Process ' );
215
216 result_code := 'S';
217 --dbms_output.put_line(' Launched the Process ' || result_code);
218
219 -- to be removed when integrated
220 --commit;
221
222 EXCEPTION
223 WHEN others THEN
224 --dbms_output.put_line(' Failed to start the process ');
225 rollback to start_process;
226 --dbms_output.put_line( 'Exception in this procedure' || sqlcode || sqlerrm );
227 result_code := 'F';
228 raise ;
229 END;
230
231
232
233
234 PROCEDURE Defer(itemtype in varchar2,
235 itemkey in varchar2,
236 actid in number,
237 funcmode in varchar2,
238 resultout out nocopy varchar2)
239 IS
240 BEGIN
241 -- to be added for profile check
242 if (funcmode = 'RUN') then
243 resultout :='COMPLETE:N';
244 end if;
245
246 EXCEPTION
247 WHEN others THEN
248 raise;
249 END;
250
251 PROCEDURE IS_FINAL_SCORE_CARD (itemtype in varchar2,
252 itemkey in varchar2,
253 actid in number,
254 funcmode in varchar2,
255 resultout out nocopy varchar2)
256 IS
257 score_card_list varchar2(1000);
258 processed_score_card_list varchar2(1000);
259 log_message varchar2(1000) default null;
260 BEGIN
261 if (funcmode = 'RUN') then
262
263 score_card_list := wf_engine.getitemattrtext(itemtype,itemkey,SC_LIST_WF_ATTR_NAME,false);
264 processed_score_card_list := wf_engine.getitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME,true);
265
266 if(score_card_list = processed_score_card_list) then
267 resultout :='COMPLETE:Y';
268 else
269 resultout :='COMPLETE:N';
270 end if;
271
272
273
274 end if;
275 EXCEPTION
276 WHEN others THEN
277 raise;
278 END;
279
280
281 PROCEDURE FAILED_SCORE_CARDS (itemtype in varchar2,
282 itemkey in varchar2,
283 actid in number,
284 funcmode in varchar2,
285 resultout out nocopy varchar2)
286 IS
287 sc_error_list varchar2(1000);
288 BEGIN
289 if (funcmode = 'RUN') then
290 sc_error_list := wf_engine.getitemattrtext(itemtype,itemkey,'HR_WPM_SC_ERROR_LIST',true);
291 if( sc_error_list is not null and length(sc_error_list) > 0)
292 then
293 resultout :='COMPLETE:Y';
294 else
295 resultout :='COMPLETE:N';
296 end if;
297 end if;
298 EXCEPTION
299 WHEN others THEN
300 raise;
301 END;
302
303 PROCEDURE TEST_ACTIVITY (itemtype in varchar2,
304 itemkey in varchar2,
305 actid in number,
306 funcmode in varchar2,
307 resultout out nocopy varchar2)
308 IS
309 BEGIN
310 if (funcmode = 'RUN') then
311 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_LOG_MESSAGES','TEST_ACTIVITY');
312 -- resultout :='COMPLETE:Y';
313 end if;
314 EXCEPTION
315 WHEN others THEN
316 raise;
317 END;
318
319
320 PROCEDURE PROCESS_SCORE_CARD (itemtype in varchar2,
321 itemkey in varchar2,
322 actid in number,
323 funcmode in varchar2,
324 resultout out nocopy varchar2)
325 IS
326
327 cursor get_score_card_role(p_score_card_id in number)
328 IS
329 select wf.name wf_role, people.global_name emp_name, sc.scorecard_name, sc.plan_id
330 from per_personal_scorecards sc, per_all_assignments_f asgn,
331 per_all_people_f people, wf_roles wf
332 where sc.scorecard_id = p_score_card_id
333 and asgn.assignment_id = sc.assignment_id
334 and sysdate between asgn.effective_start_date and asgn.effective_end_date
335 and asgn.person_id = people.person_id
336 and wf.orig_system_id = people.person_id
337 and wf.orig_system = 'PER'
338 and sysdate between people.effective_start_date and people.effective_end_date;
339 -- to be see that the cursor retreives only one id
340 cursor get_score_card_txn(p_score_card_id number, txn_owner per_all_people_f.person_id%TYPE)
341 IS
342 select transaction_id from hr_api_transactions
343 where transaction_ref_id = p_score_card_id
344 and transaction_ref_table = 'PER_PERSONAL_SCORECARDS'
345 and creator_person_id = txn_owner;
346
347 -- cursor to get the ovn for a scorecardId.
348 cursor get_score_cards ( p_sc_id varchar2 )
349 is
350 select object_version_number from per_personal_scorecards
351 where scorecard_id = p_sc_id;
352 -- to be sorted with the lenght
353 score_card_list varchar2(1000);
354 SC_OVN_LIST varchar2(1000);
355 processed_score_card_list varchar2(1000);
356 processed_sc_ovn_list varchar2(1000);
357 processed_error_sc_list varchar2(1000);
358 processed_succ_sc_list varchar2(1000);
359 next_score_card varchar2(20) default null;
360 next_sc_ovn varchar2(20) default null;
361 api_return_status varchar2(20) default null;
362 api_return_ovn number default null;
363 score_card_wf_role wf_local_roles.name%TYPE;
364 log_message varchar2(5000) default null;
365 score_card_performer wf_local_roles.name%TYPE;
366 score_card_emp_name per_all_people_f.global_name%TYPE;
367 score_card_txn_id number default null;
368 l_error_log varchar2(20000);
369 score_card_name per_personal_scorecards.scorecard_name%TYPE;
370 txn_owner_person_id per_all_people_f.person_id%TYPE;
371 temp varchar2(2000);
372 l_duplsicate_name_warning boolean;
373 l_proc varchar2(72) := g_package || 'PROCESS_SCORE_CARD';
374 l_score_card_plan_id per_personal_scorecards.plan_id%TYPE;
375
376
377 BEGIN
378
379
380 if (funcmode = 'RUN') then
381 score_card_list := wf_engine.getitemattrtext(itemtype,itemkey,SC_LIST_WF_ATTR_NAME,false);
382 SC_OVN_LIST := wf_engine.getitemattrtext(itemtype,itemkey,SC_OVN_LIST_WF_ATTR_NAME,false);
383
384 processed_score_card_list := wf_engine.getitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME,true);
385 processed_sc_ovn_list := wf_engine.getitemattrtext(itemtype,itemkey,SC_OVNS_PROCESSED_WF_ATTR_NAME,true);
386 processed_error_sc_list := wf_engine.getitemattrtext(itemtype,itemkey,'HR_WPM_SC_ERROR_LIST',true);
387 txn_owner_person_id := wf_engine.GetItemAttrNumber(itemtype,itemkey,'HR_WPM_TXN_OWNER_PERSON_ID',true);
388
389 processed_succ_sc_list := wf_engine.getitemattrtext(itemtype,itemkey,'HR_WPM_MASS_SC_SUCC_LIST',true);
390
391 if( length(score_card_list) > nvl(length(processed_score_card_list),0) ) then
392 if( processed_score_card_list is null or processed_score_card_list = '') then
393 next_score_card := Split( score_card_list, 1 , ',') ;
394 --next_sc_ovn := Split( SC_OVN_LIST, 1 , ',') ;
395 -- get the latest ovn from db rather than reading from list as the list not used everywhere consistently
396 open get_score_cards (next_score_card);
397 fetch get_score_cards into next_sc_ovn;
398 close get_score_cards;
399
400 else
401 next_score_card := Split( substr(score_card_list, length(processed_score_card_list) ) ,2, ',');
402 -- next_sc_ovn := Split( substr(SC_OVN_LIST, length(processed_sc_ovn_list) ) ,2, ',');
403 -- get the latest ovn from db rather than reading from list as the list not used everywhere consistently
404 open get_score_cards (next_score_card);
405 fetch get_score_cards into next_sc_ovn;
406 close get_score_cards;
407 end if;
408
409 if( length(next_score_card)>0 and instr(next_score_card,',',1) = 0) then
410 begin
411 open get_score_card_txn(to_number(next_score_card),fnd_global.employee_id);
412 fetch get_score_card_txn into score_card_txn_id;
413 close get_score_card_txn;
414
415 open get_score_card_role(to_number(next_score_card));
416 fetch get_score_card_role into score_card_performer, score_card_emp_name, score_card_name, l_score_card_plan_id;
417 close get_score_card_role;
418
419 log_message := wf_engine.getitemattrtext(itemtype,itemkey,'SC_ERROR',true);
420
421 savepoint start_process_scorecard;
422
423 if( score_card_txn_id is null) then
424 hr_personal_scorecard_swi.update_scorecard_status
425 (p_validate => hr_Api.g_false_num
426 ,p_effective_date => trunc(sysdate) -- to be
427 ,p_scorecard_id => to_number(next_score_card)
428 ,p_object_version_number => next_sc_ovn
429 ,p_status_code => 'WKR'
430 ,p_return_status => api_return_status
431 );
432 else
433
434 /*
435 api_return_status := hr_transaction_swi.commit_transaction_tree(
436 p_transaction_id => score_card_txn_id,
437 p_validate => 0,
438 p_error_log => l_error_log);
439 */
440
441 api_return_status := hr_transaction_swi.commit_transaction(
442 p_transaction_id => score_card_txn_id,
443 p_validate => hr_Api.g_false_num);
444 end if;
445
446
447 --dbms_output.put_line(' *** api_return_status *** ' || api_return_status);
448 --dbms_output.put_line(' *** TXN LOG *** ' || l_error_log);
449
450 -- as error_log column has 4000 length we need to truncate
451 if(length(l_error_log) > 3800) then
452 hr_utility.set_location(' Error Log Truncated ' || l_proc,50);
453 l_error_log := substr(l_error_log,1,3800);
454 end if;
455
456 if(api_return_status = 'E') then
457 for i in 1 .. fnd_msg_pub.count_msg Loop
458 l_error_log := l_error_log || fnd_msg_pub.get(p_msg_index => I, p_encoded => 'F');
459 end loop;
460
461 log_message := log_message || l_error_log;
462
463 if ( api_return_status = 'E' ) then
464 rollback to start_process_scorecard;
465
466 hr_personal_scorecard_swi.update_scorecard_status
467 (p_validate => hr_Api.g_false_num
468 ,p_effective_date => trunc(sysdate) -- to be
469 ,p_scorecard_id => to_number(next_score_card)
470 ,p_object_version_number => next_sc_ovn
471 ,p_status_code => 'ERROR'
472 ,p_return_status => api_return_status
473 );
474 end if;
475
476 fnd_msg_pub.Delete_Msg;
477
478 -- to be changed once the error_log column is added
479 --update per_personal_scorecards
480 --set error_log = l_error_log
481 --where scorecard_id = next_score_card;
482 per_pms_upd.upd(p_effective_date => trunc(sysdate),
483 p_scorecard_id => to_number(next_score_card),
484 p_object_version_number => next_sc_ovn,
485 p_error_log => l_error_log,
486 p_duplicate_name_warning => l_duplsicate_name_warning);
487
488 wf_engine.setitemattrtext(itemtype,itemkey,'SC_ERROR' , log_message || 'SCID='||next_score_card || 'api_return_status=' || api_return_status);
489
490 --dbms_output.put_line(' Putting the attributes ');
491 wf_engine.setitemattrtext(itemtype,itemkey,'SC_EMP_NAME',score_card_emp_name);
492 wf_engine.setitemattrtext(itemtype,itemkey,'HR_MASS_TRNSF_PLAN_ID',''||l_score_card_plan_id);
493 wf_engine.setitemattrtext(itemtype,itemkey,'HR_REL_APPS_ACTION_TYPE','EMP_TO_MGR');
494
495 if( processed_error_sc_list is not null and length(processed_error_sc_list) > 0)
496 then
497 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_SC_ERROR_LIST',processed_error_sc_list || ',' || next_score_card);
498 else
499 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_SC_ERROR_LIST',next_score_card);
500 end if;
501
502 if(length(processed_score_card_list) is null or length(processed_score_card_list) = 0) then
503 wf_engine.setitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME, next_score_card);
504 wf_engine.setitemattrtext(itemtype,itemkey,SC_OVNS_PROCESSED_WF_ATTR_NAME, next_sc_ovn);
505 else
506 wf_engine.setitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME,processed_score_card_list || ',' ||next_score_card);
507 wf_engine.setitemattrtext(itemtype,itemkey,SC_OVNS_PROCESSED_WF_ATTR_NAME,processed_sc_ovn_list || ',' ||next_sc_ovn);
508 end if;
509 --dbms_output.put_line(' done attributes ');
510
511 resultout :='COMPLETE:FAIL';
512 elsif ( api_return_status = 'S' or api_return_status = 'W') then
513
514 if( api_return_status = 'W' ) then
515 for i in 1 .. fnd_msg_pub.count_msg Loop
516 log_message := log_message || l_error_log || fnd_msg_pub.get(p_msg_index => I, p_encoded => 'F');
517 end loop;
518
519 fnd_msg_pub.Delete_Msg;
520
521 --update per_personal_scorecards
522 --set error_log = l_error_log
523 --where scorecard_id = next_score_card;
524 end if;
525
526 begin
527
528 hr_personal_scorecard_swi.update_scorecard_status
529 (p_validate => hr_Api.g_false_num
530 ,p_effective_date => trunc(sysdate) -- to be
531 ,p_scorecard_id => to_number(next_score_card)
532 ,p_object_version_number => next_sc_ovn
533 ,p_status_code => 'WKR'
534 ,p_return_status => api_return_status
535 );
536
537 per_pms_upd.upd(p_effective_date => trunc(sysdate),
538 p_scorecard_id => to_number(next_score_card),
539 p_object_version_number => next_sc_ovn,
540 p_error_log => l_error_log,
541 p_duplicate_name_warning => l_duplsicate_name_warning);
542
543 hr_transaction_swi.delete_transaction(score_card_txn_id,hr_Api.g_false_num);
544
545 exception when others then
546
547 for i in 1 .. fnd_msg_pub.count_msg Loop
548 l_error_log := l_error_log || fnd_msg_pub.get(p_msg_index => I, p_encoded => 'F');
549 end loop;
550
551 temp := wf_engine.getitemattrtext(itemtype,itemkey,'SC_ERROR', true);
552 wf_engine.setitemattrtext(itemtype,itemkey,'SC_ERROR', temp || l_error_log);
553 end;
554
555 --dbms_output.put_line(' putting attributes ');
556
557 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_SC_NAME',score_card_name);
558 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_EMP_SC_ID',next_score_card);
559 wf_engine.setitemattrtext(itemtype,itemkey,'HR_MASS_TRNSF_PLAN_ID',''||l_score_card_plan_id);
560 wf_engine.setitemattrtext(itemtype,itemkey,'HR_REL_APPS_ACTION_TYPE','MGR_TO_EMP');
561
562 if( processed_succ_sc_list is not null and length(processed_succ_sc_list) > 0)
563 then
564 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_MASS_SC_SUCC_LIST',processed_succ_sc_list || ',' || next_score_card);
565 else
566 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_MASS_SC_SUCC_LIST',next_score_card);
567 end if;
568
569 resultout :='COMPLETE:SUCCESS';
570 end if;
571
572 if(length(processed_score_card_list) is null or length(processed_score_card_list) = 0) then
573 wf_engine.setitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME, next_score_card);
574 wf_engine.setitemattrtext(itemtype,itemkey,SC_OVNS_PROCESSED_WF_ATTR_NAME, next_sc_ovn);
575 else
576 wf_engine.setitemattrtext(itemtype,itemkey,SC_PROCESSED_LIST_WF_ATTR_NAME,processed_score_card_list || ',' ||next_score_card);
577 wf_engine.setitemattrtext(itemtype,itemkey,SC_OVNS_PROCESSED_WF_ATTR_NAME,processed_sc_ovn_list || ',' ||next_sc_ovn);
578 end if;
579
580 if( processed_succ_sc_list is not null and length(processed_succ_sc_list) > 0)
581 then
582 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_MASS_SC_SUCC_LIST',processed_succ_sc_list || ',' || next_score_card);
583 else
584 wf_engine.setitemattrtext(itemtype,itemkey,'HR_WPM_MASS_SC_SUCC_LIST',next_score_card);
585 end if;
586
587 wf_engine.setitemattrtext(itemtype,itemkey,SC_PERFORMER_WF_ATTR_NAME,score_card_performer);
588
589 exception
590 when others then
591 log_message := log_message || sqlerrm || sqlcode;
592 --dbms_output.put_line(' log_message ' || log_message);
593 wf_engine.setitemattrtext(itemtype,itemkey,'SC_ERROR',log_message);
594 wf_engine.setitemattrtext(itemtype,itemkey,'SC_EMP_NAME',score_card_emp_name);
595 resultout :='COMPLETE:FAIL';
596 end;
597
598 end if;
599
600 end if;
601
602 end if;
603
604 END;
605
606
607 procedure SEND_NTF(itemtype in varchar2,
608 itemkey in varchar2,
609 actid in number,
610 funcmode in varchar2,
611 resultout in out nocopy varchar2)
612 is
613 prole wf_users.name%type; -- Fix 3210283.
614 expand_role varchar2(1);
615
616 begin
617 if (funcmode <> wf_engine.eng_run) then
618 resultout := wf_engine.eng_null;
619 return;
620 end if;
621
622 prole := wf_engine.GetActivityAttrText(
623 itemtype => itemtype,
624 itemkey => itemkey,
625 actid => actid,
626 aname => 'PERFORMER');
627
628 expand_role := nvl(Wf_Engine.GetActivityAttrText(itemtype, itemkey,
629 actid, 'EXPANDROLES'),'N');
630
631
632
633 if prole is null then
634 Wf_Core.Token('TYPE', itemtype);
635 Wf_Core.Token('ACTID', to_char(actid));
636 Wf_Core.Raise('WFENG_NOTIFICATION_PERFORMER');
637 end if;
638
639 Wf_Engine_Util.Notification_Send(itemtype, itemkey, actid,
640 'HR_WPM_SC_TRNSF_SUCC', 'HRWPM', prole, expand_role,
641 resultout);
642
643
644 exception when others then
645 raise;
646 end;
647
648
649 END HR_WPM_MASS_SCORE_CARD_TRNSF; -- Package spec
650