1 PACKAGE BODY WF_ROUTE AS
2 /* $Header: wfrtgb.pls 120.4 2006/04/06 09:31:41 rwunderl ship $ */
3
4 --
5 -- Error (PRIVATE)
6 -- Print a page with an error message.
7 -- Errors are retrieved from these sources in order:
8 -- 1. wf_core errors
9 -- 2. Oracle errors
10 -- 3. Unspecified INTERNAL error
11 --
12 procedure Error
13 as
14 begin
15 Null;
16 end Error;
17
18 --
19 -- RuleOwner (PRIVATE)
20 -- Return role owning this rule, and validate rule exists
21 -- IN
22 -- ruleid - rule id
23 -- RETURNS
24 -- Owning role
25 --
26 function RuleOwner(
27 ruleid in number)
28 return varchar2
29 is
30 owner varchar2(320);
31 begin
32 begin
33 select WRR.ROLE
34 into owner
35 from WF_ROUTING_RULES WRR
36 where WRR.RULE_ID = RuleOwner.ruleid;
37 exception
38 when no_data_found then
39 Wf_Core.Token('RULE', to_char(ruleid));
40 Wf_Core.Raise('WFRTG_INVALID_RULE');
41 end;
42
43 return owner;
44 exception
45 when others then
46 wf_core.context('Wf_Route', 'RuleOwner', to_char(ruleid));
47 raise;
48 end RuleOwner;
49
50 --
51 -- Authenticate (PRIVATE)
52 -- Authenticate current user has access to rules for this user.
53 -- Exception raised if access is denied.
54 -- IN
55 -- user - user to check
56 -- RETURNS
57 -- Authenticated username
58 -- (username, or current user if username passed in is null)
59 --
60 function Authenticate(
61 user in varchar2)
62 return varchar2
63 is
64 curuser varchar2(320);
65 admin_role varchar2(320);
66 begin
67 -- Get current user
68 Wfa_Sec.GetSession(curuser);
69
70 -- If user is null, must be for current user
71 if (user is null) then
72 return(curuser);
73 end if;
74
75 -- If admin granted to current user,
76 -- grant access and pretend to be
77 admin_role := wf_core.translate('WF_ADMIN_ROLE');
78 if (admin_role = '*' or
79 Wf_Directory.IsPerformer(curuser, admin_role)) then
80 return(user);
81 end if;
82
83 -- Otherwise current user must match the user checking
84 if (curuser <> user) then
85 Wf_Core.Token('CURUSER', curuser);
86 Wf_Core.Token('USER', user);
87 Wf_Core.Raise('WFRTG_ACCESS_USER');
88 end if;
89
90 return(user);
91 exception
92 when others then
93 wf_core.context('Wf_Route', 'Authenticate', user);
94 raise;
95 end Authenticate;
96
97 --
98 -- GetAttrValue (PRIVATE)
99 -- Get value of response rule attribute
100 -- IN
101 -- ruleid - routing rule id
102 -- attrname - attribute name
103 -- OUT
104 -- tvalue - text value
105 -- nvalue - number value
106 -- dvalue - date value
107 -- RETURNS
108 -- False if no attr not defined for this rule
109 --
110 function GetAttrValue(
111 ruleid in number,
112 attrname in varchar2,
113 tvalue out nocopy varchar2,
114 nvalue out nocopy number,
115 dvalue out nocopy date)
116 return boolean
117 is
118 begin
119 select WRRA.TEXT_VALUE, WRRA.NUMBER_VALUE, WRRA.DATE_VALUE
120 into tvalue, nvalue, dvalue
121 from WF_ROUTING_RULE_ATTRIBUTES WRRA
122 where WRRA.RULE_ID = GetAttrValue.ruleid
123 and WRRA.NAME = GetAttrValue.attrname;
124
125 return(TRUE);
126 exception
127 when no_data_found then
128 return(FALSE);
129 when others then
130 wf_core.context('Wf_Route', 'GetAttrValue', to_char(ruleid), attrname);
131 raise;
132 end GetAttrValue;
133
134 --
135 -- GetLookupMeaning (PRIVATE)
136 -- Retrieve displayed value of lookup
137 -- IN
138 -- ltype - lookup type
139 -- lcode - lookup code
140 -- RETURNS
141 -- Displayed meaning of lookup code
142 --
143 function GetLookupMeaning(
144 ltype in varchar2,
145 lcode in varchar2)
146 return varchar2
147 is
148 meaning varchar2(80);
149 begin
150 select WL.MEANING
151 into meaning
152 from WF_LOOKUPS WL
153 where WL.LOOKUP_TYPE = GetLookupMeaning.ltype
154 and WL.LOOKUP_CODE = GetLookupMeaning.lcode;
155
156 return(meaning);
157 exception
158 when no_data_found then
159 return(lcode);
160 when others then
161 wf_core.context('Wf_Route', 'GetLookupMeaning', ltype, lcode);
162 raise;
163 end GetLookupMeaning;
164
165 --
166 -- GetDisplayValue (PRIVATE)
167 -- Get displayed value of a response attribute field
168 -- IN
169 -- type - field type (VARCHAR2, NUMBER, DATE, LOOKUP, URL)
170 -- format - field format (depends on type)
171 -- tvalue - text value
172 -- nvalue - number value
173 -- dvalue - date value
174 -- RETURNS
175 -- Displayed value
176 --
177 function GetDisplayValue(
178 type in varchar2,
179 format in varchar2,
180 tvalue in varchar2,
181 nvalue in number,
182 dvalue in date)
183 return varchar2
184 is
185 l_username VARCHAR2(320);
186 value varchar2(2000);
187 l_document_attributes fnd_document_management.fnd_document_attributes;
188
189 begin
190 -- Check session and current user
191 wfa_sec.GetSession(l_username);
192 l_username := upper(l_username);
193
194 if (type = 'VARCHAR2') then
195 value := tvalue;
196 elsif (type = 'NUMBER') then
197 if (format is null) then
198 value := to_char(nvalue);
199 else
200 value := to_char(nvalue, format);
201 end if;
202 elsif (type = 'DATE') then
203 if (format is null) then
204 value := to_char(dvalue);
205 else
206 value := to_char(dvalue, format);
207 end if;
208 elsif (type = 'LOOKUP') then
209 value := GetLookupMeaning(format, tvalue);
210 elsif (type = 'URL') then
211 value := tvalue;
212 elsif (type = 'DOCUMENT') then
213 /*
214 ** If the default value is a dm document then go get the
215 ** title from the DM system and place it in the field. If
216 ** its a plsql doc then just put the default value in the field
217 */
218 IF (SUBSTR(tvalue, 1, 3) = 'DM:') THEN
219
220 /*
221 ** get the document name
222 */
223 fnd_document_management.get_document_attributes(l_username,
224 tvalue,
225 l_document_attributes);
226
227 value := l_document_attributes.document_name;
228
229 ELSE
230
231 -- Default to return text value unchanged
232 value := tvalue;
233
234 END IF;
235
236 else
237 -- Default to return text value unchanged
238 value := tvalue;
239 end if;
240
241 return(value);
242
243 exception
244 when others then
245 wf_core.context('Wf_Route', 'GetDisplayWindow', type, format,
246 tvalue, to_char(nvalue), to_char(dvalue));
247 raise;
248 end GetDisplayValue;
249
250 --
251 --
252 -- GetRole (PRIVATE)
253 -- Produce a Role response field
254 procedure GetRole(
255 name in varchar2,
256 dvalue in varchar2,
257 seq in varchar2 )
258 is
259 len pls_integer;
260 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate ('WFPREF_LOV'));
261
262 -- variable for LOV
263 l_url varchar2(1000);
264 l_media varchar2(240) := wfa_html.image_loc;
265 l_icon varchar2(30) := 'FNDILOV.gif';
266 l_text varchar2(30) := '';
267 realname varchar2(360) := null;
268 s0 varchar2(2000);
269 --
270 begin
271
272 -- Draw field
273 htp.formHidden('h_fnames', name||'#ROLE#');
274 -- always print the display field as null
275 htp.formHidden('h_fvalues', dvalue);
276
277 -- get the display name
278 wf_directory.GetRoleInfo(dvalue, realname, s0, s0, s0, s0);
279
280 -- add LOV here: Note:bottom is name of frame.
281 -- Note: The REPLACE function replaces all the space characters with
282 -- the proper escape sequence.
283 l_url := 'javascript:fnd_open_dm_display_window('||''''||
284 REPLACE('wf_lov.display_lov?p_lov_name='||'owner'||
285 '&p_display_name='||'WFA_FIND_USER'||
286 '&p_validation_callback=wfa_html.wf_user_val'||
287 '&p_dest_hidden_field=top.opener.parent.document.CREATE_RULE.h_fvalues['||seq||'].value'||
288 '&p_current_value=top.opener.parent.document.CREATE_RULE.h_fdocnames['||seq||'].value'||
289 '&p_display_key='||'Y'||
290 '&p_dest_display_field=top.opener.parent.document.CREATE_RULE.h_fdocnames['||seq||'].value',
291 ' ', '%20')||''''||',500,500)';
292
293 -- print everything together so ther is no gap.
294 htp.tabledata(htf.formText(cname=>'h_fdocnames',
295 csize=>30,
296 cmaxlength=>240,
297 cvalue=>realname,
298 cattributes=>'id="i_attr'||seq||'"')||
299 '<A href='||l_url||'>'||
300 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
301 l_message||'" onmouseover="window.status='||''''||
302 l_message||''''||';return true"></A>',
303 cattributes=>'id=""');
304
305 exception
306 when others then
307 wf_core.context('Wf_route', 'GetRole', name, seq);
308 raise;
309 end GetRole;
310
311
312 --
313 -- GetLookup (PRIVATE)
314 -- Produce a lookup response field
315 -- IN
316 -- name - field name
317 -- value - default value (lookup code)
318 -- format - lookup type
319 -- submit - flag include a submit button for result field
320 --
321 -- MODIFICATION LOG:
322 -- 06-JUN-2001 JWSMITH BUG 1819232 - added ID attrib for TD tag for ADA
323 --
324 procedure GetLookup(
325 name in varchar2,
326 value in varchar2,
327 format in varchar2,
328 submit in boolean,
329 seq in varchar2)
330 as
331 cursor lookup_codes(p_lookup_type varchar2) is
332 select MEANING, LOOKUP_CODE
333 from WF_LOOKUPS
334 where LOOKUP_TYPE = p_lookup_type
335 order by MEANING;
336
337 template varchar2(4000);
338
339 begin
340 -- always print the display field as null
341 htp.formHidden('h_fdocnames', '');
342
343 -- Create hidden field and select list
344 template := htf.formHidden('h_fnames', name||'#LOOKUP#'||format)||
345 wf_core.newline||
346 htf.formSelectOpen('h_fvalues',
347 cattributes=>'id="i_attr'||seq||'"');
348
349
350 -- Add all lookups to select list
351 for i in lookup_codes(format) loop
352 if (i.lookup_code = value) then
353 template := template||wf_core.newline||
354 htf.formSelectOption(i.meaning, 'SELECTED');
355 else
356 template := template||wf_core.newline||
357 htf.formSelectOption(i.meaning);
358 end if;
359 end loop;
360 template := template||wf_core.newline||htf.formSelectClose;
361
362 if (not submit) then
363 -- Draw a normal field
364 htp.tableData(template, 'left',cattributes=>'id=""');
365 else
366 -- Draw a submit-style field for the result.
367 -- Leave TableData open so reassign button can be added to same cell.
368 htp.p('<TD ID="" ALIGN=left>'
369 ||wf_core.newline||template);
370 htp.formSubmit('Submit', wf_core.translate('SUBMIT'), 'NOBORDER');
371 end if;
372
373 exception
374 when others then
375 wf_core.context('Wf_Route', 'GetLookup', name, value, format, seq);
376 raise;
377 end GetLookup;
378
379 -- GetDocument (PRIVATE)
380 -- Prints the document text field with the DM lov button.
381 Procedure GetDocument (name in varchar2,
382 format in varchar2,
383 dvalue in varchar2,
384 index_num in varchar2) is
385
386 l_username varchar2(320); -- Username to query
387 l_callback_URL varchar2(4000);
388 l_attach_URL varchar2(4000);
389 begin
390
391 htp.formHidden('h_fnames', name||'#DOCUMENT#'||format);
392 htp.formHidden('h_fvalues', null);
393
394 -- Set the destination field name for the document id
395 fnd_document_management.set_document_id_html (
396 null,
397 'CREATE_RULE',
398 'h_fvalues['||index_num||']',
399 'h_fdocnames['||index_num||']',
400 l_callback_url);
401
402 -- Check session and current user
403 wfa_sec.GetSession(l_username);
404 l_username := upper(l_username);
405
406 fnd_document_management.get_launch_attach_url (
407 l_username,
408 l_callback_url,
409 TRUE,
410 l_attach_url);
411
412 -- document field
413 htp.tableData(cvalue=>htf.formText(cname=>'h_fdocnames', csize=>32,
414 cmaxlength=>60,
415 cvalue=>dvalue,
416 cattributes=>'id="i_attr'||index_num||'"')
417 ||'   '||l_attach_URL,
418 calign=>'Left',
419 cattributes=>'id=""');
420
421 exception
422 when others then
423 wf_core.context('Wf_route', 'GetDocument', name, format, dvalue);
424 raise;
425 end GetDocument;
426
427 --
428 -- GetField (PRIVATE)
429 -- Produce a varchar2/number/date response field
430 -- IN
431 -- name - field name
432 -- type - field type (VARCHAR2, NUMBER, DATE)
433 -- format - format mask
434 -- dvalue - default value
435 -- index_num - for ada enhancement
436 --
437 procedure GetField(
438 name in varchar2,
439 type in varchar2,
440 format in varchar2,
441 dvalue in varchar2,
442 index_num in varchar2)
443 is
444 len number;
445 begin
446 -- Figure field len
447 if (type = 'VARCHAR2') then
448 len := nvl(to_number(format), 2000);
449 else
450 len := 62;
451 end if;
452
453 -- Draw field
454 htp.formHidden('h_fnames', name||'#'||type||'#'||format);
455
456 -- always print the display field as null
457 htp.formHidden('h_fdocnames', '');
458
459 if (len <= 80) then
460 -- single line field
461 htp.tableData(
462 cvalue=>htf.formText(cname=>'h_fvalues',
463 csize=>len,
464 cmaxlength=>len,
465 cvalue=>dvalue,
466 cattributes=>'id="i_attr'||index_num||'"'),
467 calign=>'Left',
468 cattributes=>'id=""');
469 else
470 -- multi line field
471 htp.tableData(
472 cvalue=>htf.formTextareaOpen2(
473 cname=>'h_fvalues',
474 nrows=>2,
475 ncolumns=>65,
476 cwrap=>'SOFT',
477 cattributes=>'id="i_attr'||index_num||'" maxlength= '||to_char(len))
478 || dvalue|| htf.formTextareaClose,
479 calign=>'Left',
480 cattributes=>'id=""');
481 end if;
482 exception
483 when others then
484 wf_core.context('Wf_Route', 'GetField', name, type, format, dvalue,
485 index_num);
486 raise;
487 end GetField;
488
489 --
490 -- ValidateRole (PRIVATE)
491 -- Validate that role is valid internal or display name
492 -- IN
493 -- role - role to check
494 -- RETURNS
495 -- Internal name of role
496 --
497 function ValidateRole(
498 role in varchar2)
499 return varchar2
500 is
501 dummy number;
502 rname varchar2(320); -- Internal name of role
503 role_info_tbl wf_directory.wf_local_roles_tbl_type;
504 begin
505 -- Look first for internal name
506 rname := upper(ValidateRole.role);
507 Wf_Directory.GetRoleInfo2(rname,role_info_tbl);
508 if (role_info_tbl(1).name is not null) then
509 return(rname);
510 end if;
511
512 -- Look for display_name
513 begin
514 -- Very costly statement
515 select NAME
516 into rname
517 from WF_ROLE_LOV_VL
518 where DISPLAY_NAME = ValidateRole.role;
519
520 -- Found, return internal name
521 return(rname);
522 exception
523 when no_data_found then
524 -- Not displayed or internal role name, error
525 wf_core.token('ROLE', role);
526 wf_core.raise('WFNTF_ROLE');
527 end;
528
529 exception
530 when others then
531 wf_core.context('Wf_Route', 'ValidateRole', role);
532 raise;
533 end ValidateRole;
534
535 --
536 -- StringToDate (PRIVATE)
537 -- Convert string to date, taking optional time into account
538 -- NOTE
539 -- Makes the following assumptions:
540 -- 1. Default NLS_DATE_FORMAT does not have a time component,
541 -- and does not contain any ':' characters.
542 -- 2. Dstring will be in one of the following formats:
543 -- NLS_DATE_FORMAT
544 -- NLS_DATE_FORMAT||' HH24:MI'
545 -- NLS_DATE_FORMAT||' HH24:MI:SS'
546 -- IN
547 -- dstring - date as string
548 -- RETURNS
549 -- Date as date
550 --
551 function StringToDate(
552 dstring in varchar2)
553 return date
554 is
555 colon1 number;
556 colon2 number;
557 space number;
558 datebuf date;
559 begin
560 -- Check for time component
561 colon1 := instr(dstring, ':', 1, 1);
562 if (colon1 = 0) then
563 -- No time component, do a straight conversion
564 datebuf := to_date(dstring, SYS_CONTEXT('USERENV','NLS_DATE_FORMAT'));
565 else
566 -- Look for last space in string (not counting trailers).
567 -- Using this as dividing point, get date portion of string
568 -- without time.
569 space := instr(rtrim(dstring), ' ', -1, 1);
570 datebuf := to_date(substr(dstring, 1, space-1),SYS_CONTEXT('USERENV','NLS_DATE_FORMAT'));
571
572 -- Append time component
573 colon2 := instr(dstring, ':', 1, 2);
574 if (colon2 = 0) then
575 -- Assume HH24:MI time component
576 datebuf := to_date(to_char(datebuf, 'YYYY/MM/DD')||
577 to_char(to_date(substr(dstring, space),
578 ' HH24:MI'),
579 ' HH24:MI'),
580 'YYYY/MM/DD HH24:MI');
581 else
582 -- Assume HH24:MI:SS time component
583 datebuf := to_date(to_char(datebuf, 'YYYY/MM/DD')||
584 to_char(to_date(substr(dstring, space),
585 ' HH24:MI:SS'),
586 ' HH24:MI:SS'),
587 'YYYY/MM/DD HH24:MI:SS');
588 end if;
589 end if;
590
591 return(datebuf);
592 exception
593 when others then
594 wf_core.context('Wf_Route', 'StringToDate', dstring);
595 raise;
596 end StringToDate;
597
598 --
599 -- SetAttribute (PRIVATE)
600 -- Set routing response attributes
601 -- IN
602 -- ruleid - routing rule id
603 -- attr_name_type - attribute name#type#format
604 -- attr_value - attribute value
605 --
606 procedure SetAttribute(
607 ruleid in number,
608 attr_name_type in varchar2,
609 attr_value in varchar2,
610 attr_doc_name in varchar2)
611 as
612 first number;
613 second number;
614 attr_type varchar2(8);
615 attr_name varchar2(30);
616 attr_fmt varchar2(240);
617
618 tvalue varchar2(2000) := '';
619 nvalue number := '';
620 dvalue date := '';
621 begin
622 -- Parse out name#type#format
623 first := instr(attr_name_type, '#', 1);
624 second := instr(attr_name_type, '#', 1, 2);
625 attr_name := substr(attr_name_type, 1, first-1);
626 attr_type := substr(attr_name_type, first+1, second-first-1);
627 attr_fmt := substr(attr_name_type, second+1,
628 length(attr_name_type)-second);
629
630 if (attr_type = 'DATE') then
631 if (attr_fmt is not null) then
632 dvalue := to_date(attr_value, attr_fmt);
633 else
634 dvalue := to_date(attr_value,SYS_CONTEXT('USERENV','NLS_DATE_FORMAT'));
635 end if;
636 elsif (attr_type = 'NUMBER') then
637 if (attr_fmt is not null) then
638 nvalue := to_number(attr_value, attr_fmt);
639 else
640 nvalue := to_number(attr_value);
641 end if;
642 elsif (attr_type = 'LOOKUP') then
643 -- Decode lookup meaning to code
644 begin
645 select WL.LOOKUP_CODE
646 into tvalue
647 from WF_LOOKUPS WL
648 where Wl.LOOKUP_TYPE = SetAttribute.attr_fmt
649 and MEANING = SetAttribute.attr_value;
650 exception
651 when no_data_found then
652 wf_core.token('TYPE', attr_fmt);
653 wf_core.token('CODE', attr_value);
654 wf_core.raise('WFSQL_LOOKUP_CODE');
655 end;
656 elsif (attr_type = 'ROLE') then
657
658 -- Decode role to internal name
659 tvalue := attr_value;
660 wfa_html.validate_display_name (attr_doc_name, tvalue);
661
662 else
663 -- VARCHAR2 or misc values all use text
664 tvalue := attr_value;
665 end if;
666
667 -- Update/Insert attributes table with new values
668 update WF_ROUTING_RULE_ATTRIBUTES WRRA set
669 TEXT_VALUE = SetAttribute.tvalue,
670 NUMBER_VALUE = SetAttribute.nvalue,
671 DATE_VALUE = SetAttribute.dvalue
672 where WRRA.RULE_ID = SetAttribute.ruleid
673 and WRRA.NAME = SetAttribute.attr_name;
674
675 if (sql%rowcount = 0) then
676 -- Insert missing attribute row
677 insert into WF_ROUTING_RULE_ATTRIBUTES (
678 RULE_ID,
679 NAME,
680 TYPE,
681 TEXT_VALUE,
682 NUMBER_VALUE,
683 DATE_VALUE
684 ) values (
685 SetAttribute.ruleid,
686 SetAttribute.attr_name,
687 'RESPOND',
688 SetAttribute.tvalue,
689 SetAttribute.nvalue,
690 SetAttribute.dvalue
691 );
692 end if;
693 exception
694 when others then
695 wf_core.context('Wf_Route', 'SetAttribute',
696 to_char(ruleid), attr_name_type, attr_value);
697 raise;
698 end SetAttribute;
699
700
701 --
702 -- DeleteRule
703 -- Delete rule with ruleid
704 -- IN
705 -- user - role owning rule
706 -- ruleid - Rule id
707 --
708 procedure DeleteRule(
709 user in varchar2 ,
710 ruleid in varchar2)
711 is
712 owner varchar2(320);
713 begin
714 -- Validate access
715 owner := Wf_Route.Authenticate(user);
716
717 -- Delete this rule along with any child attributes
718 delete from WF_ROUTING_RULE_ATTRIBUTES
719 where RULE_ID = ruleid;
720
721 delete from WF_ROUTING_RULES
722 where RULE_ID = ruleid;
723
724 -- Return to opening page
725 Wf_Route.List(user, '--EDITSCREEN--');
726 exception
727 when others then
728 wf_core.context('Wf_Route', 'DeleteRule', ruleid, user);
729 wf_route.error;
730 end;
731
732 --
733 -- SubmitUpdate
734 -- Process rule update page
735 -- IN
736 -- ruleid - Rule id
737 -- action - Rule action
738 -- action_argument - Forward to if forward
739 -- begin_date - Begin date
740 -- end_date - End date
741 -- rule_comment - Rule comment
742 -- h_fnames - array of attr field names
743 -- h_fvalues - array of attr field values
744 -- h_fdocnames - array of document name values
745 -- h_counter - number of fields passed in fnames and fvalues
746 -- delete_button - Delete button flag (for cancel this operation)
747 -- update_button - Update button flag
748 --
749 procedure SubmitUpdate(
750 rule_id in varchar2,
751 action in varchar2,
752 fmode in varchar2 ,
753 action_argument in varchar2 ,
754 display_action_argument in varchar2 ,
755 begin_date in varchar2 ,
756 end_date in varchar2 ,
757 rule_comment in varchar2 ,
758 h_fnames in Name_Array,
759 h_fvalues in Value_Array,
760 h_fdocnames in Value_Array,
761 h_counter in varchar2,
762 delete_button in varchar2 ,
763 update_button in varchar2 )
764 is
765 nruleid number;
766 owner varchar2(320);
767 realname varchar2(360);
768 s0 varchar2(2000);
769 forwardee varchar2(320);
770 l_action varchar2(30) := '';
771 begdate date;
772 enddate date;
773 CANCEL_RECORD exception;
774 begin
775 -- Find rule owner and validate access
776 nruleid := to_number(rule_id);
777 owner := Wf_Route.RuleOwner(nruleid);
778 owner := Wf_Route.Authenticate(owner);
779 wf_directory.GetRoleInfo(owner, realname, s0, s0, s0, s0);
780
781 l_action := substrb(action, 1, 30);
782
783 if (delete_button is not null) then
784 /*
785 -- Now delete rule in the List procedure instead of here
786 -- Delete this rule along with any child attributes
787 delete from WF_ROUTING_RULE_ATTRIBUTES
788 where RULE_ID = nruleid;
789
790 delete from WF_ROUTING_RULES
791 where RULE_ID = nruleid;
792 */
793 -- Cancel the operation and return to opening page
794 raise CANCEL_RECORD;
795
796 else
797 -- UPDATE
798
799 --
800 -- Update main table data
801 --
802 if (action = 'FORWARD') then
803 forwardee := action_argument;
804 wfa_html.validate_display_name (display_action_argument, forwardee);
805 l_action := substrb(fmode, 1, 30);
806 end if;
807
808 begdate := StringToDate(begin_date);
809 enddate := StringToDate(end_date);
810
811 -- Validate date range
812 if (enddate <= begdate) then
813 wf_core.raise('WFRTG_BAD_DATE_RANGE');
814 end if;
815
816 -- Update columns in main table
817 update WF_ROUTING_RULES WRR set
818 ACTION = l_action,
819 ACTION_ARGUMENT = SubmitUpdate.forwardee,
820 BEGIN_DATE = SubmitUpdate.begdate,
821 END_DATE = SubmitUpdate.enddate,
822 RULE_COMMENT = SubmitUpdate.rule_comment
823 where WRR.RULE_ID = SubmitUpdate.nruleid;
824
825 --
826 -- Update routing attributes if RESPOND
827 --
828 if (action = 'RESPOND') then
829 -- Start at 2 to step over the Dummy_Name/Dummy_Value pair added at
830 -- the start of the array.
831 for i in 2 .. to_number(h_counter) loop
832 SetAttribute(nruleid, h_fnames(i), h_fvalues(i), h_fdocnames(i));
833 end loop;
834 else
835 begin
836 -- Update attributes table with null values since this is not a response
837 update WF_ROUTING_RULE_ATTRIBUTES WRRA set
838 TEXT_VALUE = null,
839 NUMBER_VALUE = null,
840 DATE_VALUE = null
841 where WRRA.RULE_ID = nruleid;
842 exception
843 when others then null;
844 end;
845 end if;
846 end if;
847
848 -- Go back to the List page
849 owa_util.redirect_url(curl=>wfa_html.base_url || '/wf_route.list?user='||owner||'&display_user=--EDITSCREEN--',
850 bclose_header=>TRUE);
851
852 exception
853 when CANCEL_RECORD then
854 Wf_Route.List(owner);
855
856 when others then
857 wf_core.context('Wf_Route', 'SubmitUpdate', rule_id, action,
858 action_argument, begin_date, end_date);
859 wf_route.error;
860 end SubmitUpdate;
861
862 --
863 -- UpdateRule
864 -- Update values for existing rule
865 -- IN
866 -- rule_id - Rule id number
867 -- MODIFICATION LOG:
868 -- 06-JUN-2001 JWSMITH BUG 1819232 -Added summary attr for table tag for ADA
869 -- - Added ID attr for TD tags
870 -- - Added label for input fields and radio buttons
871 --
872 procedure UpdateRule(
873 ruleid in varchar2)
874 is
875 nruleid number;
876 owner varchar2(320);
877 realname varchar2(360);
878 s0 varchar2(2000);
879 l_url varchar2(1000);
880 l_media varchar2(240) := wfa_html.image_loc;
881 l_icon varchar2(30) := 'FNDILOV.gif';
882 l_onmouseover varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFA_FIND_USER'));
883
884 -- Rule data
885 cursor rulecurs is
886 select WRR.MESSAGE_TYPE,
887 WRR.MESSAGE_NAME,
888 to_char(WRR.BEGIN_DATE)||to_char(WRR.BEGIN_DATE, ' HH24:MI:SS')
889 CBEGIN_DATE,
890 to_char(WRR.END_DATE) ||to_char(WRR.END_DATE, ' HH24:MI:SS')
891 CEND_DATE,
892 WRR.ACTION,
893 WRR.ACTION_ARGUMENT,
894 WRR.RULE_COMMENT,
895 WIT.DISPLAY_NAME TYPE_DISPLAY,
896 WM.SUBJECT
897 from WF_ROUTING_RULES WRR, WF_ITEM_TYPES_VL WIT, WF_MESSAGES_VL WM,
898 WF_LOOKUPS WL
899 where WRR.RULE_ID = nruleid
900 and WRR.MESSAGE_TYPE = WIT.NAME (+)
901 and WRR.MESSAGE_TYPE = WM.TYPE (+)
902 and WRR.MESSAGE_NAME = WM.NAME (+)
903 and WRR.ACTION = WL.LOOKUP_CODE
904 and WL.LOOKUP_TYPE = 'WFSTD_ROUTING_ACTIONS';
905
906 -- Obsolete fields from above select
907 -- WM.DISPLAY_NAME MSG_DISPLAY,
908 -- WL.MEANING ACTION_DISPLAY
909 --
910
911 rulerec rulecurs%rowtype;
912
913 -- Attr data
914 cursor attrcurs is
915 select WMA.NAME,
916 WMA.DISPLAY_NAME,
917 WMA.VALUE_TYPE,
918 decode(WMA.VALUE_TYPE, 'ITEMATTR', WIA.TEXT_DEFAULT,
919 WMA.TEXT_DEFAULT) TEXT_VALUE,
920 decode(WMA.VALUE_TYPE, 'ITEMATTR', WIA.NUMBER_DEFAULT,
921 WMA.NUMBER_DEFAULT) NUMBER_VALUE,
922 decode(WMA.VALUE_TYPE, 'ITEMATTR', WIA.DATE_DEFAULT,
923 WMA.DATE_DEFAULT) DATE_VALUE,
924 WMA.TYPE,
925 WMA.FORMAT
926 from WF_ROUTING_RULES WRR,
927 WF_MESSAGE_ATTRIBUTES_VL WMA,
928 WF_ITEM_ATTRIBUTES WIA
929 where WRR.RULE_ID = nruleid
930 and WRR.MESSAGE_TYPE = WMA.MESSAGE_TYPE
931 and WRR.MESSAGE_NAME = WMA.MESSAGE_NAME
932 and WMA.SUBTYPE = 'RESPOND'
933 and WMA.TYPE not in ('FORM', 'URL')
934 and WMA.MESSAGE_TYPE = WIA.ITEM_TYPE (+)
935 and WMA.TEXT_DEFAULT = WIA.NAME (+)
936 order by decode(WMA.NAME, 'RESULT', 9999, WMA.SEQUENCE);
937
938 -- Obsolete field from above SQL statement
939 -- WMA.DESCRIPTION,
940
941 tvalue varchar2(2000);
942 nvalue number;
943 dvalue date;
944 dispvalue varchar2(2000);
945 respcnt number := 0;
946 rowcount number;
947 msg_type varchar2(8);
948 msg_name varchar2(30);
949
950 fchecked pls_integer := null;
951 tchecked pls_integer := null;
952 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate ('WFPREF_LOV'));
953
954 begin
955 -- Find rule owner and validate access
956 nruleid := to_number(ruleid);
957 owner := Wf_Route.RuleOwner(nruleid);
958 owner := Wf_Route.Authenticate(owner);
959 wf_directory.GetRoleInfo(owner, realname, s0, s0, s0, s0);
960
961 -- Get rule data
962 open rulecurs;
963 fetch rulecurs into rulerec;
964 if (rulecurs%notfound) then
965 Wf_Core.Token('RULE', to_char(nruleid));
966 Wf_Core.Raise('WFRTG_INVALID_RULE');
967 end if;
968 close rulecurs;
969
970 -- Set page title
971 htp.htmlOpen;
972 htp.headOpen;
973 htp.title(wf_core.translate('WFRTG_UPDATE_TITLE')||' '||realname);
974 wfa_html.create_help_function('wf/links/upr.htm?UPRULE');
975 fnd_document_management.get_open_dm_display_window;
976
977 -- Add the java script to the header to open the dm window for
978 -- any DM function that and any standard LOV
979 fnd_document_management.get_open_dm_attach_window;
980
981 htp.headClose;
982 wfa_sec.Header(FALSE,'',wf_core.translate('WFRTG_UPDATE_TITLE'), TRUE);
983
984 -- Open form
985 -- Add dummy fields to start both array-type input fields.
986 -- These dummy values are needed so that the array parameters to
987 -- the submit procedure will not be null even if there are no real
988 -- response fields. This would cause a pl/sql error, because array
989 -- parameters can't be defaulted.
990 htp.p('<FORM NAME="CREATE_RULE" ACTION="wf_route.SubmitUpdate" METHOD="POST">');
991 htp.formHidden('h_fnames', 'Dummy_Name');
992 htp.formHidden('h_fvalues', 'Dummy_Value');
993 htp.formHidden('h_fdocnames', 'Dummy_Document_Value');
994 htp.formHidden('rule_id', ruleid);
995 -- htp.formHidden('action', rulerec.action);
996
997 htp.tableOpen(cattributes=>'width=100% summary=""');
998
999 --
1000 -- Rules main table section
1001 --
1002
1003 -- Message Type/Name
1004 htp.tableRowOpen;
1005 htp.tableData(cvalue=>wf_core.translate('MESSAGE_TYPE'),
1006 calign=>'right',
1007 cattributes=>'id=""');
1008 htp.tableHeader(cvalue=>nvl(rulerec.type_display,
1009 htf.em(wf_core.translate('<ALL>'))),
1010 calign=>'left',
1011 cattributes=>'id=""');
1012 htp.tableRowClose;
1013 htp.tableRowOpen;
1014 htp.tableData(cvalue=>wf_core.translate('NOTIFICATION'),
1015 calign=>'right',
1016 cattributes=>'id=""');
1017 IF (rulerec.subject IS NULL) THEN
1018
1019 htp.tableHeader(cvalue=>htf.em(wf_core.translate('<ALL>')),
1020 calign=>'left',
1021 cattributes=>'id=""');
1022 ELSE
1023
1024 htp.tableHeader(cvalue=>wf_notification.GetSubSubjectDisplay(rulerec.message_type,
1025 rulerec.message_name),
1026 calign=>'left',cattributes=>'id=""');
1027
1028 END IF;
1029
1030 htp.tableRowClose;
1031
1032 -- Active Dates
1033 htp.tableRowOpen;
1034 htp.tableData(cvalue=>'<LABEL FOR="i_begin_date">' ||
1035 wf_core.translate('WFRTG_BEGIN_DATE') || '</LABEL>',
1036 calign=>'right',
1037 cattributes=>'id=""');
1038 htp.tableData(cvalue=>htf.formText(cname=>'begin_date',
1039 csize=>30, cmaxlength=>64,
1040 cvalue=>rulerec.cbegin_date,
1041 cattributes=>'id="i_begin_date"'),
1042 calign=>'left',
1043 cattributes=>'id=""');
1044 htp.tableRowClose;
1045 htp.tableRowOpen;
1046 htp.tableData(cvalue=>'<LABEL FOR="i_end_date">' ||
1047 wf_core.translate('WFRTG_END_DATE') || '</LABEL>',
1048 calign=>'right',
1049 cattributes=>'id=""');
1050 htp.tableData(cvalue=>htf.formText(cname=>'end_date',
1051 csize=>30, cmaxlength=>64,
1052 cvalue=>rulerec.cend_date,
1053 cattributes=>'id="i_end_date"'),
1054 calign=>'left',
1055 cattributes=>'id=""');
1056 htp.tableRowClose;
1057
1058 htp.tableRowOpen;
1059 htp.tableData(htf.br,cattributes=>'id=""');
1060 htp.tableRowClose;
1061 htp.tableRowOpen;
1062 htp.tableHeader(wf_core.translate('WFRTG_AUTOMATICALLY'), 'left',
1063 ccolspan=>'2',cattributes=>'id=""');
1064 htp.tableRowClose;
1065
1066
1067 -- Comment
1068
1069 htp.tableRowOpen;
1070 htp.tableData(cvalue=>'<LABEL FOR="i_rule_comment">' ||
1071 wf_core.translate('WFRTG_COMMENTS_INCLUDE') || '</LABEL>',
1072 calign=>'right', cattributes=>'width="10%" id=""');
1073 htp.tableData(cvalue=>htf.formTextareaOpen2(
1074 cname=>'rule_comment',
1075 nrows=>3,
1076 ncolumns=>65,
1077 cwrap=>'soft',
1078 cattributes=>'maxlength=2000 id="i_rule_comment"')||
1079 rulerec.rule_comment||
1080 htf.formTextareaClose,
1081 ccolspan=>3,
1082 calign=>'left', cattributes=>'width="*" id=""');
1083 htp.tableRowClose;
1084
1085 htp.tableClose;
1086
1087 -- Action
1088 if (rulerec.action = 'FORWARD' or rulerec.action = 'TRANSFER') then
1089 if (rulerec.action = 'FORWARD') then
1090 fchecked := 1;
1091 else
1092 tchecked := 1;
1093 end if;
1094 htp.formRadio(cname=>'action', cvalue=>'FORWARD', cchecked=>'1',
1095 cattributes=>'id="i_wfa_assignto"');
1096
1097 else
1098
1099 htp.formRadio(cname=>'action', cvalue=>'FORWARD',
1100 cattributes=>'id="i_wfa_assignto"');
1101 -- If this is not a reassign the go ahead and set the delagate default
1102 fchecked := 1;
1103
1104 end if;
1105
1106 htp.p('<LABEL FOR="i_wfa_assignto">' ||
1107 wf_core.translate('WFA_ASSIGNTO') || '</LABEL>');
1108 htp.formHidden('action_argument', rulerec.action_argument);
1109
1110 if (rulerec.action_argument IS NOT NULL) then
1111
1112 wf_directory.GetRoleInfo(rulerec.action_argument, realname, s0, s0, s0, s0);
1113
1114 end if;
1115
1116 -- add LOV here: Note:bottom is name of frame.
1117 -- Note: The REPLACE function replaces all the space characters with
1118 -- the proper escape sequence.
1119 l_url := 'javascript:fnd_open_dm_display_window('||''''||
1120 REPLACE('wf_lov.display_lov?p_lov_name='||'owner'||
1121 '&p_display_name='||'WFA_FIND_USER'||
1122 '&p_validation_callback=wfa_html.wf_user_val'||
1123 '&p_dest_hidden_field=top.opener.parent.document.CREATE_RULE.action_argument.value'||
1124 '&p_current_value=top.opener.parent.document.CREATE_RULE.display_action_argument.value'||
1125 '&p_display_key='||'Y'||
1126 '&p_dest_display_field=top.opener.parent.document.CREATE_RULE.display_action_argument.value',
1127 ' ', '%20')||''''||',500,500)';
1128
1129 -- print everything together so ther is no gap.
1130 htp.formText(cname=>'display_action_argument', csize=>30,
1131 cmaxlength=>240,
1132 cvalue=>realname,
1133 cattributes=>'id="i_wfa_assignto"');
1134 htp.p('<A href='||l_url||'>'||
1135 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
1136 l_message||'" onmouseover="window.status='||''''||
1137 l_message||''''||';return true"></A>');
1138
1139 htp.br;
1140
1141 -- Forward Mode
1142 htp.p('&'||'nbsp;&'||'nbsp;&'||'nbsp;');
1143 htp.formRadio(cname=>'fmode', cvalue=>'FORWARD', cchecked=>fchecked,
1144 cattributes=>'id="i_group_reassign"');
1145 htp.p('<LABEL FOR="i_group_reassign">' ||
1146 wf_core.translate('WFA_GROUP_REASSIGN_DELEGATE') || '</LABEL>');
1147 htp.br;
1148 htp.p('&'||'nbsp;&'||'nbsp;&'||'nbsp;');
1149 htp.formRadio(cname=>'fmode', cvalue=>'TRANSFER', cchecked=>tchecked,
1150 cattributes=>'id="i_transfer"');
1151 htp.p('<LABEL FOR="i_transfer">' ||
1152 wf_core.translate('WFA_GROUP_REASSIGN_TRANSFER') || '</LABEL>');
1153 htp.br;
1154
1155 -- ### Comment below out since we have Delegate and Transfer implemented
1156 -- Instead put a hidden field to make fmode forward
1157 -- htp.formHidden('fmode', 'FORWARD');
1158
1159 select MESSAGE_TYPE, MESSAGE_NAME
1160 into msg_type, msg_name
1161 from WF_ROUTING_RULES
1162 where RULE_ID = ruleid;
1163
1164 -- Not a valid option when msg_type or msg_name is null
1165 if ((msg_type is not null) and (msg_name is not null)) then
1166
1167 if (rulerec.action = 'RESPOND') then
1168 htp.formRadio(cname=>'action', cvalue=>'RESPOND', cchecked=>'1',
1169 cattributes=>'id="i_wfitd_msg_respond"');
1170 else
1171 htp.formRadio(cname=>'action', cvalue=>'RESPOND',
1172 cattributes=>'id="i_wfrtg_close"');
1173 end if;
1174 -- Check existing of response
1175 select count(WMA.NAME) into rowcount
1176 from WF_ROUTING_RULES WRR,
1177 WF_MESSAGE_ATTRIBUTES_VL WMA,
1178 WF_ITEM_ATTRIBUTES WIA
1179 where WRR.RULE_ID = nruleid
1180 and WRR.MESSAGE_TYPE = WMA.MESSAGE_TYPE
1181 and WRR.MESSAGE_NAME = WMA.MESSAGE_NAME
1182 and WMA.SUBTYPE = 'RESPOND'
1183 and WMA.TYPE not in ('FORM', 'URL')
1184 and WMA.MESSAGE_TYPE = WIA.ITEM_TYPE (+)
1185 and WMA.TEXT_DEFAULT = WIA.NAME (+)
1186 order by decode(WMA.NAME, 'RESULT', 9999, WMA.SEQUENCE);
1187 --
1188 -- If there is no message attributes, there is no response and we give
1189 -- a choice of 'close', otherwise 'respond'.
1190 --
1191 if (rowcount = 0) then
1192 htp.p('<LABEL FOR="i_wfrtg_close">' ||
1193 wf_core.translate('WFRTG_CLOSE') || '</LABEL>');
1194 else
1195 htp.p('<LABEL FOR="i_wfitd_msg_respond">' ||
1196 wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND') || '</LABEL>');
1197 -- Draw attr fields
1198 htp.tableOpen(cattributes=>'summary=""');
1199 -- LOOP
1200 for attr in attrcurs loop
1201 respcnt := respcnt + 1;
1202 htp.tableRowOpen;
1203 -- Indentation
1204 htp.p('<TD ID="' || wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND') || '">
1205 '||'&'||'nbsp &'||'nbsp &'||'nbsp</TD>');
1206
1207 -- Prompt
1208 htp.tableData(cvalue=>'<LABEL FOR="i_attr'|| respcnt ||'">' ||
1209 attr.display_name || '</LABEL>',
1210 calign=>'right',
1211 cattributes=>'id=""');
1212
1213 -- Attr field
1214 if (GetAttrValue(nruleid, attr.name, tvalue, nvalue, dvalue)) then
1215 -- If attribute already defined for this rule,
1216 -- use current value.
1217 attr.text_value := tvalue;
1218 attr.number_value := nvalue;
1219 attr.date_value := dvalue;
1220 end if;
1221
1222 dispvalue := GetDisplayValue(attr.type, attr.format, attr.text_value,
1223 attr.number_value, attr.date_value);
1224
1225 if (attr.type = 'LOOKUP') then
1226 GetLookup(attr.name, attr.text_value, attr.format, FALSE,
1227 to_char(respcnt));
1228 elsif (attr.type = 'ROLE') then
1229 GetRole(attr.name, attr.text_value, to_char(respcnt) );
1230 elsif (attr.type = 'DOCUMENT') then
1231 GetDocument(attr.name, attr.format, dispvalue, to_char(respcnt) );
1232 else
1233 GetField(attr.name, attr.type, attr.format, dispvalue,
1234 to_char(respcnt));
1235 end if;
1236 htp.tableRowClose;
1237 end loop;
1238 -- END LOOP
1239 htp.tableClose;
1240 end if;
1241 htp.br;
1242 end if;
1243 -- Add counter
1244 htp.formHidden('h_counter', to_char(respcnt+1), null);
1245
1246 -- Not a valid option when both msg_type and msg_name are null
1247 if ((msg_type is not null) or (msg_name is not null)) then
1248 if (rulerec.action = 'NOOP') then
1249 htp.formRadio(cname=>'action', cvalue=>'NOOP', cchecked=>'1',
1250 cattributes=>'id="i_deliver"');
1251 else
1252 htp.formRadio(cname=>'action', cvalue=>'NOOP',
1253 cattributes=>'id="i_deliver"');
1254 end if;
1255 htp.p('<LABEL FOR="i_deliver">' ||
1256 wf_core.translate('WFRTG_DELIVER') ||
1257 '</LABEL>');
1258 htp.br;
1259 end if;
1260 -- NOTE: Do NOT create any more fields for h_names or h_values here. The
1261 -- submit buttons created above must be the last values for these fields
1262 -- to work around an MSIE bug that always sends the submit button last.
1263 htp.formClose;
1264
1265
1266 -- Add submit button
1267 htp.tableopen(calign=>'CENTER',cattributes=>'summary=""');
1268 htp.tableRowOpen;
1269
1270 htp.p('<TD ID="">');
1271
1272 wfa_html.create_reg_button ('javascript:document.CREATE_RULE.submit()',
1273 wf_core.translate ('WFMON_DONE'),
1274 wfa_html.image_loc,
1275 'FNDJLFOK.gif',
1276 wf_core.translate ('WFMON_DONE'));
1277
1278 htp.p('</TD>');
1279
1280 htp.p('<TD ID="">');
1281
1282 wfa_html.create_reg_button ('javascript:window.history.back()',
1283 wf_core.translate ('CANCEL'),
1284 wfa_html.image_loc,
1285 'FNDJLFCN.gif',
1286 wf_core.translate ('CANCEL'));
1287
1288 htp.p('</TD>');
1289
1290
1291 htp.tableRowClose;
1292 htp.tableClose;
1293
1294 wfa_sec.footer;
1295 htp.htmlClose;
1296
1297 exception
1298 when others then
1299 if (rulecurs%isopen) then
1300 close rulecurs;
1301 end if;
1302 wf_core.context('Wf_Route', 'UpdateRule', ruleid);
1303 wf_route.error;
1304 end UpdateRule;
1305
1306 --
1307 -- SubmitCreate
1308 -- Process CreateRule request
1309 -- IN
1310 -- user - role owning rule
1311 -- msg_type - message type
1312 -- msg_name - message name
1313 -- begin_date - Start date
1314 -- end_date - End date
1315 -- action - action
1316 -- fmode - forward mode: 'FORWARD', 'TRANSFER'
1317 -- action_argument - reassign to if forward
1318 -- h_fnames - Name array
1319 -- h_fvalues - Value array
1320 -- h_fdocnames - array of document name values
1321 -- h_counter - count of array element
1322 -- rule_comment - comments included in notification
1323 -- delete_button - cancel operation flag
1324 -- done_button - done button flag
1325 --
1326 procedure SubmitCreate(
1327 user in varchar2,
1328 msg_type in varchar2,
1329 msg_name in varchar2,
1330 begin_date in varchar2 ,
1331 end_date in varchar2 ,
1332 action in varchar2,
1333 fmode in varchar2 ,
1334 action_argument in varchar2 ,
1335 display_action_argument in varchar2 ,
1336 h_fnames in Name_Array,
1337 h_fvalues in Value_Array,
1338 h_fdocnames in Value_Array,
1339 h_counter in varchar2,
1340 rule_comment in varchar2 ,
1341 -- insert_button in varchar2 default null)
1342 delete_button in varchar2 ,
1343 done_button in varchar2 )
1344 is
1345 owner varchar2(320);
1346 realname varchar2(360);
1347 s0 varchar2(2000);
1348 l_msg_type varchar2(8) := REPLACE(msg_type, '^', ' ');
1349 l_msg_name varchar2(30) := REPLACE(msg_name, '^', ' ');
1350 typebuf varchar2(8);
1351 namebuf varchar2(30);
1352 ruleid number;
1353 begdate date;
1354 enddate date;
1355 forwardee varchar2(320);
1356 l_action varchar2(30) := action;
1357
1358 begin
1359 -- Validate access
1360 owner := Wf_Route.Authenticate(user);
1361 wf_directory.GetRoleInfo(owner, realname, s0, s0, s0, s0);
1362
1363 -- Check if delete
1364
1365 if (delete_button is not null) then
1366 --
1367 -- Raise DELETE so that it won't create a record
1368 --
1369 Wf_Route.List(user, '--EDITSCREEN--');
1370 return;
1371 end if;
1372
1373 if (done_button is not null) then
1374 -- Validate msg_type
1375 if (l_msg_type = '*') then
1376 -- Change '*' for default back to null
1377 typebuf := '';
1378 else
1379 -- All others must by valid via poplist
1380 typebuf := l_msg_type;
1381 end if;
1382
1383 -- Validate msg_name
1384 if (l_msg_name = '*') then
1385 -- Change '*' for default back to null
1386 namebuf := '';
1387 else
1388 -- All others must by valid via poplist
1389 namebuf := l_msg_name;
1390 end if;
1391
1392 -- Get dates
1393 begdate := StringToDate(begin_date);
1394 enddate := StringToDate(end_date);
1395
1396 -- Validate date range
1397 if (enddate <= begdate) then
1398 wf_core.raise('WFRTG_BAD_DATE_RANGE');
1399 end if;
1400
1401 -- Validate action
1402 -- Only rule is RESPOND must have both msg_type and msg_name specified
1403 if (action = 'RESPOND') then
1404 if ((typebuf is null) or (namebuf is null)) then
1405 wf_core.raise('WFRTG_RESPOND_MESSAGE');
1406 end if;
1407 end if;
1408
1409 -- Validate action_argument
1410 if (action = 'FORWARD') then
1411 forwardee := action_argument;
1412 wfa_html.validate_display_name (display_action_argument, forwardee);
1413 l_action := fmode;
1414 end if;
1415
1416 -- Select new ruleid
1417 select WF_ROUTING_RULES_S.NEXTVAL
1418 into ruleid
1419 from SYS.DUAL;
1420
1421 -- Insert new rule in table with data so far
1422 insert into WF_ROUTING_RULES (
1423 RULE_ID,
1424 ROLE,
1425 ACTION,
1426 BEGIN_DATE,
1427 END_DATE,
1428 MESSAGE_TYPE,
1429 MESSAGE_NAME,
1430 ACTION_ARGUMENT,
1431 RULE_COMMENT
1432 ) values (
1433 ruleid,
1434 SubmitCreate.owner,
1435 SubmitCreate.l_action,
1436 begdate,
1437 enddate,
1438 SubmitCreate.typebuf,
1439 SubmitCreate.namebuf,
1440 SubmitCreate.forwardee,
1441 SubmitCreate.rule_comment
1442 );
1443
1444 -- Go directly to update to finish entering data
1445 -- Wf_route.UpdateRule(to_char(ruleid));
1446 --
1447 -- Update routing attributes if RESPOND
1448 --
1449 if (SubmitCreate.action = 'RESPOND') then
1450 -- Start at 2 to step over the Dummy_Name/Dummy_Value pair added at
1451 -- the start of the array.
1452 for i in 2 .. to_number(SubmitCreate.h_counter) loop
1453 SetAttribute(ruleid, SubmitCreate.h_fnames(i),
1454 SubmitCreate.h_fvalues(i), SubmitCreate.h_fdocnames(i));
1455 end loop;
1456 end if;
1457 end if;
1458
1459 -- Go back to the List page
1460 owa_util.redirect_url(curl=>wfa_html.base_url || '/wf_route.list?user='||user||'&display_user=--EDITSCREEN--',
1461 bclose_header=>TRUE);
1462
1463
1464
1465 exception
1466 when others then
1467 rollback;
1468 wf_core.context('Wf_Route', 'SubmitCreate', msg_type, msg_name,
1469 begin_date, end_date, action);
1470 wf_route.error;
1471 end SubmitCreate;
1472
1473
1474 --
1475 -- CreateRule
1476 -- Create a new routing rule
1477 -- Part 1, choose msg_type
1478 -- IN
1479 -- user - User to query rules for. If null use current user.
1480 -- Nore: only WF_ADMIN_ROLE can create rules for other users
1481 -- create_button - create button flag
1482 -- MODIFICATION LOG:
1483 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
1484 -- - Added ID attr for TD tags
1485 --
1486 procedure CreateRule(
1487 user in varchar2 ,
1488 create_button in varchar2 )
1489 is
1490 begin
1491 Null;
1492 end CreateRule;
1493
1494 --
1495 -- CreateRule2
1496 -- Create a new routing rule
1497 -- Part 2. Choose msg_name/ subject
1498 -- IN
1499 -- user - User to query rules for. If null use current user.
1500 -- Nore: only WF_ADMIN_ROLE can create rules for other users
1501 -- msg_type - message type
1502 -- insert_button - continue to create the record
1503 -- cancel_button - cancel button flag
1504 -- MODIFICATION LOG:
1505 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
1506 -- - Added ID attr for TD tags
1507 --
1508 procedure CreateRule2(
1509 user in varchar2 ,
1510 msg_type in varchar2 ,
1511 insert_button in varchar2 ,
1512 cancel_button in varchar2 )
1513 is
1514 begin
1515 NULL;
1516 end CreateRule2;
1517
1518 --
1519 -- CreateRule3
1520 -- Create a new routing rule
1521 -- Part 3. Specify the start and end date
1522 -- Select action and put in comments.
1523 -- IN
1524 -- user - User to query rules for. If null use current user.
1525 -- Nore: only WF_ADMIN_ROLE can create rules for other users
1526 -- msg_type - message type
1527 -- msg_name - message name
1528 -- insert_button - continue to create the record
1529 -- cancel_button - cancel button flag
1530 -- MODIFICATION LOG:
1531 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
1532 -- - Added ID attr for TD tags
1533 --
1534 procedure CreateRule3(
1535 user in varchar2 ,
1536 msg_type in varchar2 ,
1537 msg_name in varchar2 ,
1538 insert_button in varchar2 ,
1539 cancel_button in varchar2 )
1540 is
1541 begin
1542 NULL;
1543 end CreateRule3;
1544
1545
1546 --
1547 -- List
1548 -- Produce list of routing rules for user
1549 -- IN
1550 -- user - User to query rules for. If null use current user.
1551 -- Note: only WF_ADMIN_ROLE can query other than the current user.
1552 -- MODIFICATION LOG:
1553 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
1554 -- - added alt attr for img tags
1555 -- - added ID attr for TD tags
1556 -- - added ID attr for TH tags
1557 -- - added label for form input & select fields
1558 --
1559 procedure List (
1560 user in varchar2 ,
1561 display_user in varchar2
1562 )
1563 is
1564 username varchar2(320); -- Username to query
1565 t_user varchar2(320);
1566 admin_role varchar2(320); -- Role for admin mode
1567 realname varchar2(360); -- Display name of username
1568 isactive number; -- Active?
1569 l_media varchar2(240) := wfa_html.image_loc;
1570 l_icon varchar2(30) := 'FNDILOV.gif';
1571 l_text varchar2(30) := '';
1572 l_onmouseover varchar2(240) := wf_core.translate ('WFPREF_LOV');
1573 l_url varchar2(4000);
1574 today date; -- Today's date
1575 s0 varchar2(2000); -- Dummy
1576
1577 forwardname varchar2(360); -- Display name of forwardee
1578
1579 cursor wf_rules_cursor is
1580 select WRR.MESSAGE_TYPE,
1581 WRR.MESSAGE_NAME,
1582 WRR.BEGIN_DATE,
1583 WRR.END_DATE,
1584 WRR.ACTION,
1585 WRR.ACTION_ARGUMENT,
1586 WRR.RULE_ID,
1587 WIT.DISPLAY_NAME TYPE_DISPLAY,
1588 WM.DISPLAY_NAME MSG_DISPLAY,
1589 WM.SUBJECT,
1590 WL.MEANING ACTION_DISPLAY
1591 from WF_ROUTING_RULES WRR, WF_ITEM_TYPES_VL WIT, WF_MESSAGES_VL WM,
1592 WF_LOOKUPS WL
1593 where WRR.ROLE = username
1594 and WRR.MESSAGE_TYPE = WIT.NAME (+)
1595 and WRR.MESSAGE_TYPE = WM.TYPE (+)
1596 and WRR.MESSAGE_NAME = WM.NAME (+)
1597 and WRR.ACTION = WL.LOOKUP_CODE
1598 and WL.LOOKUP_TYPE = 'WFSTD_ROUTING_ACTIONS'
1599 order by TYPE_DISPLAY, MSG_DISPLAY, BEGIN_DATE;
1600
1601 rowcount number;
1602 att_tvalue varchar2(2000) ;
1603 begin
1604
1605 -- Get all the username find criteria resolved
1606 t_user := user;
1607
1608 -- This function is also called by the edit confirmation page and only
1609 -- pass the user name and never the display name. The search criteria
1610 -- should not be null so this is a safe check and will use the user name
1611 -- in cases where the display name is not passed in.
1612 if (NVL(display_user, '--BLANK--') <> '--EDITSCREEN--') then
1613
1614 wfa_html.validate_display_name (display_user, t_user);
1615
1616 end if;
1617
1618 -- Check current user has access to this user
1619 username := Wf_Route.Authenticate(upper(t_user));
1620 wf_directory.GetRoleInfo(username, realname, s0, s0, s0, s0);
1621
1622
1623 -- Set today's date
1624 select sysdate into today from sys.dual;
1625
1626 -- Set page title
1627 htp.htmlOpen;
1628 -- DEBUG info
1629 -- htp.p('<P>t_user='||t_user||' username='||username||'<br> realname='||realname||'</P>');
1630 --
1631
1632 IF (realname IS NULL) THEN
1633
1634 htp.p('<BODY bgcolor=#cccccc>');
1635 htp.center(htf.bold(wf_core.translate('WFPREF_INVALID_ROLE_NAME'))||':'||display_user);
1636 htp.br;
1637
1638 htp.tableopen(calign=>'CENTER',cattributes=>'summary=""');
1639
1640 --Submit Button
1641
1642 htp.tableRowOpen;
1643
1644 l_url := wfa_html.base_url||
1645 '/wf_route.find';
1646 l_icon := 'FNDJLFOK.gif';
1647 l_text := wf_core.translate ('WFMON_OK');
1648 l_onmouseover := wf_core.translate ('WFMON_OK');
1649
1650 htp.p('<TD ID="">');
1651
1652 wf_pref.create_reg_button (l_url, l_onmouseover, l_media, l_icon, l_text);
1653
1654 htp.p('</TD>');
1655 htp.tablerowclose;
1656 htp.tableclose;
1657 htp.p('</BODY>');
1658 return;
1659
1660 END IF;
1661
1662 htp.headOpen;
1663 htp.p('<BASE TARGET="_top">');
1664 htp.title(wf_core.translate('WFRTG_LIST_TITLE')||' - '||realname);
1665 wfa_html.create_help_function('wf/links/nrr.htm?NRR');
1666 htp.headClose;
1667 wfa_sec.header(FALSE, 'wf_route.find', wf_core.translate('WFRTG_FIND_TITLE'), TRUE);
1668
1669 -- Column headers
1670 htp.tableOpen(calign=>'CENTER', cattributes=>'border=1 cellpadding=3 bgcolor=white width="100%" summary="' || wf_core.translate('WFRTG_FIND_TITLE') || '"');
1671 -- htp.tableRowOpen(cattributes=>'bgcolor=#83c1c1');
1672 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
1673
1674 -- htp.tableData(cvalue=>'<font color=#000000>'||
1675 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
1676 wf_core.translate('MESSAGE_TYPE')||'</font>',
1677 calign=>'Center',
1678 cattributes=>'id="' || wf_core.translate('MESSAGE_TYPE') || '"');
1679 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
1680 wf_core.translate('NOTIFICATION')||'</font>',
1681 calign=>'Center',
1682 cattributes=>'id="' || wf_core.translate('NOTIFICATION') || '"');
1683 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
1684 wf_core.translate('RESULT_APPLY_RULE')||'</font>',
1685 calign=>'Center',
1686 cattributes=>'id="' || wf_core.translate('RESULT_APPLY_RULE') || '"');
1687 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
1688 wf_core.translate('ACTIVE')||'</font>',
1689 calign=>'Center',
1690 cattributes=>'id="' || wf_core.translate('ACTIVE') || '"');
1691 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
1692 wf_core.translate('WFRTG_DELETE')||'</font>',
1693 calign=>'Center',
1694 cattributes=>'id="' || wf_core.translate('WFRTG_DELETE') || '"');
1695 htp.tableRowClose;
1696 htp.tableRowOpen;
1697 htp.tableRowClose;
1698
1699 -- Query matching rules
1700 for rule in wf_rules_cursor loop
1701 isactive := 0;
1702 if today > rule.begin_date and today < rule.end_date then
1703 isactive := 1;
1704 else
1705 if rule.begin_date is null and today < rule.end_date then
1706 isactive := 1;
1707 else
1708 if rule.end_date is null and today > rule.begin_date then
1709 isactive := 1;
1710 else
1711 if ((rule.end_date is null) and (rule.begin_date is null)) then
1712 isactive := 1;
1713 end if;
1714 end if;
1715 end if;
1716 end if;
1717
1718 htp.tableRowOpen(null, 'TOP');
1719 htp.tableData(nvl(rule.type_display,
1720 htf.em(wf_core.translate('<ALL>'))),
1721 'left',cattributes=>'id=""');
1722
1723 IF (rule.subject IS NULL) THEN
1724
1725 htp.tableData(htf.em(wf_core.translate('<ALL>')),
1726 'left', cattributes=>'id=""');
1727
1728 ELSE
1729
1730 htp.tableData(wf_notification.GetSubSubjectDisplay(rule.message_type,
1731 rule.message_name),
1732 'left', cattributes=>'id=""');
1733
1734 END IF;
1735
1736
1737 if ( rule.action = 'FORWARD' ) then
1738 -- get the display name of the forwardee in delegation
1739 wf_directory.GetRoleInfo(rule.action_argument, forwardname,
1740 s0, s0, s0, s0);
1741 htp.tableData(htf.anchor(wfa_html.base_url||
1742 '/Wf_Route.UpdateRule?ruleid='||
1743 to_char(rule.rule_id),
1744 wf_core.translate('DELEGATE')||':'||
1745 forwardname),
1746 'left',cattributes=>'id=""');
1747 elsif ( rule.action = 'TRANSFER' ) then
1748 -- get the display name of the forwardee in transfering
1749 wf_directory.GetRoleInfo(rule.action_argument, forwardname,
1750 s0, s0, s0, s0);
1751 htp.tableData(htf.anchor(wfa_html.base_url||
1752 '/Wf_Route.UpdateRule?ruleid='||
1753 to_char(rule.rule_id),
1754 wf_core.translate('TRANSFER')||':'||
1755 forwardname),
1756 'left',cattributes=>'id=""');
1757 else
1758 if ( rule.action = 'NOOP' ) then
1759 htp.tableData(htf.anchor(wfa_html.base_url||
1760 '/Wf_Route.UpdateRule?ruleid='||
1761 to_char(rule.rule_id),
1762 wf_core.translate('WFRTG_DELIVERTOME')),
1763 'left',cattributes=>'id=""');
1764 else
1765
1766 -- Check existing of response
1767 select count(WMA.NAME)
1768 into rowcount
1769 from WF_ROUTING_RULES WRR,
1770 WF_MESSAGE_ATTRIBUTES_VL WMA,
1771 WF_ITEM_ATTRIBUTES WIA
1772 where WRR.RULE_ID = rule.rule_id
1773 and WRR.MESSAGE_TYPE = WMA.MESSAGE_TYPE
1774 and WRR.MESSAGE_NAME = WMA.MESSAGE_NAME
1775 and WMA.SUBTYPE = 'RESPOND'
1776 and WMA.TYPE not in ('FORM', 'URL')
1777 and WMA.MESSAGE_TYPE = WIA.ITEM_TYPE (+)
1778 and WMA.TEXT_DEFAULT = WIA.NAME (+)
1779 order by decode(WMA.NAME, 'RESULT', 9999, WMA.SEQUENCE);
1780
1781 -- Check RESULT value
1782 begin
1783 /* ### we should display the meaning instead of the underlying value.
1784
1785 select TEXT_VALUE
1786 into att_tvalue
1787 from WF_ROUTING_RULE_ATTRIBUTES
1788 where RULE_ID = rule.rule_id
1789 and NAME = 'RESULT';
1790 */
1791 select WL.MEANING
1792 into att_tvalue
1793 from WF_LOOKUPS WL,
1794 WF_MESSAGE_ATTRIBUTES_VL WMA,
1795 WF_ROUTING_RULES WRR,
1796 WF_ROUTING_RULE_ATTRIBUTES WRA
1797 where WRA.RULE_ID = rule.rule_id
1798 and WRA.NAME = 'RESULT'
1799 and WRR.RULE_ID = WRA.RULE_ID
1800 and WMA.NAME = WRA.NAME
1801 and WRR.MESSAGE_TYPE = WMA.MESSAGE_TYPE
1802 and WRR.MESSAGE_NAME = WMA.MESSAGE_NAME
1803 and WL.LOOKUP_TYPE = WMA.FORMAT
1804 and WL.LOOKUP_CODE = WRA.TEXT_VALUE;
1805 exception
1806 when no_data_found then
1807 att_tvalue := '';
1808 end;
1809
1810 --
1811 -- If there is no message attributes, there is no response and we give
1812 -- a choice of 'close', otherwise 'response'.
1813 --
1814 if (rowcount = 0) then
1815 htp.tableData(htf.anchor(wfa_html.base_url||
1816 '/Wf_Route.UpdateRule?ruleid='||
1817 to_char(rule.rule_id),
1818 wf_core.translate('WFRTG_CLOSE')),
1819 'left',cattributes=>'id="' ||
1820 wf_core.translate('WFRTG_CLOSE') || '"');
1821 else
1822 if (att_tvalue is not null) then
1823 htp.tableData(htf.anchor(wfa_html.base_url||
1824 '/Wf_Route.UpdateRule?ruleid='||
1825 to_char(rule.rule_id),
1826 wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND')||':'
1827 ||att_tvalue),
1828 'left',cattributes=>'id="' || wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND') || '"');
1829 else
1830 htp.tableData(htf.anchor(wfa_html.base_url||
1831 '/Wf_Route.UpdateRule?ruleid='||
1832 to_char(rule.rule_id),
1833 wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND')),
1834 'left',cattributes=>'id="' || wf_core.translate('WFITD_MSG_SOURCE_TYPE_RESPOND') || '"');
1835 end if;
1836 end if;
1837 end if;
1838 end if;
1839
1840 if isactive = 1 then
1841 htp.tableData(htf.img(wfa_html.image_loc||'FNDICHEK.gif',
1842 'Center', wf_core.translate('ACTIVE')), 'center',
1843 cattributes=>'valign="MIDDLE" id=""');
1844 else
1845 htp.tableData(htf.br,cattributes=>'id=""');
1846 end if;
1847
1848 -- htp.tableData(nvl(to_char(rule.begin_date)||
1849 -- to_char(rule.begin_date, ' HH24:MI:SS'),
1850 -- htf.br), 'left',cattributes=>'id=""');
1851
1852 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
1853 '/Wf_Route.DeleteRule?user='||username||
1854 '&'||'ruleid='||to_char(rule.rule_id),
1855 ctext=>'<IMG SRC="'||wfa_html.image_loc||'FNDIDELR.gif"
1856 alt="' || wf_core.translate('WFRTG_DELETE') || '" BORDER=0>'),
1857 'center', cattributes=>'valign="MIDDLE" id=""');
1858 htp.tableRowClose;
1859 end loop;
1860
1861 htp.tableClose;
1862
1863
1864 -- Button to create new rule
1865 htp.formOpen(curl=>'wf_route.CreateRule',
1866 cmethod=>'POST', cattributes=>'NAME="WF_LIST"');
1867
1868 htp.formHidden('user', username);
1869
1870 htp.formClose;
1871
1872 -- Add submit button
1873 htp.tableopen(calign=>'CENTER',cattributes=>'summary=""');
1874 htp.tableRowOpen;
1875
1876 htp.p('<TD ID="">');
1877
1878 wfa_html.create_reg_button ('javascript:document.WF_LIST.submit()',
1879 wf_core.translate('WFRTG_INSERT'),
1880 wfa_html.image_loc,
1881 'FNDJLFOK.gif',
1882 wf_core.translate('WFRTG_INSERT'));
1883
1884 htp.p('</TD>');
1885
1886 htp.tableRowClose;
1887 htp.tableClose;
1888
1889
1890 -- Close up shop
1891 -- wfa_sec.Footer;
1892 htp.htmlClose;
1893 exception
1894 when others then
1895 wf_core.context('Wf_Route', 'List', user, display_user);
1896 wf_route.error;
1897 end List;
1898
1899
1900 --
1901 -- Find
1902 -- Find routing rules for given user
1903 -- Note: only WF_ADMIN_ROLE can query other than the current user.
1904 -- MODIFICATION LOG:
1905 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added summary attr for table tag for ADA
1906 -- - Added ID attr for TD tags
1907 --
1908 procedure Find
1909 is
1910 curuser varchar2(320);
1911 admin_role varchar2(320);
1912 realname varchar2(360);
1913 l_url varchar2(1000);
1914 l_media varchar2(240) := wfa_html.image_loc;
1915 l_icon varchar2(30) := 'FNDILOV.gif';
1916 s0 varchar2(2000);
1917 l_onmouseover varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFA_FIND_USER'));
1918 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate ('WFPREF_LOV'));
1919
1920 begin
1921 -- Check if current user has admin role
1922 Wfa_Sec.GetSession(curuser);
1923 wf_directory.GetRoleInfo(curuser, realname, s0, s0, s0, s0);
1924 admin_role := wf_core.translate('WF_ADMIN_ROLE');
1925 if (admin_role <> '*' and
1926 not Wf_Directory.IsPerformer(curuser, admin_role)) then
1927 -- If current user does not have admin,
1928 -- go directly to rules list for current user.
1929 Wf_Route.List(curuser, '--EDITSCREEN--');
1930 -- Wf_Route.ListFrame;
1931 return;
1932 end if;
1933
1934 -- Admin approved, draw the form
1935 htp.htmlOpen;
1936 htp.headOpen;
1937 htp.title(wf_core.translate('WFRTG_FIND_TITLE'));
1938 wfa_html.create_help_function('wf/links/rul.htm?RULES');
1939 fnd_document_management.get_open_dm_display_window;
1940 htp.headClose;
1941 wfa_sec.header(FALSE, '', wf_core.translate('WFRTG_FIND_TITLE'), TRUE);
1942
1943 htp.formOpen(curl=>'wf_route.list',
1944 cmethod=>'POST', cattributes=>'NAME="WF_FIND"');
1945
1946 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 cellpadding=2 cellspacing=0 summary=""');
1947
1948 htp.tableRowOpen;
1949 htp.tableData(cvalue=>'<LABEL FOR="i_display_user">' ||
1950 wf_core.translate('USER_ID') || '</LABEL>', calign=>'right',
1951 cattributes=>'id=""');
1952 htp.formHidden('user', curuser);
1953
1954 -- add LOV here: Note:bottom is name of frame.
1955 -- Note: The REPLACE function replaces all the space characters with
1956 -- the proper escape sequence.
1957 l_url := 'javascript:fnd_open_dm_display_window('||''''||
1958 REPLACE('wf_lov.display_lov?p_lov_name='||'owner'||
1959 '&p_display_name='||'WFA_FIND_USER'||
1960 '&p_validation_callback=wfa_html.wf_user_val'||
1961 '&p_dest_hidden_field=top.opener.parent.document.WF_FIND.user.value'||
1962 '&p_current_value=top.opener.parent.document.WF_FIND.display_user.value'||
1963 '&p_display_key='||'Y'||
1964 '&p_dest_display_field=top.opener.parent.document.WF_FIND.display_user.value',
1965 ' ', '%20')||''''||',500,500)';
1966
1967 -- print everything together so ther is no gap.
1968 htp.tabledata(htf.formText(cname=>'display_user', csize=>30,
1969 cmaxlength=>360,
1970 cvalue=>realname,
1971 cattributes=>'id="i_display_user"')||
1972 '<A href='||l_url||'>'||
1973 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
1974 l_message||'" onmouseover="window.status='||''''||
1975 l_message||''''||';return true"></A>',
1976 cattributes=>'id=""');
1977
1978 htp.tableRowClose;
1979 htp.tableClose;
1980 htp.formClose;
1981
1982 -- Add submit button
1983 htp.tableopen(calign=>'CENTER',cattributes=>'summary=""');
1984 htp.tableRowOpen;
1985
1986 htp.p('<TD ID="">');
1987
1988 wfa_html.create_reg_button ('javascript:document.WF_FIND.submit()',
1989 wf_core.translate ('FIND'),
1990 wfa_html.image_loc,
1991 'fndfind.gif',
1992 wf_core.translate ('FIND'));
1993
1994 htp.p('</TD>');
1995
1996 htp.tableRowClose;
1997 htp.tableClose;
1998
1999 wfa_sec.Footer;
2000 htp.htmlClose;
2001 exception
2002 when others then
2003 wf_core.context('Wf_Route', 'Find', user);
2004 wf_route.error;
2005 end Find;
2006
2007 --
2008 -- ChangeMessageName
2009 -- Changes the message name on any defined rule(s).
2010 --
2011 procedure ChangeMessageName (p_itemType in varchar2,
2012 p_oldMessageName in varchar2,
2013 p_newMessageName in varchar2) is
2014 begin
2015 update WF_ROUTING_RULES
2016 set MESSAGE_NAME = upper(p_newMessageName)
2017 where MESSAGE_TYPE = p_itemType
2018 and MESSAGE_NAME = p_oldMessageName;
2019 end;
2020
2021 END WF_ROUTE;