[Home] [Help]
PACKAGE BODY: APPS.QA_SSQR_JRAD_PKG
Source
1 PACKAGE BODY qa_ssqr_jrad_pkg AS
2 /* $Header: qajrmpb.pls 120.26.12010000.1 2008/07/25 09:19:46 appldev ship $ */
3
4 TYPE ParentArray IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
5 -- 12.1 Device Integration Project
6 -- Added Suffix parameter to this method.
7 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
8 FUNCTION construct_code (p_prefix IN VARCHAR2, p_id IN VARCHAR2, p_suffix IN VARCHAR2 DEFAULT NULL)
9 RETURN VARCHAR2 IS
10
11 BEGIN
12
13 -- The function is the standard way to compute attribute and
14 -- region codes.
15
16 -- 12.1 Device Integration Project
17 -- Appending suffix as well.
18 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
19 RETURN (p_prefix ||p_id ||p_suffix);
20
21 END construct_code;
22
23 -- 12.1 Inline Project
24 -- adding debug API's for better debugging
25 -- saugupta
26 procedure set_debug_mode(p_mode IN VARCHAR2) IS
27 begin
28 IF (p_mode = 'QA_LOCAL') THEN
29 g_debug_mode := p_mode;
30 END IF;
31 end set_debug_mode;
32
33 procedure log_local_error( p_module_name IN VARCHAR2, p_error_message IN VARCHAR2, p_comments IN VARCHAR2 DEFAULT NULL)
34 IS
35 pragma autonomous_transaction;
36 x_logid number;
37 cursor id
38 IS
39 SELECT qa_skiplot_log_id_s.nextval
40 FROM dual;
41 BEGIN
42 open id;
43 fetch id into x_logid;
44 close id;
45 INSERT
46 INTO qa_skiplot_log
47 (
48 LOG_ID,
49 MODULE_NAME,
50 ERROR_MESSAGE,
51 COMMENTS,
52 LAST_UPDATE_DATE,
53 LAST_UPDATED_BY,
54 CREATION_DATE,
55 CREATED_BY,
56 LAST_UPDATE_LOGIN
57 )
58 VALUES
59 (
60 x_logid,
61 p_module_name,
62 p_error_message,
63 p_comments,
64 sysdate,
65 fnd_global.user_id,
66 sysdate,
67 fnd_global.user_id,
68 fnd_global.login_id
69 )
70 ;
71 commit;
72 end log_local_error;
73
74 procedure log_error(p_api_name IN varchar2, p_error_message IN varchar2 )
75 IS
76 begin
77
78 IF ( g_debug_mode = 'QA_LOCAL' ) THEN
79 log_local_error(p_api_name, p_error_message);
80 ELSE
81 IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
82 FND_LOG.string ( FND_LOG.LEVEL_STATEMENT,
83 p_api_name,
84 p_error_message );
85 ELSIF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
86 FND_LOG.string ( FND_LOG.LEVEL_PROCEDURE,
87 p_api_name,
88 p_error_message );
89 END IF;
90 END IF; -- g_debug_mode
91 end log_error;
92
93
94
95 -- 12.1 Inline Project END
96
97 FUNCTION get_prompt (p_plan_id IN NUMBER,
98 p_char_id IN NUMBER) RETURN VARCHAR2 IS
99
100 l_prompt qa_plan_chars.prompt%TYPE;
101 l_uom_code qa_plan_chars.uom_code%TYPE;
102 BEGIN
103 -- The function is the standard way to compute prompt
104 -- taking uom_code into account
105 l_prompt := qa_plan_element_api.get_prompt(p_plan_id, p_char_id);
106 l_uom_code := qa_plan_element_api.get_uom_code(p_plan_id, p_char_id);
107
108 IF (l_uom_code is not null) THEN
109 -- 12.1 QWB Usability Improvements
110 -- Encode the HTML special characters
111 -- ntungare
112 --
113 RETURN DBMS_XMLGEN.convert(l_prompt || ' (' || l_uom_code || ')');
114 ELSE
115 RETURN DBMS_XMLGEN.convert(l_prompt);
116 END IF;
117 END get_prompt;
118
119
120 FUNCTION get_special_item_label (p_prefix IN VARCHAR2)
121 RETURN VARCHAR2 IS
122
123 label VARCHAR2(30);
124
125 BEGIN
126
127 -- For some hardocded columns such as "Created By", "Colleciton"
128 -- and "Last Update Date" we need to retrieve the right label
129 -- keeping translation in mind.
130
131 IF (p_prefix = g_qa_created_by_attribute) THEN
132 label := fnd_message.get_string('QA','QA_SS_CREATED_BY');
133 ELSIF (p_prefix = g_collection_id_attribute) THEN
134 label := fnd_message.get_string('QA','QA_SS_COLLECTION');
135 ELSIF (p_prefix = g_last_update_date_attribute) THEN
136 label := fnd_message.get_string('QA','QA_SS_ENTRY_DATE');
137 ELSIF (p_prefix = g_multi_row_attachment) THEN
138 label := fnd_message.get_string('QA','QA_SS_JRAD_ATTACHMENT');
139 ELSE
140 label := null;
141 END IF;
142
143 -- 12.1 QWB Usability Improvements
144 -- Encode the HTML special characters
145 -- ntungare
146 --
147 RETURN DBMS_XMLGEN.convert(label);
148
149 END get_special_item_label;
150
151
152
153 FUNCTION get_vo_attribute_name (p_plan_id IN NUMBER, p_char_id IN NUMBER)
154 RETURN VARCHAR2 IS
155
156 column_name VARCHAR2(100);
157
158 BEGIN
159
160 -- For hardcoded elements, it returns developer name,
161 -- For others, it returns results column name in qa plan chars.
162
163 column_name := qa_core_pkg.get_result_column_name (p_char_id, p_plan_id);
164 column_name := replace(column_name, 'CHARACTER', 'Character');
165 column_name := replace(column_name, 'COMMENT', 'Comment');
166 column_name := replace(column_name, 'SEQUENCE', 'Sequence');
167
168 RETURN column_name;
169
170 END get_vo_attribute_name;
171
172
173
174 FUNCTION get_hardcoded_vo_attr_name (p_code IN VARCHAR2)
175 RETURN VARCHAR2 IS
176
177 column_name VARCHAR2(100);
178
179 BEGIN
180
181 -- This function retrieves the result column name for
182 -- hard coded elements.
183
184 IF (INSTR(p_code, g_org_id_attribute) <> 0) THEN
185 column_name := 'ORGANIZATION_ID';
186 ELSIF (INSTR(p_code, g_plan_id_attribute) <> 0) THEN
187 column_name := 'PLAN_ID';
188 ELSIF (INSTR(p_code, g_qa_created_by_attribute) <> 0) THEN
189 column_name := 'QA_CREATED_BY_NAME';
190 ELSIF (INSTR(p_code, g_collection_id_attribute) <> 0) THEN
191 column_name := 'COLLECTION_ID';
192 ELSIF (INSTR(p_code, g_last_update_date_attribute) <> 0) THEN
193 column_name := 'LAST_UPDATE_DATE';
194 ELSIF (INSTR(p_code, g_multi_row_attachment) <> 0) THEN
195 column_name := '';
196 END IF;
197
198 RETURN column_name;
199
200 END get_hardcoded_vo_attr_name;
201
202
203 FUNCTION convert_data_type (p_data_type IN NUMBER)
204 RETURN VARCHAR2 IS
205
206 BEGIN
207
208 -- In Quality the data type is indicated by a number. whereas,
209 -- in ak it a is string that describes what the data type is.
210 -- This routine was written to convert the data_type according
211 -- to AK.
212
213 IF p_data_type in (g_char_datatype,g_comments_datatype,g_seq_datatype) THEN
214 return 'VARCHAR2';
215 ELSIF p_data_type = g_num_datatype THEN
216 return 'NUMBER';
217 ELSIF p_data_type = g_date_datatype THEN
218 return 'DATE';
219 -- bug 3236302. rkaza. 11/04/2003. Timezone support.
220 ELSIF p_data_type = g_datetime_datatype THEN
221 return 'DATETIME';
222 ELSE --catch all
223 return 'VARCHAR2';
224 END IF;
225
226 END convert_data_type;
227
228
229 FUNCTION convert_yesno_flag (p_flag IN NUMBER)
230 RETURN VARCHAR2 IS
231
232 BEGIN
233
234 -- In Quality all the flags are numeric, meaning a value of 1 or 2
235 -- is used to indicate if the flag is on or off. In AK however,
236 -- it is a character that describes if the flag is on or off.
237 -- This routine was written to convert the Quality flags to AK.
238
239 IF p_flag = 1 THEN
240 return 'yes';
241 ELSE
242 return 'no';
243 END IF;
244
245 END convert_yesno_flag;
246
247
248 FUNCTION convert_boolean_flag (p_flag IN NUMBER)
249 RETURN VARCHAR2 IS
250
251 BEGIN
252
253 -- In Quality all the flags are numeric, meaning a value of 1 or 2
254 -- is used to indicate if the flag is on or off. In AK however,
255 -- it is a character that describes if the flag is on or off.
256 -- This routine was written to convert the Quality flags to AK.
257
258 IF p_flag = 1 THEN
259 return 'true';
260 ELSE
261 return 'false';
262 END IF;
263
264 END convert_boolean_flag;
265
266
267
268 FUNCTION compute_item_style (p_plan_id IN NUMBER, p_element_id IN NUMBER)
269 RETURN VARCHAR2 IS
270
271 BEGIN
272
273 IF qa_plan_element_api.qpc_read_only_flag(p_plan_id, p_element_id) = 1
274 or qa_chars_api.datatype(p_element_id) = g_seq_datatype THEN
275 return 'messageStyledText';
276 ELSIF qa_plan_element_api.qpc_poplist_flag(p_plan_id,
277 p_element_id) = 1 then
278 return 'messageChoice';
279 ELSIF (qa_plan_element_api.values_exist(p_plan_id, p_element_id)
280 OR qa_plan_element_api.sql_validation_exists(p_element_id)
281 OR qa_chars_api.has_hardcoded_lov(p_element_id)) THEN
282 return 'messageLovInput';
283 ELSE
284 return 'messageTextInput';
285 END IF;
286
287 END compute_item_style;
288
289
290 -- Bug 4506400. OA Framework Integration. UT bug fix.
291 -- Set maximum length property for items.
292 -- srhariha. Mon Aug 29 04:55:57 PDT 2005.
293
294 --
295 -- Get maximum length for region item.
296 -- Data is fetched from FND_COLUMNS table.
297 -- Important : For hardcoded elements following should be same as
298 -- developer name.
299 -- - VO ATTRIBUTE NAME
300 -- - COLUMN NAME IN QA_RESULTS_INTERFACE
301 --
302 -- Returns -1 for error condition.
303 --
304
305 FUNCTION get_max_length(p_column_name IN VARCHAR2) RETURN NUMBER IS
306
307 cursor c1 is
308 select fc.width
309 from fnd_columns fc, fnd_tables ft
310 where fc.table_id = ft.table_id
311 and ft.table_name = 'QA_RESULTS_INTERFACE'
312 and ft.application_id = 250
313 and fc.user_column_name = p_column_name
314 and fc.application_id = 250; -- to use index
315
316 l_width number;
317 BEGIN
318
319 open c1 ;
320 fetch c1 into l_width;
321 close c1;
322
323 if(l_width is null) then
324 l_width := -1 ;
325 end if;
326
327 return l_width;
328
329 END get_max_length;
330
331
332
333
334 FUNCTION create_jrad_region_item(
335 p_item_style IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
336
337 BEGIN
338
339 RETURN JDR_DOCBUILDER.createElement(jdr_docbuilder.OA_NS, p_item_style);
340
341 END create_jrad_region_item;
342
343
344
345 PROCEDURE add_child_to_parent(
346 parent_element IN JDR_DOCBUILDER.ELEMENT,
347 child_element IN JDR_DOCBUILDER.ELEMENT,
348 p_tag_name IN VARCHAR2) IS
349
350 BEGIN
351 -- p_tag_name can be 'contents', 'detail'
352 JDR_DOCBUILDER.addChild(parent_element, JDR_DOCBUILDER.UI_NS, p_tag_name,
353 child_element);
354
355 END add_child_to_parent;
356
357
358
359
360 PROCEDURE get_lov_dependencies (p_char_id IN NUMBER,
361 x_parents OUT NOCOPY ParentArray) IS
362
363 BEGIN
364
365 -- This is needed for populating correct lov relations.
366 -- Given a element id, this function computes the
367 -- ancestors for it and accordingly populates a
368 -- OUT table structure.
369
370 x_parents.delete();
371
372 IF p_char_id = qa_ss_const.item THEN
373 x_parents(1) := qa_ss_const.production_line;
374
375 ELSIF p_char_id = qa_ss_const.to_op_seq_num THEN
376 x_parents(1) := qa_ss_const.job_name;
377 x_parents(2) := qa_ss_const.production_line;
378
379 ELSIF p_char_id = qa_ss_const.from_op_seq_num THEN
380 x_parents(1) := qa_ss_const.job_name;
381 x_parents(2) := qa_ss_const.production_line;
382
383 ELSIF p_char_id = qa_ss_const.to_intraoperation_step THEN
384 x_parents(1) := qa_ss_const.to_op_seq_num;
385
386 ELSIF p_char_id = qa_ss_const.from_intraoperation_step THEN
387 x_parents(1) := qa_ss_const.from_op_seq_num;
388
389 ELSIF p_char_id = qa_ss_const.uom THEN
390
391 x_parents(1) := qa_ss_const.item;
392 x_parents(2) := qa_ss_const.production_line;
393
394 ELSIF p_char_id = qa_ss_const.revision THEN
395 x_parents(1) := qa_ss_const.item;
396 x_parents(2) := qa_ss_const.production_line;
397
398 ELSIF p_char_id = qa_ss_const.subinventory THEN
399 x_parents(1) := qa_ss_const.item;
400 x_parents(2) := qa_ss_const.production_line;
401
402 ELSIF p_char_id = qa_ss_const.locator THEN
403 x_parents(1) := qa_ss_const.subinventory;
404 x_parents(2) := qa_ss_const.item;
405 x_parents(3) := qa_ss_const.production_line;
406
407 -- anagarwa Thu Aug 12 15:49:51 PDT 2004
408 -- bug 3830258 incorrect LOVs in QWB
412 --x_parents(2) := qa_ss_const.production_line;
409 -- synced up the lot number lov with forms
410 ELSIF p_char_id = qa_ss_const.lot_number THEN
411 x_parents(1) := qa_ss_const.item;
413
414 -- anagarwa Thu Aug 12 15:49:51 PDT 2004
415 -- bug 3830258 incorrect LOVs in QWB
416 -- synced up the serial number lov with forms
417 ELSIF p_char_id = qa_ss_const.serial_number THEN
418 x_parents(1) := qa_ss_const.lot_number;
419 x_parents(2) := qa_ss_const.item;
420 --x_parents(3) := qa_ss_const.production_line;
421 x_parents(3) := qa_ss_const.revision;
422
423 ELSIF p_char_id = qa_ss_const.comp_uom THEN
424 x_parents(1) := qa_ss_const.comp_item;
425
426 ELSIF p_char_id = qa_ss_const.comp_revision THEN
427 x_parents(1) := qa_ss_const.comp_item;
428
429 ELSIF p_char_id = qa_ss_const.po_line_num THEN
430 x_parents(1) := qa_ss_const.po_number;
431
432 ELSIF p_char_id = qa_ss_const.po_shipment_num THEN
433 x_parents(1) := qa_ss_const.po_line_num;
434 x_parents(2) := qa_ss_const.po_number;
435
436 ELSIF p_char_id = qa_ss_const.po_release_num THEN
437 x_parents(1) := qa_ss_const.po_number;
438
439 ELSIF p_char_id = qa_ss_const.order_line THEN
440 x_parents(1) := qa_ss_const.sales_order;
441
442 ELSIF p_char_id = qa_ss_const.task_number THEN
443 x_parents(1) := qa_ss_const.project_number;
444
445 --dgupta: Start R12 EAM Integration. Bug 4345492
446 ELSIF p_char_id = qa_ss_const.asset_instance_number THEN
447 x_parents(1) := qa_ss_const.asset_group;
448 x_parents(2) := qa_ss_const.asset_number;
449
450 ELSIF p_char_id = qa_ss_const.asset_number THEN
451 x_parents(1) := qa_ss_const.asset_group;
452 x_parents(2) := qa_ss_const.asset_instance_number;
453
454 -- rkaza. 12/02/2003. bug 3215372.
455 -- Both asset group and asset number were being assigned to x_parents(1)
456 ELSIF p_char_id = qa_ss_const.asset_activity THEN
457 x_parents(1) := qa_ss_const.asset_group;
458 x_parents(2) := qa_ss_const.asset_number;
459 x_parents(3) := qa_ss_const.asset_instance_number;
460
461 ELSIF p_char_id = qa_ss_const.followup_activity THEN
462 x_parents(1) := qa_ss_const.asset_group;
463 x_parents(2) := qa_ss_const.asset_number;
464 x_parents(3) := qa_ss_const.asset_instance_number;
465 --dgupta: End R12 EAM Integration. Bug 4345492
466
467 -- rkaza. 12/02/2003. bug 3215404.
468 -- Added dependency relation for maintenance op seq with maintenance
469 -- work order.
470 ELSIF p_char_id = qa_ss_const.maintenance_op_seq THEN
471 x_parents(1) := qa_ss_const.work_order;
472
473 -- rkaza. 12/02/2003. bug 3280307.
474 -- Added dependency relation for component item with item
475 ELSIF p_char_id = qa_ss_const.comp_item THEN
476 x_parents(1) := qa_ss_const.item;
477
478 -- anagarwa Thu Aug 12 15:49:51 PDT 2004
479 -- bug 3830258 incorrect LOVs in QWB
480 -- synced up the component lot number and component serial number
481 -- lov with forms
482 ELSIF p_char_id = qa_ss_const.comp_lot_number THEN
483 x_parents(1) := qa_ss_const.comp_item;
484
485 ELSIF p_char_id = qa_ss_const.comp_serial_number THEN
486 x_parents(1) := qa_ss_const.comp_lot_number;
487 x_parents(2) := qa_ss_const.comp_item;
488 x_parents(3) := qa_ss_const.comp_revision;
489
490 -- R12 OPM Deviations. Bug 4345503 Start
491 ELSIF p_char_id = qa_ss_const.process_batchstep_num THEN
492 x_parents(1) := qa_ss_const.process_batch_num;
493
494 ELSIF p_char_id = qa_ss_const.process_operation THEN
495 x_parents(1) := qa_ss_const.process_batch_num;
496 x_parents(2) := qa_ss_const.process_batchstep_num;
497
498 ELSIF p_char_id = qa_ss_const.process_activity THEN
499 x_parents(1) := qa_ss_const.process_batch_num;
500 x_parents(2) := qa_ss_const.process_batchstep_num;
501
502 ELSIF p_char_id = qa_ss_const.process_resource THEN
503 x_parents(1) := qa_ss_const.process_batch_num;
504 x_parents(2) := qa_ss_const.process_batchstep_num;
505 x_parents(3) := qa_ss_const.process_activity;
506
507 ELSIF p_char_id = qa_ss_const.process_parameter THEN
508 x_parents(1) := qa_ss_const.process_resource;
509 -- R12 OPM Deviations. Bug 4345503 End
510
511 --
512 -- Bug 6161802
513 -- Added dependency relation for rma line number with rma number
514 -- skolluku Thu Mon Jul 16 22:08:16 PDT 2007
515 --
516 ELSIF p_char_id = qa_ss_const.rma_line_num THEN
517 x_parents(1) := qa_ss_const.rma_number;
518
519 END IF;
520
521 END get_lov_dependencies;
522
523
524
525 FUNCTION get_region_prompt (p_region_type VARCHAR2)
526 RETURN VARCHAR2 IS
527
528 -- Bug 6998253
529 -- this can also be an UI label and not just collection
530 -- element prompt, so increasing the length
531 l_prompt VARCHAR2(250);
532 l_message VARCHAR2(30);
533 l_api_name VARCHAR2(100) := 'GET_REGION_PROMPT';
534
535 BEGIN
536
537 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
541
538 -- Bug 4506769. OA Framework Integation project. UT bug fix.
539 -- Getting prompts from FND_NEW_MESSAGES.
540 -- srhariha. Fri Aug 26 00:16:30 PDT 2005.
542 If p_region_type = 'TOP' then
543 l_prompt := null;
544 elsif p_region_type = 'DATA' then
545 l_message := 'QA_SS_RN_PROMPT_DATA';
546 elsif p_region_type = 'COMMENTS' then
547 l_message := 'QA_SS_RN_PROMPT_COMMENTS';
548 elsif p_region_type = 'ATTACHMENTS' then
549 l_message := 'QA_SS_JRAD_ATTACHMENT';
550 -- 12.1 Device Integration Project
551 -- Get prompt for the device region
552 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
553 elsif p_region_type = 'DEVICE' then
554 l_message := 'QA_SS_RN_PROMPT_DEVICE';
555 end if;
556
557 l_prompt := fnd_message.get_string('QA',l_message);
558
559 log_error(g_pkg_name || l_api_name, 'Function END Returning l_prompt as ' || l_prompt);
560
561 -- 12.1 Device Integration
562 -- Encode to HTML special Characters.
563 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
564 RETURN DBMS_XMLGEN.convert(l_prompt);
565
566 END get_region_prompt;
567
568
569
570 /*
571 anagarwa Thu Dec 4 11:30:36 PST 2003
572 Bug 3297976
573 Based upon UI cheat sheet mandatory fixes, we use labeledFieldLayout
574 for details regions. This has been done to reduce whitespace in the
575 hidden region of eqr table row.
576
577 */
578
579 FUNCTION create_jrad_region (
580 p_region_code IN VARCHAR2,
581 p_region_style IN VARCHAR2,
582 p_prompt IN VARCHAR2,
583 p_columns IN VARCHAR2,
584 p_mode in VARCHAR2 default null) RETURN JDR_DOCBUILDER.ELEMENT IS
585
586 l_element JDR_DOCBUILDER.ELEMENT := NULL;
587 l_addText VARCHAR2(1000);
588
589 l_api_name VARCHAR2(100) := 'CREATE_JRAD_REGION';
590
591 BEGIN
592 -- region style choices:
593 -- stackLayout, defaultDoubleColumn, defaultSingleColumn, table
594 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
595
596 l_element := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, p_region_style);
597
598 -- 12.1 Inline Region Project
599 -- added advancedTable below
600 -- saurabh
601
602 -- 12.1 Device Integration Project
603 -- Added header to the in clause
604 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
605 if p_region_style in ('defaultDoubleColumn', 'defaultSingleColumn', 'table', 'header') then
606 jdr_docbuilder.setAttribute(l_element, 'text', p_prompt);
607 elsif p_region_style <> 'labeledFieldLayout' then
608 jdr_docbuilder.setAttribute(l_element, 'prompt', p_prompt);
609 end if;
610
611 if ( p_region_style = 'advancedTable') then
612 jdr_docbuilder.setAttribute(l_element, 'text', '');
613 end if;
614
615 jdr_docbuilder.setAttribute(l_element, 'regionName', p_prompt);
616 jdr_docbuilder.setAttribute(l_element, 'id', p_region_code);
617
618 -- 12.1 Inline Region Project
619 -- added advancedTable below
620 -- saurabh
621 if (p_region_style = 'table' OR p_region_style = 'advancedTable') then
622 jdr_docbuilder.setAttribute(l_element, 'detailViewAttr', 'HideShowStatus');
623 jdr_docbuilder.setAttribute(l_element, 'unvalidated', 'True');
624 -- anagarwa Mon Nov 17 15:34:29 PST 2003
625 -- bug 3251538
626 -- we need to add addtional text for all tables.
627 if nvl(p_mode, '@') <> g_vqr_multiple_layout then
628 l_addText := fnd_message.get_string('QA','QA_SSQR_E_MULT_TEXT');
629 else
630 l_addText := fnd_message.get_string('QA','QA_SSQR_V_MULT_TEXT');
631 end if;
632
633 -- 12.1 QWB Usability Improvements
634 -- Encode the HTML special characters
635 -- ntungare
636 jdr_docbuilder.setAttribute(l_element, 'shortDesc', DBMS_XMLGEN.convert(l_addText));
637 end if;
638
639 if p_region_style = 'labeledFieldLayout' then
640 jdr_docbuilder.setAttribute(l_element, 'columns', p_columns);
641 end if;
642
643 -- 12.1 Device Integration Project
644 -- Setting width to 100% for tablelayout style
645 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
646 if p_region_style = 'tableLayout' then
647 jdr_docbuilder.setAttribute(l_element, 'width', '100%');
648 end if;
649
650 log_error(g_pkg_name || l_api_name, 'Function END returns ');
651
652 RETURN l_element;
653
654 END create_jrad_region;
655
656 --
657 -- MOAC Project. 4637896
658 -- New procedure to create base attribute code.
659 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
660 --
661
662 FUNCTION cons_base_attribute_code (
663 p_element_prefix IN VARCHAR2,
664 p_id IN VARCHAR2)
665 RETURN VARCHAR2 IS
666
667 BEGIN
668 --
669 -- bug 5383667
670 -- Added check for Party Name
671 -- ntungare
672 --
673 IF(p_id = qa_ss_const.po_number OR
674 p_id = qa_ss_const.party_name) THEN
675 return qa_chars_api.hardcoded_column(p_id);
676 END IF;
677
678 return construct_code(p_element_prefix,p_id);
679
680 END cons_base_attribute_code;
681
682 --
683 -- bug 6884645
687 --
684 -- New procedure to create an array of collection
685 -- elements that would be displayed in the Header
686 -- region of a Multirow block
688 PROCEDURE multirow_hdrelements_array(
689 p_plan_id IN NUMBER,
690 elements_array OUT NOCOPY ParentArray) IS
691
692
693 BEGIN
694 --
695 -- Selecting the first 5 elements in the collection
696 -- plan ordered on the basis of the mandatory flag
697 -- and the prompt sequence as they would be displayed
698 -- in the header region of a multirow block.
699 --
700 SELECT char_id BULK COLLECT INTO elements_array
701 FROM (SELECT char_id
702 FROM QA_PLAN_CHARS
703 WHERE plan_id = p_plan_id
704 AND enabled_flag = 1
705 ORDER BY mandatory_flag, prompt_sequence)
706 WHERE rownum <=5;
707 END multirow_hdrelements_array;
708
709 --
710 -- bug 6884645
711 -- Added a new parameter the procesing mode
712 -- ntungare
713 --
714 PROCEDURE add_lov_relations (
715 p_plan_id IN NUMBER,
716 p_char_id IN NUMBER,
717 p_attribute_code IN VARCHAR2,
718 p_input_elem IN jdr_docbuilder.Element,
719 p_mode IN VARCHAR2 DEFAULT NULL) IS
720
721
722 l_row_id VARCHAR2(30);
723 l_region_code VARCHAR2(30);
724 l_attribute_code VARCHAR2(30);
725 l_lov_attribute_code VARCHAR2(30);
726 l_base_attribute_code VARCHAR2(30);
727 l_parents ParentArray;
728
729 --
730 -- bug 6884645
731 -- added a new array for the multirow header elements
732 -- ntungare
733 --
734 l_multirow_headers ParentArray;
735
736 lovMap jdr_docbuilder.ELEMENT;
737
738 -- bug 6884645
739 -- variable to check if the parent attribute
740 -- has been processed
741 -- ntungare
742 --
743 parent_element_processed BOOLEAN := FALSE;
744 BEGIN
745
746 -- This function adds lov relations for a region item.
747 -- Here the region item corresponds to a collection plan element.
748
749 --Criteria
750 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
751 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', p_attribute_code);
752 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_attribute_code);
753 jdr_docbuilder.setAttribute(lovMap, 'requiredForLOV', 'true');
754 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',
755 lovMap);
756 --Result
757 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
758 jdr_docbuilder.setAttribute(lovMap, 'resultTo', p_attribute_code);
759 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_attribute_code);
760 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',
761 lovMap);
762 --Org Id
763 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
764 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', g_org_id_attribute);
765 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_attribute_org_id);
766 jdr_docbuilder.setAttribute(lovMap, 'programmaticQuery', 'true');
767 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',
768 lovMap);
769 --Plan Id
770 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
771 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', g_plan_id_attribute);
772 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_attribute_plan_id);
773 jdr_docbuilder.setAttribute(lovMap, 'programmaticQuery', 'true');
774 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',
775 lovMap);
776
777
778 get_lov_dependencies(p_char_id, l_parents);
779
780 FOR i IN 1..l_parents.COUNT LOOP
781
782 -- anagarwa
783 -- Bug 2751198
784 -- Add dependency to LOV only if the element exists in the plan
785 -- This is achieved by adding the following IF statement
786
787 -- rkaza. 10/22/2003. 3280307. shold not use exists_qa_plan_chars
788 -- array might not have been initialized. use element_in_plan
789 -- IF qa_plan_element_api.exists_qa_plan_chars(p_plan_id, l_parents(i)) THEN
790 IF qa_plan_element_api.element_in_plan(p_plan_id, l_parents(i)) THEN
791 l_lov_attribute_code := g_lov_attribute_dependency || to_char(i);
792 --
793 -- MOAC Project. 4637896
794 -- Call new procedure to construct base code
795 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
796 --
797 -- bug 6884645
798 -- The multirow prefix should be used if the base element would be
799 -- displayed in the details region for a multirow block as
800 -- otherwise its value cannot be read
801 -- ntungare Sat Mar 22 08:39:05 PDT 2008
802 --
803 IF (p_mode = g_eqr_advtable_layout OR p_mode = g_eqr_multiple_layout) THEN
804 -- Call the procedure to populate an array containing the
805 -- collection elements appearing in the header region of
806 -- a multirow block
810 -- loop through the header elements array and check if the parent element
807 --
808 multirow_hdrelements_array(p_plan_id, l_multirow_headers);
809
811 -- is a part of it. if yes then the CHARID prefix is to be used else
812 -- the DTLCHARID prefix is to be used since the parent element is in the
813 -- detail region
814 -- ntungare
815 --
816 FOR cntr in 1..l_multirow_headers.COUNT
817 loop
818 -- parent element in header region
819 IF (l_parents(i) = l_multirow_headers(cntr)) THEN
820 l_base_attribute_code := cons_base_attribute_code(g_element_prefix, l_parents(i));
821
822 -- Set the parent element processed flag as TRUE
823 parent_element_processed := TRUE;
824 EXIT;
825 END If;
826 end loop;
827
828 -- If the parent element processed flag is FALSE then it means
829 -- that the parent element is not in header
830 IF (parent_element_processed = FALSE) THEN
831 l_base_attribute_code := cons_base_attribute_code(g_dtl_element_prefix, l_parents(i));
832 END If;
833
834 -- Single row region processing
835 ELSE
836 l_base_attribute_code := cons_base_attribute_code(g_element_prefix, l_parents(i));
837 END IF;
838
839 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
840 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', l_base_attribute_code);
841 jdr_docbuilder.setAttribute(lovMap, 'lovItem', l_lov_attribute_code);
842 jdr_docbuilder.setAttribute(lovMap, 'programmaticQuery', 'true');
843 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS,
844 'lovMappings',lovMap);
845 END IF;
846
847 --
848 -- bug 6884645
849 -- resetting the flag for the next parent element
850 --
851 parent_element_processed := FALSE;
852 END LOOP;
853
854
855 END add_lov_relations;
856
857 --
858 -- MOAC Project. 4637896
859 -- New procedure to create id item.
860 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
861 --
862
863
864 FUNCTION create_id_item_for_eqr (
865 p_plan_id IN NUMBER,
866 p_char_id IN NUMBER,
867 p_mode IN VARCHAR2 DEFAULT NULL)
868 RETURN jdr_docbuilder.ELEMENT IS
869
870 l_vo_attribute_name VARCHAR2(30) DEFAULT NULL;
871 l_id_elem jdr_docbuilder.ELEMENT := NULL;
872
873 BEGIN
874
875 l_vo_attribute_name := qa_chars_api.hardcoded_column(p_char_id);
876 l_id_elem := create_jrad_region_item('formValue');
877
878 -- set properties
879 jdr_docbuilder.setAttribute(l_id_elem, 'id', l_vo_attribute_name);
880 --if( p_mode <> g_eqr_advtable_layout OR p_mode is NULL) then
881 jdr_docbuilder.setAttribute(l_id_elem, 'viewName', g_vo_name);
882 --end if;
883 jdr_docbuilder.setAttribute(l_id_elem, 'viewAttr', l_vo_attribute_name);
884 jdr_docbuilder.setAttribute(l_id_elem, 'dataType', 'NUMBER');
885
886 return l_id_elem;
887
888 END create_id_item_for_eqr;
889
890
891
892 --
893 -- MOAC Project. 4637896
894 -- Checks whether its a normalized lov item.
895 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
896 --
897 FUNCTION is_normalized_lov (
898 p_plan_id IN NUMBER,
899 p_char_id IN NUMBER) RETURN VARCHAR2 IS
900
901 BEGIN
902 -- currently we are enabling normalized logic
903 -- only for PO NUMBER
904 --
905 -- bug 5383667
906 -- added the party name to the list of normalized vals
907 -- ntungare
908 --
909 if((p_char_id = qa_ss_const.po_number) OR
910 (p_char_id = qa_ss_const.party_name))then
911 return 'T';
912 end if;
913
914 return 'F';
915 END is_normalized_lov;
916
917 --
918 -- MOAC Project. 4637896
919 -- Gets external LOV region name
920 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
921 --
922 FUNCTION get_lov_region_name (
923 p_plan_id IN NUMBER,
924 p_char_id IN NUMBER) RETURN VARCHAR2 IS
925
926 BEGIN
927 -- currently we are enabling normalized logic
928 -- only for PO NUMBER. So we are hard coding
929 -- lov region name. In future, this proc must
930 -- be generalized.
931 if(p_char_id = qa_ss_const.po_number) then
932 return 'PONumberLovRN';
933 --
934 -- bug 5383667
935 -- getting the region LOV region name for
936 -- Party Name. We are currently using a separate
937 -- region for the Part name, however we should
938 -- later use a common region for all the normalized
939 -- id elements
940 --
941 elsif (p_char_id = qa_ss_const.party_name) then
942 return 'PartyLovRN';
943 end if;
944
945 return 'QaLovRN';
946
947 END get_lov_region_name;
948
952 -- New method to process normalized lov item.
949
950 --
951 -- MOAC Project. 4637896
953 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
954 --
955
956 PROCEDURE process_normalized_lov (
957 p_plan_id IN NUMBER,
958 p_char_id IN NUMBER,
959 p_attribute_code IN VARCHAR2,
960 p_char_item IN jdr_docbuilder.Element) IS
961
962 lovMap jdr_docbuilder.ELEMENT;
963 l_lov_region VARCHAR2(100);
964
965 BEGIN
966 l_lov_region := g_jrad_lov_dir_path || get_lov_region_name(p_plan_id,p_char_id);
967 jdr_docbuilder.setAttribute(p_char_item,
968 'externalListOfValues',
969 l_lov_region);
970 --Criteria
971 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
972 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', p_attribute_code);
973 jdr_docbuilder.setAttribute(lovMap, 'resultTo', p_attribute_code);
974
975 IF(p_char_id = qa_ss_const.po_number) THEN
976 jdr_docbuilder.setAttribute(lovMap, 'lovItem', 'Segment1');
977 jdr_docbuilder.setAttribute(lovMap, 'requiredForLOV', 'true');
978 jdr_docbuilder.addChild(p_char_item, jdr_docbuilder.JRAD_NS, 'lovMappings',
979 lovMap);
980
981 -- po_header_id
982 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
983 jdr_docbuilder.setAttribute(lovMap, 'lovItem', 'PoHeaderId');
984 jdr_docbuilder.setAttribute(lovMap, 'resultTo', qa_chars_api.hardcoded_column(p_char_id));
985 jdr_docbuilder.addChild(p_char_item, jdr_docbuilder.JRAD_NS, 'lovMappings',
986 lovMap);
987 --
988 -- bug 5383667
989 -- Processing for the Party Name element
990 -- ntungare
991 --
992 ELSIF(p_char_id = qa_ss_const.party_name) THEN
993 jdr_docbuilder.setAttribute(lovMap, 'lovItem', 'PartyName');
994 jdr_docbuilder.setAttribute(lovMap, 'requiredForLOV', 'true');
995 jdr_docbuilder.addChild(p_char_item, jdr_docbuilder.JRAD_NS, 'lovMappings',
996 lovMap);
997
998 -- PartyId
999 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
1000 jdr_docbuilder.setAttribute(lovMap, 'lovItem', 'PartyId');
1001 jdr_docbuilder.setAttribute(lovMap, 'resultTo', qa_chars_api.hardcoded_column(p_char_id));
1002 jdr_docbuilder.addChild(p_char_item, jdr_docbuilder.JRAD_NS, 'lovMappings',
1003 lovMap);
1004
1005 END IF; -- PO Number
1006
1007 END process_normalized_lov;
1008
1009 --
1010 -- MOAC Project. 4637896
1011 -- New method to process regular lov item.
1012 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
1013 --
1014 -- bug 6884645
1015 -- added a new parameter the processing mode
1016 -- ntungare
1017 --
1018 PROCEDURE process_regular_lov (
1019 p_plan_id IN NUMBER,
1020 p_char_id IN NUMBER,
1021 p_attribute_code IN VARCHAR2,
1022 p_char_item IN jdr_docbuilder.Element,
1023 p_mode IN VARCHAR2 DEFAULT NULL) IS
1024
1025 BEGIN
1026
1027 jdr_docbuilder.setAttribute(p_char_item, 'externalListOfValues',
1028 g_jrad_lov_path);
1029
1030 add_lov_relations(p_plan_id, p_char_id, p_attribute_code, p_char_item, p_mode);
1031
1032 END process_regular_lov;
1033
1034 --
1035 -- 12.1 QB Usability Improvements
1036 -- new fuction to check if Online actions
1037 -- have been defined on a collection element
1038 -- ntungare Tue Aug 28 04:34:33 PDT 2007
1039 --
1040 FUNCTION is_online_action_defined(p_plan_id IN NUMBER,
1041 p_char_id IN NUMBER)
1042 RETURN NUMBER IS
1043
1044 -- Cursor to check if Online actions
1045 -- have been defined on a collection
1046 -- element
1047 Cursor online_actions_cur is
1048 (select 1 from
1049 qa_plan_char_action_triggers pcat,
1050 qa_plan_char_actions pca
1051 where pcat.plan_id = p_plan_id
1052 and pcat.plan_char_action_trigger_id = pca.plan_char_action_trigger_id
1053 and action_id in (1, 2, 24)
1054 and pcat.char_id = p_char_id) ;
1055
1056 cur_val NUMBER;
1057 BEGIN
1058 open online_actions_cur ;
1059 fetch online_actions_cur into cur_val;
1060 close online_actions_cur;
1061
1062 RETURN cur_val;
1063 END is_online_action_defined;
1064
1065
1066 --
1067 -- MOAC Project. 4637896
1068 -- New method to process lov item.
1069 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
1070 --
1071 --
1072 -- bug 6884645
1073 -- passing the mode of processing
1074 -- ntungare Sat Mar 22 08:39:05 PDT 2008
1075 --
1076 PROCEDURE process_messageLovInput (
1077 p_plan_id IN NUMBER,
1078 p_char_id IN NUMBER,
1079 p_attribute_code IN VARCHAR2,
1080 p_char_item IN jdr_docbuilder.Element,
1081 p_displayed_flag IN NUMBER,
1082 p_read_only_flag IN NUMBER,
1083 p_mode IN VARCHAR2 DEFAULT NULL) IS
1084
1088 -- ntungare
1085 -- 12.1 QWB Usability Improvements
1086 -- Flag to cehck if Online actions have been defined
1087 -- on the collection element
1089 --
1090 online_act_flg NUMBER := 0;
1091
1092 BEGIN
1093 -- in the future, this may be changed to be more generic
1094 -- so that all hardcoded LOVs will go through this
1095 -- process_normalized_lov procedure. Currently handle
1096 -- PO Number only for the immediate MOAC requirement.
1097 IF is_normalized_lov(p_plan_id,p_char_id) = 'T' THEN
1098 process_normalized_lov(
1099 p_plan_id,
1100 p_char_id,
1101 p_attribute_code,
1102 p_char_item);
1103 ELSE
1104 --
1105 -- bug 6884645
1106 -- passing the processing mode
1107 -- ntungare
1108 --
1109 process_regular_lov(
1110 p_plan_id,
1111 p_char_id,
1112 p_attribute_code,
1113 p_char_item,
1114 p_mode);
1115 END IF;
1116
1117 -- Common code
1118
1119 IF (p_displayed_flag <> 1 OR p_read_only_flag = 1) THEN
1120 jdr_docbuilder.setAttribute(p_char_item, 'unvalidated', 'true');
1121 ELSE
1122 jdr_docbuilder.setAttribute(p_char_item, 'unvalidated', 'false');
1123 END IF;
1124
1125 --
1126 -- 12.1 QWB Usability improvements
1127 -- The user:attribute1 needs to be set which would help in
1128 -- identifying if the LOV event is for a Quality LOV collection
1129 -- element or not. We need to do PPR processing for LOV elements
1130 -- to set the dependent elements and to fire online actions
1131 -- ntungare Sun Oct 14 03:08:47 PDT 2007
1132 --
1133 jdr_docbuilder.setAttribute(p_char_item, 'user:attribute1', 'qapprelement');
1134
1135 --
1136 -- 12.1 QWB Usability improvements
1137 -- If the LOV has online actions defined,
1138 -- then it should be maked for actions processing
1139 -- So setting the user:attribute2
1140 -- ntungare Sun Oct 14 03:08:47 PDT 2007
1141 --
1142 online_act_flg := is_online_action_defined(p_plan_id => p_plan_id,
1143 p_char_id => p_char_id);
1144
1145 If (online_act_flg = 1) THEN
1146 jdr_docbuilder.setAttribute(p_char_item, 'user:attribute2', 'qaactionelement');
1147 End If;
1148
1149 END process_messageLovInput;
1150
1151 FUNCTION create_region_item_for_eqr (
1152 p_plan_id IN NUMBER,
1153 p_char_id IN NUMBER,
1154 p_element_prefix IN VARCHAR2 DEFAULT g_element_prefix,
1155 p_mode IN VARCHAR2 DEFAULT NULL) RETURN JDR_DOCBUILDER.ELEMENT IS
1156
1157 l_attribute_code VARCHAR2(30);
1158 l_item_style VARCHAR2(30);
1159 l_vo_attribute_name VARCHAR2(30);
1160 l_pop_vo_name VARCHAR2(30);
1161
1162 c_displayed_flag VARCHAR2(10);
1163 c_datatype VARCHAR2(30);
1164 c_mandatory_flag VARCHAR2(5);
1165 c_read_only_flag VARCHAR2(5);
1166
1167 l_displayed_flag qa_plan_chars.displayed_flag%TYPE;
1168 l_read_only_flag qa_plan_chars.read_only_flag%TYPE;
1169 l_datatype qa_chars.datatype%TYPE;
1170 l_data_entry_hint qa_chars.data_entry_hint%TYPE := null;
1171 l_mandatory_flag qa_plan_chars.mandatory_flag%TYPE;
1172 -- Bug 5926317
1173 -- Changing the length of the local variable l_prompt
1174 -- to a higher value - 100 and commenting out the existing code
1175 -- skolluku Mon Apr 9 04:59:34 PDT 2007
1176 --l_prompt qa_plan_chars.prompt%TYPE;
1177 l_prompt VARCHAR2(100);
1178
1179 -- Bug 4506400. New variable.
1180 -- srhariha. Mon Aug 29 05:07:41 PDT 2005.
1181 l_maximum_length NUMBER;
1182
1183
1184 l_char_item jdr_docbuilder.ELEMENT;
1185
1186 l_api_name constant varchar2(50) := 'CREATE_REGION_ITEM_FOR_EQR';
1187
1188 -- 12.1 QWB Usability Improvements
1189 -- ntungare Tue Aug 28 04:20:24 PDT 2007
1190 -- PPRTEST
1191 ppr_event jdr_docbuilder.ELEMENT;
1192
1193 online_act_flg PLS_INTEGER := 0;
1194
1195 l_show_required_flag qa_plan_chars.mandatory_flag%TYPE;
1196 c_show_required_flag VARCHAR2(5);
1197 BEGIN
1198 l_displayed_flag := qa_plan_element_api.qpc_displayed_flag(p_plan_id, p_char_id);
1199
1200 -- 12.1 QWB Usability improvements
1201 -- The fields are to be made mandatory only in case of a single
1202 -- row region and not in case of a Multirow region. This is because
1203 -- in case of a multirow region, the mandatory flag against the
1204 -- elements would conflict with the Client side validation in case
1205 -- of inline Txn int. Only the sortable header would be marked as
1206 -- mandatory so that the * mark is displayed against the mandatory
1207 -- fields.
1208 IF (p_mode = g_eqr_advtable_layout OR
1209 p_mode = g_eqr_multiple_layout) THEN
1210 l_mandatory_flag := 2; -- Non mandatory
1211
1212 -- Although the mandatory check would not be enforced on the
1213 -- collection elements in a Multirow block, yet the show required
1214 -- property would ensure that the mandatory elements are displayed
1218 c_show_required_flag := convert_boolean_flag(l_show_required_flag);
1215 -- with the mandatory sign. This is needed only for details block
1216 IF (p_element_prefix = g_dtl_element_prefix) THEN
1217 l_show_required_flag := qa_plan_element_api.qpc_mandatory_flag(p_plan_id, p_char_id);
1219 END IF;
1220 ELSE
1221 l_mandatory_flag := qa_plan_element_api.qpc_mandatory_flag(p_plan_id, p_char_id);
1222 END IF;
1223
1224 l_prompt := get_prompt(p_plan_id, p_char_id);
1225 l_datatype := qa_chars_api.datatype(p_char_id);
1226 l_data_entry_hint := qa_chars_api.data_entry_hint(p_char_id);
1227 l_read_only_flag := qa_plan_element_api.qpc_read_only_flag(p_plan_id, p_char_id);
1228
1229 l_attribute_code := construct_code(p_element_prefix, p_char_id);
1230 l_item_style := compute_item_style(p_plan_id, p_char_id);
1231 l_vo_attribute_name := get_vo_attribute_name(p_plan_id, p_char_id);
1232
1233 c_displayed_flag := convert_boolean_flag(l_displayed_flag);
1234 c_mandatory_flag := convert_yesno_flag(l_mandatory_flag);
1235 c_datatype := convert_data_type(l_datatype);
1236
1237
1238 if l_datatype = g_seq_datatype then
1239 c_read_only_flag := 'true';
1240 else
1241 c_read_only_flag := convert_boolean_flag(l_read_only_flag);
1242 end if;
1243
1244 l_char_item := create_jrad_region_item(l_item_style);
1245
1246 jdr_docbuilder.setAttribute(l_char_item, 'id', l_attribute_code);
1247 jdr_docbuilder.setAttribute(l_char_item, 'rendered', c_displayed_flag);
1248 jdr_docbuilder.setAttribute(l_char_item, 'readOnly', c_read_only_flag);
1249 -- if read only elmeent then set style class
1250 if c_read_only_flag = 'true' then
1251 jdr_docbuilder.setAttribute(l_char_item, 'styleClass', g_ora_data_text);
1252 end if;
1253 jdr_docbuilder.setAttribute(l_char_item, 'prompt', l_prompt);
1254 jdr_docbuilder.setAttribute(l_char_item, 'shortDesc', l_prompt);
1255 jdr_docbuilder.setAttribute(l_char_item, 'required', c_mandatory_flag);
1256
1257 -- 12.1 QWB Usability
1258 -- If the element is in a Multirow details block then
1259 -- although the madatory check would not be enfored yet, the
1260 -- element must atleast be marked as mandatory.
1261 IF ((p_mode = g_eqr_advtable_layout OR p_mode = g_eqr_multiple_layout) AND
1262 (p_element_prefix = g_dtl_element_prefix))THEN
1263 jdr_docbuilder.setAttribute(l_char_item, 'showRequired', c_show_required_flag);
1264 END IF;
1265
1266 jdr_docbuilder.setAttribute(l_char_item, 'dataType', c_datatype);
1267 -- Advanced Table does not require view name for each item, write code here and other places
1268 -- jdr_docbuilder.setAttribute(l_char_item, 'viewName', g_vo_name);
1269 --if( p_mode <> g_eqr_advtable_layout OR p_mode is NULL) then
1270 jdr_docbuilder.setAttribute(l_char_item, 'viewName', g_vo_name);
1271 --end if;
1272 jdr_docbuilder.setAttribute(l_char_item, 'viewAttr', l_vo_attribute_name);
1273
1274 -- Bug 4506400. OA Framework Integration. UT Bug fix.
1275 -- Set maxLength property.
1276 -- srhariha. Mon Aug 29 05:07:41 PDT 2005.
1277 IF (l_item_style IN ('messageTextInput','messageLovInput')) THEN
1278 l_maximum_length := get_max_length(l_vo_attribute_name);
1279 IF (l_maximum_length is not null AND l_maximum_length <> -1) THEN
1280 jdr_docbuilder.setAttribute(l_char_item, 'maximumLength', l_maximum_length);
1281 END IF;
1282 END IF;
1283
1284 -- At this point, if the element has lovs then we must determine
1285 -- what are its dependency and populate lov_relations
1286 -- with this information.
1287
1288 --
1289 -- MOAC Project. 4637896
1290 -- Call new method to process lov item.
1291 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
1292 --
1293 -- bug 6884645
1294 -- passing the procesing mode
1295 -- ntungare
1296 --
1297 IF (l_item_style = 'messageLovInput' ) THEN
1298 process_messageLovInput(p_plan_id,p_char_id,l_attribute_code,
1299 l_char_item,l_displayed_flag,l_read_only_flag, p_mode);
1300 END IF;
1301
1302 -- Set a few pop list specific properties for poplist chars
1303
1304 IF (l_item_style = 'messageChoice' ) THEN
1305 -- anagarwa Mon Oct 20 12:47:47 PDT 2003
1306 -- Bug 3202281 . Poplist vo should have plan name .
1307 -- This code has run time dependency on QaRenderCO.java changes
1308 --l_pop_vo_name := construct_code(g_pop_vo_prefix, p_char_id) || 'VO';
1309 l_pop_vo_name := construct_code(g_pop_vo_prefix, p_char_id) || 'PID' || p_plan_id || 'VO';
1310 jdr_docbuilder.setAttribute(l_char_item, 'pickListViewName', l_pop_vo_name);
1311 jdr_docbuilder.setAttribute(l_char_item, 'pickListDispAttr',
1312 g_pop_display_column);
1313 jdr_docbuilder.setAttribute(l_char_item, 'pickListValAttr', g_pop_value_column);
1314 END IF;
1315
1316 -- Set the text width and height properties for chars of type long comments
1317
1318 IF (l_datatype = g_comments_datatype) THEN
1319 jdr_docbuilder.setAttribute(l_char_item, 'columns', g_comments_width);
1320 jdr_docbuilder.setAttribute(l_char_item, 'rows', g_comments_height);
1321 -- Bug 4506400. Max length set above. So commenting it out.
1322 -- srhariha. Mon Aug 29 05:07:41 PDT 2005.
1323
1327 -- set data entry hint
1324 -- jdr_docbuilder.setAttribute(l_char_item, 'maximumLength', g_comments_max_len);
1325 END IF;
1326
1328 IF (l_data_entry_hint is not null) THEN
1329 jdr_docbuilder.setAttribute(l_char_item, 'tipType', g_tip_type);
1330 --jdr_docbuilder.setAttribute(l_char_item, 'tipMessageName', g_tip_message_name);
1331 --jdr_docbuilder.setAttribute(l_char_item, 'tipMessageAppShortName', g_app_short_name);
1332 jdr_docbuilder.setAttribute(l_char_item, 'longTipRegion', g_long_tip_region);
1333 END IF;
1334
1335 --
1336 -- 12.1 QWB Usability Improvements
1337 -- Enabling the MessageTextInput and MessageChoice
1338 -- type of collection elements for PPR processing
1339 -- ntungare Tue Aug 28 04:20:24 PDT 2007
1340 --
1341 IF (l_item_style = 'messageTextInput' OR
1342 l_item_style = 'messageChoice') THEN
1343 -- Disabling the serverside validation to avoid the
1344 -- entire row being validated
1345 --
1346 jdr_docbuilder.setAttribute(l_char_item, 'serverUnvalidated', 'true');
1347
1348 -- Adding the firePartialAction tag
1349 --
1350 ppr_event := JDR_DOCBUILDER.createElement(p_namespace => JDR_DOCBUILDER.UI_NS,
1351 p_tagName => 'firePartialAction');
1352
1353 -- Setting the event name for PPR as qappract_CHARIDXX where XX
1354 -- represents the collection elements CharId
1355 --
1356 jdr_docbuilder.setAttribute(ppr_event, 'event', 'qappract_'||l_attribute_code);
1357
1358 -- Setting the user:attribute1 to indicate the PPR processing is to be
1359 -- done for the element
1360 --
1361 jdr_docbuilder.setAttribute(l_char_item, 'user:attribute1', 'qapprelement');
1362
1363 -- Disabling the client side validation
1364 --
1365 jdr_docbuilder.setAttribute(ppr_event, 'unvalidated', 'true');
1366
1367 jdr_docbuilder.addchild (p_parent => l_char_item,
1368 p_groupingNS => JDR_DOCBUILDER.UI_NS,
1369 p_groupingTagName => 'primaryClientAction',
1370 p_child => ppr_event);
1371
1372
1373 -- Checking if the Online actions have been
1374 -- defined on the collection element
1375 --
1376 online_act_flg := is_online_action_defined(p_plan_id => p_plan_id,
1377 p_char_id => p_char_id);
1378
1379 If (online_act_flg =1) then
1380 -- Setting the user:attribute2 since online actions
1381 -- have been defined.
1382 --
1383 jdr_docbuilder.setAttribute(l_char_item, 'user:attribute2', 'qaactionelement');
1384 online_act_flg := 0;
1385 end if; --(online_act_flg =1)
1386 end if; -- (l_item_style = 'messageTextInput' or l_item_style = 'messageChoice')
1387 -- End of changes for PPR
1388
1389
1390
1391 RETURN l_char_item;
1392
1393 END create_region_item_for_eqr;
1394
1395
1396
1397 FUNCTION create_region_item_for_vqr (
1398 p_plan_id IN NUMBER,
1399 p_char_id IN NUMBER,
1400 p_element_prefix IN VARCHAR2 DEFAULT g_element_prefix,
1401 p_mode IN VARCHAR2 DEFAULT NULL )
1402 RETURN JDR_DOCBUILDER.ELEMENT IS
1403
1404 l_attribute_code VARCHAR2(30);
1405 l_item_style VARCHAR2(30) DEFAULT 'messageStyledText';
1406 l_vo_attribute_name VARCHAR2(30);
1407 l_datatype qa_chars.datatype%TYPE;
1408 -- Bug 5926317
1409 -- Changing the length of the local variable l_prompt
1410 -- to a higher value - 100 and commenting out the existing code
1411 -- skolluku Mon Apr 9 04:59:34 PDT 2007
1412 --l_prompt qa_plan_chars.prompt%TYPE;
1413 l_prompt VARCHAR2(100);
1414
1415 -- Bug 4509114. OA Framework Integration project. UT bug fix.
1416 -- "Displayed Flag" not honoured in VQR. Added the following
1417 -- variables.
1418 -- srhariha. Thu Aug 4 21:04:49 PDT 2005.
1419 l_displayed_flag qa_plan_chars.displayed_flag%TYPE;
1420 c_displayed_flag VARCHAR2(10);
1421
1422
1423 l_char_item jdr_docbuilder.ELEMENT;
1424
1425 BEGIN
1426 l_prompt := get_prompt(p_plan_id, p_char_id);
1427 l_attribute_code := construct_code(p_element_prefix, p_char_id);
1428 l_datatype := qa_chars_api.datatype(p_char_id);
1429
1430 l_char_item := create_jrad_region_item(l_item_style);
1431 -- Bug 4509114. OA Framework Integration project. UT bug fix.
1432 -- "Displayed Flag" not honoured in VQR. Get the displayed flag.
1433 -- srhariha. Thu Aug 4 21:04:49 PDT 2005.
1434 jdr_docbuilder.setAttribute(l_char_item, 'id', l_attribute_code);
1435 --jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'true');
1436 jdr_docbuilder.setAttribute(l_char_item, 'prompt', l_prompt);
1437 jdr_docbuilder.setAttribute(l_char_item, 'shortDesc', l_prompt);
1438
1439
1440 -- bug 3236302. rkaza. timezone support. 11/04/2003
1441 -- Added datatype to vqr region items
1442 jdr_docbuilder.setAttribute(l_char_item, 'dataType', convert_data_type(l_datatype));
1443
1444 -- Bug 4509114. OA Framework Integration project. UT bug fix.
1445 -- "Displayed Flag" not honoured in VQR. Set rendered property
1449 -- 12.1 Usability project
1446 -- based on displayed flag.
1447 -- srhariha. Thu Aug 4 21:04:49 PDT 2005.
1448
1450 -- rendered attribute and VO attribute logic is different for export page
1451 -- abgangul
1452 if nvl(p_mode, '@') <> g_vqr_multiple_layout then
1453 l_displayed_flag := qa_plan_element_api.qpc_displayed_flag(p_plan_id, p_char_id);
1454 c_displayed_flag := convert_boolean_flag(l_displayed_flag);
1455 jdr_docbuilder.setAttribute(l_char_item, 'rendered', c_displayed_flag);
1456
1457 l_vo_attribute_name := get_vo_attribute_name(p_plan_id, p_char_id);
1458 jdr_docbuilder.setAttribute(l_char_item, 'viewName', g_vo_name);
1459 jdr_docbuilder.setAttribute(l_char_item, 'viewAttr', l_vo_attribute_name);
1460 jdr_docbuilder.setAttribute(l_char_item, 'styleClass', g_ora_data_text);
1461
1462 end if;
1463
1464 IF (l_datatype = g_comments_datatype) THEN
1465 -- fix me
1466 jdr_docbuilder.setAttribute(l_char_item, 'columns', g_comments_width);
1467 jdr_docbuilder.setAttribute(l_char_item, 'rows', g_comments_height);
1468 END IF;
1469
1470 -- for vqr set all text to style OraDataText
1471
1472 RETURN l_char_item;
1473
1474 END create_region_item_for_vqr;
1475
1476
1477
1478 FUNCTION create_special_region_item (
1479 p_attribute_code IN VARCHAR2,
1480 p_item_style IN VARCHAR2,
1481 p_element_prefix IN VARCHAR2 DEFAULT g_element_prefix,
1482 p_mode IN VARCHAR2 DEFAULT NULL)
1483 RETURN jdr_docbuilder.ELEMENT IS
1484
1485 l_vo_attribute_name VARCHAR2(30) DEFAULT NULL;
1486 l_label_long VARCHAR2(30) DEFAULT NULL;
1487 l_special_elem jdr_docbuilder.ELEMENT := NULL;
1488 l_data_type VARCHAR2(30);
1489 l_attribute_code VARCHAR2(30) := p_attribute_code;
1490
1491 -- for attachments
1492 l_entity_id VARCHAR2(30) DEFAULT NULL;
1493 l_entityMap jdr_docbuilder.ELEMENT := NULL;
1494
1495 BEGIN
1496
1497 -- In EQR we add org_id, org_code, plan_id, plan_code, po_agent_id as special items.
1498 -- In VQR, we add created_by, collection_id, last_update_date as special items
1499 -- VQR special items are displayed as message styled text.
1500 -- EQR special items are not displayed.
1501
1502 l_label_long := get_special_item_label(p_attribute_code);
1503 l_special_elem := create_jrad_region_item(p_item_style);
1504
1505 -- set properties
1506 -- 12.1 Usability project
1507 -- VO and VO attribute name is different for export page
1508 -- abgangul
1509 if nvl(p_mode, '@') <> g_vqr_multiple_layout then
1510 l_vo_attribute_name := get_hardcoded_vo_attr_name(p_attribute_code);
1511 jdr_docbuilder.setAttribute(l_special_elem, 'viewName', g_vo_name);
1512 jdr_docbuilder.setAttribute(l_special_elem, 'viewAttr', l_vo_attribute_name);
1513 jdr_docbuilder.setAttribute(l_special_elem, 'styleClass', g_ora_data_text);
1514 else
1515 l_attribute_code := p_element_prefix || l_attribute_code;
1516 end if;
1517
1518 jdr_docbuilder.setAttribute(l_special_elem, 'id', l_attribute_code);
1519 jdr_docbuilder.setAttribute(l_special_elem, 'prompt', l_label_long);
1520
1521 --
1522 -- Bug 5336860. Per Coding Standard contextual information needs
1523 -- this statement to set the font.
1524 -- bso Thu Jun 15 17:30:55 PDT 2006
1525 --
1526
1527 -- bug 3236302. rkaza. timezone support. 11/04/2003
1528 -- Added datatype datetime to last_update_date
1529 IF (p_attribute_code = g_last_update_date_attribute) THEN
1530 -- Assign a datatype of DATETIME to last_update_date.
1531 l_data_type := convert_data_type(g_datetime_datatype);
1532 jdr_docbuilder.setAttribute(l_special_elem, 'dataType', l_data_type);
1533 END IF;
1534
1535 IF (p_attribute_code = g_collection_id_attribute) THEN
1536 l_data_type := convert_data_type(g_num_datatype);
1537 jdr_docbuilder.setAttribute(l_special_elem, 'dataType', l_data_type);
1538 END IF;
1539
1540 if p_attribute_code = g_multi_row_attachment then
1541 l_entity_id := g_attachment_entity;
1542 jdr_docbuilder.setAttribute(l_special_elem, 'shortDesc', l_label_long);
1543
1544 l_entityMap := jdr_docbuilder.createElement(jdr_docbuilder.OA_NS, 'entityMap');
1545 jdr_docbuilder.setAttribute(l_entityMap, 'entityId', l_entity_id);
1546 jdr_docbuilder.addChild(l_special_elem, jdr_docbuilder.OA_NS,
1547 'entityMappings', l_entityMap);
1548 end if;
1549
1550 return l_special_elem;
1551
1552 END create_special_region_item;
1553
1554
1555 -- 12.1 Inline Region Project START
1556 -- new method to add columns in advanced table of inline region
1557 -- based on the plan and added elements
1558 FUNCTION create_item_for_advtable(p_plan_id IN NUMBER,
1559 p_char_id IN NUMBER,
1560 p_element_prefix IN VARCHAR2 DEFAULT g_element_prefix)
1561 RETURN jdr_docbuilder.element IS
1562
1563 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_ITEM_FOR_ADVTABLE';
1564 l_err_num NUMBER;
1565 l_err_msg VARCHAR2(100);
1566
1567 l_sort_hdr jdr_docbuilder.element := NULL;
1571 l_attr_code VARCHAR2(30);
1568 l_col_hdr jdr_docbuilder.element := NULL;
1569 l_char_item jdr_docbuilder.element := NULL;
1570
1572 l_col_code VARCHAR2(30);
1573 l_hrd_code VARCHAR2(30);
1574 l_prompt VARCHAR2(30);
1575 l_mode VARCHAR2(15) := g_eqr_advtable_layout;
1576
1577 l_mandatory_flag qa_plan_chars.mandatory_flag%TYPE;
1578 c_mandatory_flag VARCHAR2(5);
1579
1580 l_displayed_flag qa_plan_chars.displayed_flag%TYPE;
1581 c_displayed_flag VARCHAR2(10);
1582 BEGIN
1583 log_error(g_pkg_name || l_api_name, 'BEGIN');
1584 l_attr_code := construct_code(p_element_prefix, p_char_id);
1585 l_col_code := 'column' || l_attr_code;
1586 -- create column for the table
1587 -- this is an element from the plan
1588 l_col_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'column');
1589 jdr_docbuilder.setattribute(l_col_hdr, 'id', l_col_code);
1590
1591 -- Setting the rendered property based on the display flag value
1592 l_displayed_flag := qa_plan_element_api.qpc_displayed_flag(p_plan_id, p_char_id);
1593 c_displayed_flag := convert_boolean_flag(l_displayed_flag);
1594
1595 jdr_docbuilder.setAttribute(l_col_hdr, 'rendered', c_displayed_flag);
1596
1597 -- add actual element
1598 log_error(g_pkg_name || l_api_name, 'Creating Element ' || to_char(p_char_id));
1599 l_char_item := create_region_item_for_eqr(p_plan_id, p_char_id, p_element_prefix, l_mode);
1600 log_error(g_pkg_name || l_api_name, 'Adding element to column header');
1601 add_child_to_parent(l_col_hdr, l_char_item, 'contents');
1602 log_error(g_pkg_name || l_api_name, 'END');
1603
1604 l_hrd_code := 'colHdr' || l_attr_code;
1605 -- add column header
1606 l_sort_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'sortableHeader');
1607 jdr_docbuilder.setAttribute(l_sort_hdr, 'id', l_hrd_code);
1608 l_prompt := get_prompt(p_plan_id, p_char_id);
1609 jdr_docbuilder.setAttribute(l_sort_hdr, 'prompt', l_prompt);
1610
1611 -- adding the mandatory sign
1612 l_mandatory_flag := qa_plan_element_api.qpc_mandatory_flag(p_plan_id, p_char_id);
1613 c_mandatory_flag := convert_yesno_flag(l_mandatory_flag);
1614 jdr_docbuilder.setAttribute(l_sort_hdr, 'required', c_mandatory_flag);
1615
1616 add_child_to_parent(l_col_hdr, l_sort_hdr, 'columnHeader');
1617
1618
1619 return l_col_hdr;
1620
1621 END create_item_for_advtable;
1622
1623 -- 12.1 Inline Region Project END
1624
1625
1626 PROCEDURE delete_old_top_document(
1627 p_full_path IN VARCHAR2) IS
1628
1629 BEGIN
1630 -- delete the document if it exists.
1631
1632 If jdr_docbuilder.documentExists(p_full_path) then
1633 jdr_docbuilder.deleteDocument(p_full_path);
1634 end if;
1635
1636 END delete_old_top_document;
1637
1638
1639
1640 FUNCTION create_top_document(
1641 p_full_path IN VARCHAR2) RETURN JDR_DOCBUILDER.DOCUMENT IS
1642
1643 BEGIN
1644
1645 RETURN JDR_DOCBUILDER.createDocument(p_full_path, 'en-US');
1646
1647 END create_top_document;
1648
1649
1650 FUNCTION create_and_set_top_element(
1651 p_top_doc IN JDR_DOCBUILDER.DOCUMENT,
1652 p_top_region_code IN VARCHAR2,
1653 p_layout IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
1654
1655 l_api_name constant varchar2(50) := 'CREATE_AND_SET_TOP_ELEMENT';
1656 l_top_region JDR_DOCBUILDER.ELEMENT := NULL;
1657 l_prompt VARCHAR2(30);
1658 BEGIN
1659 -- Creates the top region and sets it as the top level element in the document
1660 -- p_layout can be stackLayout or table layout for top regions
1661
1662 -- Bug 4506769. OA Framework Integration. UT bug fix.
1663 -- Personalization text incorrect.
1664 -- srhariha. Fri Aug 26 05:13:34 PDT 2005.
1665
1666 if (p_layout = 'table') then
1667 l_prompt := get_region_prompt('DATA');
1668 -- 12.1 Inline region project
1669 -- saugupta
1670 elsif ( p_layout = 'advancedTable' ) then
1671 l_prompt := get_region_prompt('DATA');
1672 end if;
1673
1674 l_top_region := create_jrad_region (p_top_region_code, p_layout,l_prompt, null);
1675 JDR_DOCBUILDER.setTopLevelElement(p_top_doc, l_top_region);
1676
1677 -- 12.1 Inline region project
1678 -- saugupta
1679 if ( p_layout = 'advancedTable' ) then
1680 -- found code bug, regionName appearing twice in the final XML
1681 -- saugupta
1682 -- JDR_DOCBUILDER.setAttribute(l_top_region, 'regionName', l_prompt);
1683 JDR_DOCBUILDER.setAttribute(l_top_region, 'viewName', g_vo_name);
1684 -- JDR_DOCBUILDER.setAttribute(l_top_region, 'detailViewAttr', 'HideShowStatus');
1685 end if;
1686
1687 RETURN l_top_region;
1688
1689 END create_and_set_top_element;
1690
1691 --
1692 -- MOAC Project. 4637896
1693 -- Rewrote the code for MOAC.
1694 -- srhariha. Tue Oct 11 04:22:16 PDT 2005.
1695 --
1696
1697
1698 -- Returns no of plan chars added to the region
1699
1700 FUNCTION add_plan_chars_to_region(
1701 p_plan_id IN NUMBER,
1702 p_content_region IN JDR_DOCBUILDER.ELEMENT,
1703 p_mode IN VARCHAR2,
1704 p_char_type IN VARCHAR2,
1705 p_parent_region_prefix IN VARCHAR2 DEFAULT NULL) RETURN NUMBER IS
1706
1710 l_id_item JDR_DOCBUILDER.ELEMENT := NULL;
1707 char_count NUMBER := 0;
1708 l_char_item JDR_DOCBUILDER.ELEMENT := NULL;
1709 -- MOAC
1711
1712 l_element_prefix VARCHAR2(15) := g_element_prefix;
1713
1714 l_api_name CONSTANT VARCHAR2(50) := 'ADD_PLAN_CHARS_TO_REGION';
1715
1716 CURSOR c IS
1717 SELECT qpc.char_id
1718 FROM qa_plan_chars qpc,
1719 qa_chars qc
1720 WHERE qc.char_id = qpc.char_id
1721 AND qpc.enabled_flag = 1
1722 AND qpc.plan_id = p_plan_id
1723 AND ((p_char_type = 'NonComments' AND qc.datatype <> g_comments_datatype) OR
1724 (p_char_type = 'Comments' AND qc.datatype = g_comments_datatype))
1725 ORDER BY QPC.prompt_sequence;
1726
1727
1728
1729 BEGIN
1730 IF p_parent_region_prefix = g_eqr_mult_dtl_prefix THEN
1731 l_element_prefix := g_dtl_element_prefix;
1732 END IF;
1733
1734
1735 -- p_mode can be EQR, VQR. Attribute properties are different for the modes
1736 -- p_char_type can be NonComments and Comments.
1737 -- 'NonComments' is passed in when processing data region.
1738 -- 'Comments' is passed in when processing comments region.
1739
1740 FOR r in c LOOP
1741 IF p_mode = g_vqr_single_layout THEN
1742 l_char_item := create_region_item_for_vqr(p_plan_id,r.char_id,
1743 l_element_prefix);
1744 add_child_to_parent(p_content_region, l_char_item, 'contents');
1745 -- 12.1 Inline Region Project
1746 -- saugupta
1747 ELSIF p_mode = g_eqr_advtable_layout THEN
1748 log_error(g_pkg_name || l_api_name,
1749 'Creating adv table item for: ' || to_char(r.char_id));
1750 l_char_item := create_item_for_advtable(p_plan_id, r.char_id, l_element_prefix);
1751 add_child_to_parent(p_content_region, l_char_item, 'contents');
1752 ELSE
1753 l_char_item := create_region_item_for_eqr(p_plan_id, r.char_id,
1754 l_element_prefix, p_mode);
1755 add_child_to_parent(p_content_region, l_char_item, 'contents');
1756 -- Bug 4691416. MOAC project. UT bug fix.
1757 -- Dont add id field to multi detail region.
1758 -- srhariha. Thu Oct 20 22:18:41 PDT 2005.
1759
1760 -- For MOAC : add normalized column.
1761 --
1762 -- bug 5383667
1763 -- Added the conditon for Party name
1764 -- ntungare
1765 --
1766 -- Requires code addition for Adanced Table
1767 -- todo saugupta
1768 IF (r.char_id = qa_ss_const.po_number OR
1769 r.char_id = qa_ss_const.party_name) AND
1770 (p_parent_region_prefix <> g_eqr_mult_dtl_prefix OR
1771 p_parent_region_prefix IS NULL) THEN
1772 l_id_item := create_id_item_for_eqr(p_plan_id,r.char_id);
1773 add_child_to_parent(p_content_region, l_id_item, 'contents');
1774 END IF;
1775 END IF;
1776 char_count := char_count + 1;
1777 END LOOP;
1778
1779
1780 RETURN char_count;
1781
1782 END add_plan_chars_to_region;
1783
1784
1785
1786 PROCEDURE add_special_chars_to_region(
1787 p_plan_id IN NUMBER,
1788 p_content_region IN JDR_DOCBUILDER.ELEMENT,
1789 p_mode IN VARCHAR2,
1790 p_parent_region_prefix IN VARCHAR2 DEFAULT NULL) IS
1791
1792 l_char_item JDR_DOCBUILDER.ELEMENT := NULL;
1793 l_item_style VARCHAR2(30) := null;
1794 l_element_prefix VARCHAR2(15) := g_element_prefix;
1795 BEGIN
1796
1797 IF p_parent_region_prefix = g_eqr_mult_dtl_prefix THEN
1798 l_element_prefix := g_dtl_element_prefix;
1799 END IF;
1800
1801 -- p_mode can be EQR or VQR.
1802 -- if EQR
1803 -- add special chars like org_id, org_code, plan_id, plan_name, po_agent_id
1804 -- I am not adding process_status, source_code, source_line_id. They were used
1805 -- in older versions when self service results were processed as in import.
1806 -- if VQR add created by, collection id, last update date.
1807
1808 If p_mode = g_eqr_single_layout then
1809
1810 l_item_style := 'formValue';
1811
1812 l_char_item := create_special_region_item (
1813 p_attribute_code => g_org_id_attribute,
1814 p_item_style => l_item_style,
1815 p_element_prefix => l_element_prefix);
1816 add_child_to_parent(p_content_region, l_char_item, 'contents');
1817
1818 l_char_item := create_special_region_item (
1819 p_attribute_code => g_plan_id_attribute,
1820 p_item_style => l_item_style,
1821 p_element_prefix => l_element_prefix);
1822 add_child_to_parent(p_content_region, l_char_item, 'contents');
1823
1824 elsif p_mode = g_eqr_multiple_layout then
1825
1826 l_item_style := 'formValue';
1827
1828 l_char_item := create_special_region_item (
1829 p_attribute_code => g_org_id_attribute,
1830 p_item_style => l_item_style,
1831 p_element_prefix => l_element_prefix);
1832 add_child_to_parent(p_content_region, l_char_item, 'contents');
1833
1834 l_char_item := create_special_region_item (
1835 p_attribute_code => g_plan_id_attribute,
1836 p_item_style => l_item_style,
1837 p_element_prefix => l_element_prefix);
1838 add_child_to_parent(p_content_region, l_char_item, 'contents');
1839
1840 l_item_style := 'attachmentImage';
1841
1842 l_char_item := create_special_region_item (
1843 p_attribute_code => g_multi_row_attachment,
1844 p_item_style => l_item_style,
1845 p_element_prefix => l_element_prefix);
1846 add_child_to_parent(p_content_region, l_char_item, 'contents');
1847
1848 elsif p_mode = g_vqr_single_layout then
1849
1850 l_item_style := 'messageStyledText';
1851
1852 l_char_item := create_special_region_item (
1853 p_attribute_code => g_qa_created_by_attribute,
1854 p_item_style => l_item_style,
1855 p_element_prefix => l_element_prefix);
1856 add_child_to_parent(p_content_region, l_char_item, 'contents');
1857
1858 l_char_item := create_special_region_item (
1859 p_attribute_code => g_collection_id_attribute,
1860 p_item_style => l_item_style,
1861 p_element_prefix => l_element_prefix);
1862 add_child_to_parent(p_content_region, l_char_item, 'contents');
1863
1864 l_char_item := create_special_region_item (
1865 p_attribute_code => g_last_update_date_attribute,
1866 p_item_style => l_item_style,
1867 p_element_prefix => l_element_prefix);
1868 add_child_to_parent(p_content_region, l_char_item, 'contents');
1869
1870 end if;
1871
1872 END add_special_chars_to_region;
1873
1874
1875
1876 FUNCTION create_data_region(
1877 p_plan_id IN NUMBER,
1878 p_data_region_code IN VARCHAR2,
1879 p_mode IN VARCHAR2,
1880 p_parent_region_prefix IN VARCHAR2 DEFAULT NULL) RETURN JDR_DOCBUILDER.ELEMENT IS
1881
1882 l_data_region JDR_DOCBUILDER.ELEMENT := NULL;
1883 l_prompt VARCHAR2(30) := null;
1884 l_char_count NUMBER := null;
1885
1886 BEGIN
1887 -- create data region
1888 -- loop thru enabled plan elements that are not of type 'comment'
1889 -- create element region items and add to data region
1890 -- add special chars to the data region
1891 -- return data region
1892 -- p_mode can be EQR or VQR.
1893
1894
1895 if p_mode = g_eqr_multiple_layout then
1896 l_prompt := null;
1897 else
1898 l_prompt := get_region_prompt('DATA');
1899 end if;
1900
1901
1902 /*
1903 l_data_region := create_jrad_region(p_data_region_code, 'defaultDoubleColumn',
1904 l_prompt);
1905 */
1906 if p_parent_region_prefix = g_eqr_mult_dtl_prefix then
1907 l_data_region := create_jrad_region(p_data_region_code, 'labeledFieldLayout',
1908 l_prompt, '2');
1909 else
1910 l_data_region := create_jrad_region(p_data_region_code, 'defaultDoubleColumn',
1911 l_prompt, '-1');
1912 end if;
1913
1914 l_char_count := add_plan_chars_to_region(p_plan_id, l_data_region,
1915 p_mode, 'NonComments',
1916 p_parent_region_prefix);
1917 IF p_parent_region_prefix is null or
1918 p_parent_region_prefix <> g_eqr_mult_dtl_prefix THEN
1919 add_special_chars_to_region(p_plan_id, l_data_region, p_mode,
1920 p_parent_region_prefix);
1921 END IF;
1922
1923 RETURN l_data_region;
1924
1925 END create_data_region;
1926
1927
1928
1929 FUNCTION create_comments_region(
1930 p_plan_id IN NUMBER,
1931 p_comments_region_code IN VARCHAR2,
1932 p_mode IN VARCHAR2,
1933 p_parent_region_prefix IN VARCHAR2 DEFAULT NULL)
1934 RETURN JDR_DOCBUILDER.ELEMENT IS
1935
1936 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
1937 l_prompt VARCHAR2(30) := null;
1938 l_char_count NUMBER := null;
1939
1940 BEGIN
1941 -- create comments region
1942 -- loop thru enabled plan elements that are of type 'comment'
1943 -- create element region items and add to comments region
1944 -- return comments region
1945 -- p_mode can be EQR or VQR.
1946
1947 if p_mode = g_eqr_multiple_layout then
1948 l_prompt := null;
1949 else
1950 l_prompt := get_region_prompt('COMMENTS');
1951 end if;
1952
1953 if p_parent_region_prefix = g_eqr_mult_dtl_prefix then
1954 l_comments_region := create_jrad_region(p_comments_region_code,
1955 'labeledFieldLayout', l_prompt, '1');
1956 else
1957 l_comments_region := create_jrad_region(p_comments_region_code,
1958 'defaultSingleColumn', l_prompt, '-1');
1959 end if;
1960
1961 l_char_count := add_plan_chars_to_region(p_plan_id,
1962 l_comments_region, p_mode, 'Comments',
1963 p_parent_region_prefix);
1964
1965 if l_char_count = 0 then
1966 l_comments_region.id := null;
1967 end if;
1968
1969 RETURN l_comments_region;
1970
1971 END create_comments_region;
1972
1973
1974 FUNCTION create_attachments_region(p_plan_id IN NUMBER,
1975 p_mode IN VARCHAR2)
1976 RETURN JDR_DOCBUILDER.ELEMENT IS
1977
1978 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
1979 l_prompt VARCHAR2(30) := null;
1980 l_char_count NUMBER := null;
1981
1982 l_row_id VARCHAR2(30);
1983 l_element_id NUMBER;
1984 l_region_code VARCHAR2(30);
1985 --l_nested_region_code VARCHAR2(30) DEFAULT null;
1986 l_item_style VARCHAR2(30) DEFAULT 'formValue';
1987 --l_display_sequence NUMBER;
1988 --l_display_flag VARCHAR2(1) DEFAULT 'Y';
1989 --l_update_flag VARCHAR2(1) DEFAULT 'Y';
1990 l_view_attribute_name VARCHAR2(30) DEFAULT NULL;
1991 l_view_usage_name VARCHAR2(30) DEFAULT NULL;
1992 l_label_long VARCHAR2(30) DEFAULT NULL;
1993 l_entity_id VARCHAR2(30) DEFAULT NULL;
1994 l_url VARCHAR2(240) DEFAULT NULL;
1995 l_image_file_name VARCHAR2(240) DEFAULT NULL;
1996 l_description VARCHAR2(240) DEFAULT NULL;
1997 --l_query_flag VARCHAR2(1) DEFAULT 'N';
1998
1999 special_elem jdr_docbuilder.ELEMENT := NULL;
2000 l_entityMap jdr_docbuilder.ELEMENT := NULL;
2001
2002 err_num NUMBER;
2003 err_msg VARCHAR2(100);
2004 l_attachments_region JDR_DOCBUILDER.ELEMENT := NULL;
2005
2006
2007 BEGIN
2008 -- create comments region
2009 -- loop thru enabled plan elements that are of type 'comment'
2010 -- create element region items and add to comments region
2011 -- return comments region
2012 -- p_mode can be EQR or VQR.
2013
2014 l_prompt := get_region_prompt('ATTACHMENTS');
2015
2016 l_attachments_region := create_jrad_region('QA_SSQR_E_ATTACHMENTS',
2017 'defaultSingleColumn', l_prompt, '-1');
2018 -- added for attachments
2019 l_entity_id := 'QA_RESULTS';
2020
2021 l_view_attribute_name := '';
2022 l_label_long := fnd_message.get_string('QA', 'QA_SS_JRAD_ATTACHMENT');
2023 l_description := l_label_long;
2024
2025 --l_item_style := 'attachmentImage';
2026 l_item_style := 'attachmentLink';
2027 --special handling for attachments
2028 l_entityMap := jdr_docbuilder.createElement(jdr_docbuilder.OA_NS,
2029 'entityMap');
2030 jdr_docbuilder.setAttribute(l_entityMap, 'entityId', l_entity_id);
2031
2032 -- Bug 6718507
2033 -- in VQR we do not want the user to insert or update Attachements
2037 jdr_docbuilder.setAttribute(l_entityMap, 'insertAllowed', 'false' );
2034 -- ntungare Wed Jan 23 04:20:57 PST 2008
2035 --
2036 IF (p_mode = g_vqr_single_layout) THEN
2038 jdr_docbuilder.setAttribute(l_entityMap, 'updateAllowed', 'false' );
2039 jdr_docbuilder.setAttribute(l_entityMap, 'deleteAllowed', 'false' );
2040 END IF;
2041
2042 special_elem := jdr_docbuilder.createElement(jdr_docbuilder.OA_NS,
2043 l_item_style);
2044 jdr_docbuilder.setAttribute(special_elem, 'id', 'AK_ATTACHMENT_LINK' );
2045 jdr_docbuilder.setAttribute(special_elem, 'viewName', 'QualityResultsVO' );
2046
2047 -- in VQR we do not want to user to insert or update Attachements
2048 IF (p_mode = g_vqr_single_layout) THEN
2049 jdr_docbuilder.setAttribute(special_elem, 'insertAllowed', 'false' );
2050 jdr_docbuilder.setAttribute(special_elem, 'updateAllowed', 'false' );
2051 jdr_docbuilder.setAttribute(special_elem, 'deleteAllowed', 'false' );
2052
2053
2054 END IF;
2055
2056
2057 jdr_docbuilder.addChild(special_elem, jdr_docbuilder.OA_NS,
2058 'entityMappings', l_entityMap);
2059
2060 JDR_DOCBUILDER.addChild(l_attachments_region, JDR_DOCBUILDER.UI_NS,
2061 'contents', special_elem);
2062
2063 /*
2064 IF ( instr(p_prefix, g_vqr_prefix) = 1) THEN
2065 --l_update_flag := 'N';
2066 null;
2067 END IF;
2068 */
2069
2070 RETURN l_attachments_region;
2071
2072 END create_attachments_region;
2073
2074 --12.1 Inline Project Start
2075
2076 FUNCTION create_detail_region(
2077 p_plan_id IN NUMBER,
2078 p_dtl_region_code IN VARCHAR2,
2079 p_mode IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
2080
2081 l_data_region_code VARCHAR2(35);
2082 l_comments_region_code VARCHAR2(35);
2083
2084 l_dtl_region JDR_DOCBUILDER.ELEMENT := NULL;
2085 l_data_region JDR_DOCBUILDER.ELEMENT := NULL;
2086 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
2087
2088 l_prompt VARCHAR2(30) := null;
2089 l_char_count NUMBER := null;
2090
2091 BEGIN
2092 -- create data region
2093 -- loop thru enabled plan elements that are not of type 'comment'
2094 -- create element region items and add to data region
2095 -- add special chars to the data region
2096 -- return data region
2097 -- p_mode can be EQR or VQR.
2098
2099 l_prompt := null;
2100 l_data_region_code := construct_code(g_eqr_data_prefix, p_plan_id);
2101 l_comments_region_code := construct_code(g_eqr_comments_prefix, p_plan_id);
2102
2103 l_dtl_region := create_jrad_region(p_dtl_region_code, 'stackLayout',
2104 l_prompt, '-1');
2105
2106 -- create data and comments regions and add them as children to the detail region
2107
2108 l_data_region := create_data_region(p_plan_id, l_data_region_code, p_mode, g_eqr_mult_dtl_prefix);
2109 add_child_to_parent(l_dtl_region, l_data_region, 'contents');
2110
2111 l_comments_region := create_comments_region(p_plan_id, l_comments_region_code,
2112 p_mode, g_eqr_mult_dtl_prefix);
2113 if l_comments_region.id is not null then
2114 add_child_to_parent(l_dtl_region, l_comments_region, 'contents');
2115 end if;
2116
2117 RETURN l_dtl_region;
2118
2119 END create_detail_region;
2120
2121 -- create table action region containing buttons like duplicate and delete
2122 FUNCTION create_table_action_region RETURN jdr_docbuilder.element IS
2123
2124 l_row_layout jdr_docbuilder.element := NULL;
2125 l_text jdr_docbuilder.element := NULL;
2126 l_dup_btn jdr_docbuilder.element := NULL;
2127 l_del_btn jdr_docbuilder.element := NULL;
2128
2129 l_attr_code VARCHAR2(30);
2130
2131 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_TABLE_ACTION_REGION';
2132 l_label VARCHAR2(30);
2133 l_prompt VARCHAR2(50);
2134 l_del_attr_set CONSTANT VARCHAR2(50) := '/oracle/apps/fnd/attributesets/Buttons/Delete';
2135 l_dup_attr_set CONSTANT VARCHAR2(50) := '/oracle/apps/fnd/attributesets/Buttons/Duplicate';
2136
2137
2138 BEGIN
2139 -- create tableAction region items
2140 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2141 -- create rowLayout
2142 l_row_layout := create_jrad_region_item('rowLayout');
2143 jdr_docbuilder.setattribute(l_row_layout, 'id', 'rowLayoutRN'); -- set proper non static id
2144
2145 -- create display text item
2146 l_text := create_jrad_region_item('messageStyledText');
2147 jdr_docbuilder.setattribute(l_text, 'id', 'displayText');
2148 l_label := fnd_message.get_string('QA','QA_TABLE_SELECT_MSG');
2149 jdr_docbuilder.setattribute(l_text, 'prompt', l_label);
2150
2151 --create button
2152 l_dup_btn := create_jrad_region_item('submitButton');
2153 jdr_docbuilder.setattribute(l_dup_btn, 'id', 'dupBtn');
2154
2155 -- do not set prompt with '&' instead use attribute sets
2156 -- l_prompt := fnd_message.get_string('QA','QA_QWB_DUPLICATE_PROMPT');
2157 -- jdr_docbuilder.setattribute(l_dup_btn, 'prompt', DBMS_XMLGEN.convert(l_prompt));
2158 jdr_docbuilder.setattribute(l_dup_btn, 'use', l_dup_attr_set);
2159
2160 jdr_docbuilder.setattribute(l_dup_btn, 'unvalidated', 'true');
2161
2162 --create button
2166 -- do not set prompt with '&' instead use attribute sets
2163 l_del_btn := create_jrad_region_item('submitButton');
2164 jdr_docbuilder.setattribute(l_del_btn, 'id', 'delBtn');
2165
2167 -- l_prompt := fnd_message.get_string('QA','QA_QWB_DELETE_PROMPT');
2168 -- jdr_docbuilder.setattribute(l_del_btn, 'prompt', DBMS_XMLGEN.convert(l_prompt) );
2169 jdr_docbuilder.setattribute(l_del_btn, 'use', l_del_attr_set);
2170
2171 jdr_docbuilder.setattribute(l_del_btn, 'unvalidated', 'true');
2172 -- Bug 6856743 - Set server side validation to false.
2173 jdr_docbuilder.setattribute(l_del_btn, 'serverUnvalidated', 'True');
2174
2175 -- add items to region
2176 add_child_to_parent(l_row_layout, l_text, 'contents');
2177 add_child_to_parent(l_row_layout, l_dup_btn, 'contents');
2178 add_child_to_parent(l_row_layout, l_del_btn, 'contents');
2179
2180 -- rowLayout should be added as a child to table or advanced table
2181 log_error(g_pkg_name || l_api_name, 'Function END');
2182 RETURN l_row_layout;
2183
2184 END create_table_action_region;
2185
2186 -- create table single selection region with radio button
2187 FUNCTION create_table_selection RETURN jdr_docbuilder.element IS
2188
2189 l_sing_select jdr_docbuilder.element := NULL;
2190 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_TABLE_SELECTION';
2191
2192 -- 12.1 Device Integration Project
2193 -- bhsankar Tue Aug 28 04:20:24 PDT 2007
2194 -- For PPR Event
2195 ppr_event jdr_docbuilder.ELEMENT;
2196
2197 BEGIN
2198 -- create tableSelection
2199 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2200 -- create singleSelection
2201 l_sing_select := create_jrad_region_item('singleSelection');
2202 jdr_docbuilder.setattribute(l_sing_select, 'id', 'ResultSelection');
2203 jdr_docbuilder.setattribute(l_sing_select, 'text', ''); -- get it from message
2204 jdr_docbuilder.setattribute(l_sing_select, 'viewAttr', 'SelectFlag');
2205 jdr_docbuilder.setAttribute(l_sing_select, 'unvalidated', 'true');
2206 jdr_docbuilder.setAttribute(l_sing_select, 'serverUnvalidated', 'true');
2207
2208 -- 12.1 Device Integration Project
2209 -- bhsankar Tue Aug 28 04:20:24 PDT 2007
2210 -- For PPR Event
2211 ppr_event := JDR_DOCBUILDER.createElement(p_namespace => JDR_DOCBUILDER.UI_NS,
2212 p_tagName => 'firePartialAction');
2213 jdr_docbuilder.setAttribute(ppr_event, 'event', 'qaselect');
2214 jdr_docbuilder.setAttribute(ppr_event, 'unvalidated', 'true');
2215 jdr_docbuilder.addchild(p_parent => l_sing_select,
2216 p_groupingNS => JDR_DOCBUILDER.UI_NS,
2217 p_groupingTagName => 'primaryClientAction',
2218 p_child => ppr_event);
2219 -- Device Integration Project End.
2220
2221 -- add items to region
2222 -- add it in plan mapping procedure
2223 -- add_child_to_parent(l_sing_select, l_text, 'tableSelection');
2224
2225 -- rowLayout should be added as a child to table or advanced table
2226 log_error(g_pkg_name || l_api_name, 'Function END');
2227 RETURN l_sing_select;
2228
2229 END create_table_selection;
2230
2231 -- create table single selection region with radio button
2232 FUNCTION create_table_footer RETURN jdr_docbuilder.element IS
2233
2234 l_add_btn jdr_docbuilder.element := NULL;
2235 l_footer jdr_docbuilder.element := NULL;
2236 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_TABLE_FOOTER';
2237 l_prompt VARCHAR2(50);
2238
2239 BEGIN
2240 -- create tableSelection
2241 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2242 -- create Button
2243 l_add_btn := create_jrad_region_item('addTableRow');
2244 jdr_docbuilder.setattribute(l_add_btn, 'id', 'addResultRow');
2245 jdr_docbuilder.setattribute(l_add_btn, 'autoInsertion', 'false');
2246
2247 -- l_prompt := fnd_message.get_string('QA','QA_QWB_ADD_PROMPT');
2248 -- jdr_docbuilder.setattribute(l_add_btn, 'prompt', DBMS_XMLGEN.convert(l_prompt));
2249
2250 l_footer := create_jrad_region_item('tableFooter');
2251 jdr_docbuilder.setattribute(l_footer, 'id', 'resultFooter');
2252
2253 -- add button to footer
2254 add_child_to_parent(l_footer, l_add_btn, 'contents');
2255
2256 -- rowLayout should be added as a child to table or advanced table
2257 log_error(g_pkg_name || l_api_name, 'Function END');
2258 RETURN l_footer;
2259
2260 END create_table_footer;
2261
2262 -- add table action to table or advanced table
2263 PROCEDURE add_table_action(p_prnt_elm IN jdr_docbuilder.element ) IS
2264 l_tbl_act jdr_docbuilder.element := NULL;
2265 BEGIN
2266 -- add table actions to table or advanced table
2267 l_tbl_act := create_table_action_region;
2268 add_child_to_parent(p_prnt_elm, l_tbl_act, 'tableActions');
2269 END add_table_action;
2270
2271
2272 -- add table single selection to table or advanced table
2273 PROCEDURE add_table_selection(p_prnt_elm IN jdr_docbuilder.element )IS
2274 l_tbl_s_sel jdr_docbuilder.element := NULL;
2275 BEGIN
2276 -- add ingle selection to table or advanced table
2277 l_tbl_s_sel := create_table_selection;
2278 add_child_to_parent(p_prnt_elm, l_tbl_s_sel, 'tableSelection');
2279 END add_table_selection;
2280
2281
2282 -- add footer to advanced table
2283 PROCEDURE add_table_footer(p_prnt_elm IN jdr_docbuilder.element) IS
2284 l_tbl_footer jdr_docbuilder.element := NULL;
2288 add_child_to_parent(p_prnt_elm, l_tbl_footer, 'footer');
2285 BEGIN
2286 -- add footer to table or advanced table
2287 l_tbl_footer := create_table_footer;
2289 END add_table_footer;
2290
2291 --12.1 Inline Project End
2292
2293 --
2294 -- 12.1 Device Integration Project
2295 -- Functions to create the device region
2296 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
2297 --
2298
2299 PROCEDURE add_device_checkbox_to_parent(
2300 p_plan_id IN NUMBER,
2301 p_parent_region JDR_DOCBUILDER.ELEMENT) IS
2302
2303 l_api_name CONSTANT VARCHAR2(50) := 'ADD_DEVICE_CHECKBOX_TO_PARENT';
2304 l_messageCompLayout JDR_DOCBUILDER.ELEMENT := NULL;
2305 l_char_item JDR_DOCBUILDER.ELEMENT := NULL;
2306 l_prompt VARCHAR2(100);
2307 l_element_prefix VARCHAR2(15) := g_element_prefix;
2308 l_element_suffix VARCHAR2(15) := g_device_element_suffix;
2309 l_attribute_code VARCHAR2(30);
2310
2311 CURSOR c IS
2312 SELECT qpc.char_id
2313 FROM qa_plan_chars qpc,
2314 qa_chars qc,
2315 qa_device_info qdi
2316 WHERE qc.char_id = qpc.char_id
2317 AND nvl(qpc.enabled_flag, 2) = 1
2318 AND nvl(qpc.device_flag, 2) = 1
2319 AND nvl(qpc.displayed_flag, 2) = 1
2320 AND qdi.device_id = qpc.device_id
2321 AND qdi.enabled_flag = 1
2322 AND qpc.plan_id = p_plan_id
2323 ORDER BY qpc.prompt_sequence;
2324
2325 BEGIN
2326 log_error(g_pkg_name || l_api_name, 'Procedure BEGIN');
2327 l_messageCompLayout := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, 'messageComponentLayout');
2328 jdr_docbuilder.setAttribute(l_messageCompLayout, 'id', 'ChkBoxRN');
2329 jdr_docbuilder.setAttribute(l_messageCompLayout, 'rows', '1');
2330 jdr_docbuilder.setAttribute(l_messageCompLayout, 'columns', '4');
2331 log_error(g_pkg_name || l_api_name, 'message componenet layput created');
2332
2333 FOR r in c LOOP
2334 l_char_item := create_jrad_region_item('messageCheckBox');
2335 l_prompt := get_prompt(p_plan_id, r.char_id);
2336 l_attribute_code := construct_code(l_element_prefix, r.char_id, l_element_suffix);
2337
2338 jdr_docbuilder.setAttribute(l_char_item, 'id', l_attribute_code);
2339 jdr_docbuilder.setAttribute(l_char_item, 'prompt', l_prompt);
2340 jdr_docbuilder.setAttribute(l_char_item, 'unvalidated', 'true');
2341 jdr_docbuilder.setAttribute(l_char_item, 'serverUnvalidated', 'true');
2342 jdr_docbuilder.setAttribute(l_char_item, 'checked', 'true');
2343 add_child_to_parent(l_messageCompLayout, l_char_item,'contents');
2344 log_error(g_pkg_name || l_api_name, 'checkbox created for element: ' || l_prompt);
2345 END LOOP;
2346
2347 add_child_to_parent(p_parent_region, l_messageCompLayout,'contents');
2348 log_error(g_pkg_name || l_api_name, 'Procedure END');
2349 END add_device_checkbox_to_parent;
2350
2351 FUNCTION create_device_button_region
2352 RETURN JDR_DOCBUILDER.ELEMENT IS
2353 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_DEVICE_BUTTON_REGION';
2354 l_button_rowlayout_region JDR_DOCBUILDER.ELEMENT := NULL;
2355 l_button_cellformat_region JDR_DOCBUILDER.ELEMENT := NULL;
2356 l_submit_button JDR_DOCBUILDER.ELEMENT := NULL;
2357 l_prompt VARCHAR2(30);
2358
2359 --PPRTEST
2360 ppr_event jdr_docbuilder.ELEMENT;
2361 BEGIN
2362 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2363 l_button_rowlayout_region := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, 'rowLayout');
2364 jdr_docbuilder.setAttribute(l_button_rowlayout_region, 'id', 'ReadButtonRowLayout');
2365 jdr_docbuilder.setAttribute(l_button_rowlayout_region, 'width', '100%');
2366 jdr_docbuilder.setAttribute(l_button_rowlayout_region, 'hAlign', 'end');
2367 jdr_docbuilder.setAttribute(l_button_rowlayout_region, 'vAlign', 'top');
2368
2369 l_button_cellformat_region := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, 'cellFormat');
2370 jdr_docbuilder.setAttribute(l_button_cellformat_region, 'id', 'ReadButtonCellLayout');
2371 jdr_docbuilder.setAttribute(l_button_cellformat_region, 'width', '100%');
2372 jdr_docbuilder.setAttribute(l_button_cellformat_region, 'hAlign', 'end');
2373 jdr_docbuilder.setAttribute(l_button_cellformat_region, 'vAlign', 'top');
2374
2375 l_submit_button := create_jrad_region_item('submitButton');
2376 l_prompt := DBMS_XMLGEN.convert(fnd_message.get_string('QA','QA_QWB_READ_DEV_BUTTON_LABEL'));
2377 jdr_docbuilder.setAttribute(l_submit_button, 'id', 'ReadDeviceButton');
2378 jdr_docbuilder.setAttribute(l_submit_button, 'prompt', l_prompt);
2379 jdr_docbuilder.setAttribute(l_submit_button, 'unvalidated', 'true');
2380 -- bug 6737113
2381 -- Added accessKey for Read Device as O.
2382 -- bhsankar Tue Jan 22 04:12:09 PST 2008
2383 jdr_docbuilder.setAttribute(l_submit_button, 'accessKey', '0');
2384 jdr_docbuilder.setAttribute(l_submit_button, 'serverUnvalidated', 'true');
2385
2386 --For PPR
2387 ppr_event := JDR_DOCBUILDER.createElement(p_namespace => JDR_DOCBUILDER.UI_NS,
2388 p_tagName => 'firePartialAction');
2389 jdr_docbuilder.setAttribute(ppr_event, 'event', 'qadevice');
2390 jdr_docbuilder.setAttribute(ppr_event, 'unvalidated', 'true');
2391
2392 jdr_docbuilder.addchild(p_parent => l_submit_button,
2393 p_groupingNS => JDR_DOCBUILDER.UI_NS,
2394 p_groupingTagName => 'primaryClientAction',
2395 p_child => ppr_event);
2396
2397 add_child_to_parent(l_button_cellformat_region,l_submit_button,'contents');
2398 add_child_to_parent(l_button_rowlayout_region,l_button_cellformat_region,'contents');
2399 log_error(g_pkg_name || l_api_name, 'Function END');
2400 return l_button_rowlayout_region;
2401
2402 END create_device_button_region;
2403
2404 FUNCTION create_device_checkbox_region(
2405 p_plan_id IN NUMBER) RETURN JDR_DOCBUILDER.ELEMENT IS
2406
2407 l_rowlayout_region JDR_DOCBUILDER.ELEMENT := NULL;
2408 l_cellformat_region JDR_DOCBUILDER.ELEMENT := NULL;
2409 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_DEVICE_CHECKBOX_REGION';
2410 BEGIN
2411 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2412 l_rowlayout_region := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, 'rowLayout');
2413 jdr_docbuilder.setAttribute(l_rowlayout_region, 'id', 'ChkBoxRowLayout');
2414 jdr_docbuilder.setAttribute(l_rowlayout_region, 'width', '100%');
2415
2416 l_cellformat_region := JDR_DOCBUILDER.createElement(JDR_DOCBUILDER.OA_NS, 'cellFormat');
2417 jdr_docbuilder.setAttribute(l_cellformat_region, 'id', 'ChkBoxCellFormat');
2418 jdr_docbuilder.setAttribute(l_cellformat_region, 'width', '100%');
2419
2420 add_device_checkbox_to_parent(p_plan_id, l_cellformat_region);
2421 add_child_to_parent(l_rowlayout_region,l_cellformat_region,'contents');
2422 log_error(g_pkg_name || l_api_name, 'Function END');
2423 return l_rowlayout_region;
2424
2425 END create_device_checkbox_region;
2426
2427 FUNCTION create_device_region(
2428 p_plan_id IN NUMBER,
2429 p_device_region_code IN VARCHAR2 DEFAULT g_eqr_device_prefix,
2430 p_parent_region_prefix IN VARCHAR2 DEFAULT NULL) RETURN JDR_DOCBUILDER.ELEMENT IS
2431 l_api_name CONSTANT VARCHAR2(50) := 'CREATE_DEVICE_REGION';
2432 l_device_region_hdr JDR_DOCBUILDER.ELEMENT := NULL;
2433 l_table_layout_region JDR_DOCBUILDER.ELEMENT := NULL;
2434 l_button_region JDR_DOCBUILDER.ELEMENT := NULL;
2435 l_checkbox_region JDR_DOCBUILDER.ELEMENT := NULL;
2436
2437 l_prompt VARCHAR2(100) := null;
2438
2439
2440 BEGIN
2441 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2442 l_prompt := get_region_prompt('DEVICE');
2443 log_error(g_pkg_name || l_api_name, 'Device prompt: ' || l_prompt );
2444 l_device_region_hdr := create_jrad_region(p_device_region_code, 'header', l_prompt, '-1');
2445 log_error(g_pkg_name || l_api_name,'p_device_region_code :' || p_device_region_code );
2446 l_table_layout_region := create_jrad_region('DeviceTabLayout', 'tableLayout', '', '-1');
2447
2448 log_error(g_pkg_name || l_api_name, 'Device table layout created');
2449
2450 l_button_region := create_device_button_region();
2451 add_child_to_parent(l_table_layout_region,l_button_region,'contents');
2452
2453 log_error(g_pkg_name || l_api_name, 'Device read button created');
2454
2455 l_checkbox_region := create_device_checkbox_region(p_plan_id);
2456 add_child_to_parent(l_table_layout_region,l_checkbox_region,'contents');
2457
2458 log_error(g_pkg_name || l_api_name, 'Device checkbox region created');
2459
2460 add_child_to_parent(l_device_region_hdr,l_table_layout_region,'contents');
2461 log_error(g_pkg_name || l_api_name, 'Function END');
2462 RETURN l_device_region_hdr;
2463
2464 END create_device_region;
2465
2466 -- 12.1 Device Integration Project End.
2467
2468 PROCEDURE map_plan_eqr_single(
2469 p_plan_id IN NUMBER,
2470 p_special_segment VARCHAR2) IS
2471
2472 l_top_region_code VARCHAR2(35);
2473 l_data_region_code VARCHAR2(35);
2474 l_comments_region_code VARCHAR2(35);
2475
2476 l_mode VARCHAR2(15) := g_eqr_single_layout;
2477 l_saved PLS_INTEGER;
2478 l_err_num NUMBER;
2479 l_err_msg VARCHAR2(100);
2480
2481 l_top_doc JDR_DOCBUILDER.DOCUMENT := NULL;
2482 l_top_region JDR_DOCBUILDER.ELEMENT := NULL;
2483 l_data_region JDR_DOCBUILDER.ELEMENT := NULL;
2484 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
2485 l_attachments_region JDR_DOCBUILDER.ELEMENT := NULL;
2486
2487 --
2488 -- 12.1 Device Integration Project
2489 -- Functions to create the device region
2490 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
2491 --
2492 l_device_region_code VARCHAR2(35) := NULL;
2493 l_device_region JDR_DOCBUILDER.ELEMENT := NULL;
2494 l_api_name CONSTANT VARCHAR2(50) := 'map_plan_eqr_single';
2495
2496 BEGIN
2497 -- this version of map_plan_eqr_single takes in prefix of top region, data region and comment region
2498 -- The top region contains the data, comment regions. Attachment region is a
2499 -- static region taken care of at run time. Not adding attachments here.
2500 -- A document is created with the top region as its top level element
2501 -- The top region is a stack layout for a single row layout.
2502 -- Deleting the top document should delete the existing regions for the plan.
2503
2504 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
2505
2506 l_top_region_code := construct_code(g_eqr_single_prefix || p_special_segment, p_plan_id);
2507 l_data_region_code := construct_code(g_eqr_data_prefix || p_special_segment, p_plan_id);
2511 delete_old_top_document(g_jrad_region_path || l_top_region_code);
2508 l_device_region_code := construct_code(g_eqr_device_prefix || p_special_segment, p_plan_id);
2509 l_comments_region_code := construct_code(g_eqr_comments_prefix || p_special_segment, p_plan_id);
2510
2512
2513 l_top_doc := create_top_document(g_jrad_region_path || l_top_region_code);
2514 l_top_region := create_and_set_top_element(l_top_doc, l_top_region_code,
2515 'stackLayout');
2516 --
2517 -- 12.1 Device Integration Project
2518 -- Functions to create the device region
2519 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
2520 --
2521 -- Creating the device region if MES is uptaken
2522
2523 log_error(g_pkg_name || l_api_name, ' Creating device region');
2524
2525 IF FND_PROFILE.VALUE('WIP_MES_OPS_FLAG') = 1 THEN
2526 l_device_region := create_device_region(p_plan_id, l_device_region_code);
2527 IF l_device_region.id is not null THEN
2528 add_child_to_parent(l_top_region, l_device_region, 'contents');
2529 END IF;
2530 END IF;
2531
2532 log_error(g_pkg_name || l_api_name, ' Device region created');
2533
2534 -- 12.1 Device Integration Project End.
2535
2536 -- create data and comments regions and add them as children to the top region
2537
2538 l_data_region := create_data_region(p_plan_id, l_data_region_code, l_mode);
2539 add_child_to_parent(l_top_region, l_data_region, 'contents');
2540
2541 l_comments_region := create_comments_region(p_plan_id, l_comments_region_code,
2542 l_mode);
2543 if l_comments_region.id is not null then
2544 add_child_to_parent(l_top_region, l_comments_region, 'contents');
2545 end if;
2546
2547 l_attachments_region := create_attachments_region(p_plan_id, '');
2548 IF l_attachments_region.id is not null THEN
2549 add_child_to_parent(l_top_region, l_attachments_region, 'contents');
2550 END IF;
2551
2552 -- save the document
2553 l_saved := JDR_DOCBUILDER.SAVE;
2554
2555 log_error(g_pkg_name || l_api_name, ' Function END');
2556
2557 EXCEPTION
2558
2559 WHEN OTHERS THEN
2560 l_err_num := SQLCODE;
2561 l_err_msg := SUBSTR(SQLERRM, 1, 100);
2562 log_error(g_pkg_name || l_api_name, 'EXCEPTION : ' || l_err_msg);
2563
2564 END map_plan_eqr_single;
2565
2566 PROCEDURE map_plan_eqr_single(
2567 p_plan_id IN NUMBER) IS
2568
2569 BEGIN
2570 -- this is a wrapper to map_plan_eqr_single (p_plan_id, <special segment string>)
2571 -- in this case, special segment is null
2572 map_plan_eqr_single(p_plan_id, NULL);
2573
2574 END map_plan_eqr_single;
2575
2576
2577 PROCEDURE map_plan_vqr_single(
2578 p_plan_id IN NUMBER,
2579 p_special_segment VARCHAR2) IS
2580
2581 l_top_region_code VARCHAR2(35);
2582 l_data_region_code VARCHAR2(35);
2583 l_comments_region_code VARCHAR2(35);
2584
2585 l_mode VARCHAR2(15) := g_vqr_single_layout;
2586 l_saved PLS_INTEGER;
2587 l_err_num NUMBER;
2588 l_err_msg VARCHAR2(100);
2589
2590 l_top_doc JDR_DOCBUILDER.DOCUMENT := NULL;
2591 l_top_region JDR_DOCBUILDER.ELEMENT := NULL;
2592 l_data_region JDR_DOCBUILDER.ELEMENT := NULL;
2593 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
2594 l_attachments_region JDR_DOCBUILDER.ELEMENT := NULL;
2595
2596 BEGIN
2597 -- Similar to map_plan_eqr_single logic
2598
2599 -- The top region contains the data, comment regions. Attachment region is a
2600 -- static region taken care of at run time. Not adding attachments here.
2601 -- A document is created with the top region as its top level element
2602 -- The top region is a stack layout for a single row layout.
2603 -- Deleting the top document should delete the existing regions for the plan.
2604
2605 l_top_region_code := construct_code(g_vqr_single_prefix || p_special_segment, p_plan_id);
2606 l_data_region_code := construct_code(g_vqr_data_prefix || p_special_segment, p_plan_id);
2607 l_comments_region_code := construct_code(g_vqr_comments_prefix || p_special_segment, p_plan_id);
2608
2609 delete_old_top_document(g_jrad_region_path || l_top_region_code);
2610
2611 l_top_doc := create_top_document(g_jrad_region_path || l_top_region_code);
2612 l_top_region := create_and_set_top_element(l_top_doc, l_top_region_code,
2613 'stackLayout');
2614
2615 -- create data and comments regions and add them as children to the top region
2616
2617 l_data_region := create_data_region(p_plan_id, l_data_region_code, l_mode);
2618 add_child_to_parent(l_top_region, l_data_region, 'contents');
2619
2620 l_comments_region := create_comments_region(p_plan_id, l_comments_region_code,
2621 l_mode);
2622 if l_comments_region.id is not null then
2623 add_child_to_parent(l_top_region, l_comments_region, 'contents');
2624 end if;
2625
2626 l_attachments_region := create_attachments_region(p_plan_id, l_mode);
2627 IF l_attachments_region.id is not null THEN
2628 add_child_to_parent(l_top_region, l_attachments_region, 'contents');
2629 END IF;
2630
2631 -- save the document
2632 l_saved := JDR_DOCBUILDER.SAVE;
2633
2637 l_err_num := SQLCODE;
2634 EXCEPTION
2635
2636 WHEN OTHERS THEN
2638 l_err_msg := SUBSTR(SQLERRM, 1, 100);
2639 -- dbms_output.put_line(err_msg);
2640
2641 END map_plan_vqr_single;
2642
2643 PROCEDURE map_plan_vqr_single(
2644 p_plan_id IN NUMBER) IS
2645
2646 BEGIN
2647 -- this is a wrapper to map_plan_vqr_single (p_plan_id, <special segment string>)
2648 -- in this case, special segment is null
2649 map_plan_vqr_single(p_plan_id, NULL);
2650
2651 END map_plan_vqr_single;
2652
2653
2654
2655
2656 -- 12.1 Usability project
2657 -- added for export page
2658 -- abgangul
2659 FUNCTION get_export_vo_attribute_name(p_plan_id NUMBER , p_char_id NUMBER)
2660 RETURN VARCHAR2 IS
2661
2662 l_vo_attr_name VARCHAR2(50);
2663 BEGIN
2664 select upper(translate(qc.name,' ''*{}','_____'))
2665 into l_vo_attr_name
2666 from qa_chars qc,
2667 qa_plan_chars qpc
2668 where qc.char_id = qpc.char_id
2669 and qpc.plan_id = p_plan_id
2670 and qpc.char_id = p_char_id;
2671
2672 return l_vo_attr_name;
2673 END get_export_vo_attribute_name;
2674
2675
2676
2677 FUNCTION get_hc_export_vo_attr_name (p_attribute_name VARCHAR2)
2678 RETURN VARCHAR2 IS
2679
2680 BEGIN
2681 if p_attribute_name = g_qa_created_by_attribute then
2682 return 'CREATED_BY';
2683 elsif p_attribute_name = g_collection_id_attribute then
2684 return 'COLLECTION_ID';
2685 elsif p_attribute_name = g_last_update_date_attribute then
2686 return 'LAST_UPDATE_DATE';
2687 else
2688 return null;
2689 end if;
2690
2691 END get_hc_export_vo_attr_name;
2692
2693
2694 FUNCTION create_item_for_mult_vqr( p_plan_id IN NUMBER,
2695 p_char_id IN NUMBER,
2696 x_char_item OUT NOCOPY JDR_DOCBUILDER.ELEMENT,
2697 x_char_dtl_item OUT NOCOPY JDR_DOCBUILDER.ELEMENT)
2698 RETURN VARCHAR2 IS
2699
2700 l_vo_attribute_name VARCHAR2(50);
2701 l_attr_code VARCHAR2(50);
2702 l_col_code VARCHAR2(50);
2703 l_hrd_code VARCHAR2(50);
2704 l_prompt VARCHAR2(50);
2705 c_displayed_flag VARCHAR2(50);
2706 c_datatype VARCHAR2(30);
2707
2708 l_displayed_flag NUMBER;
2709
2710 l_col_hdr JDR_DOCBUILDER.ELEMENT;
2711 l_char_item JDR_DOCBUILDER.ELEMENT;
2712 l_char_dtl_item JDR_DOCBUILDER.ELEMENT;
2713 l_sort_hdr JDR_DOCBUILDER.ELEMENT;
2714
2715 l_datatype qa_chars.datatype%TYPE;
2716
2717
2718 BEGIN
2719 l_attr_code := construct_code(g_element_prefix, p_char_id);
2720 l_col_code := 'column' || l_attr_code;
2721 l_col_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'column');
2722 jdr_docbuilder.setattribute(l_col_hdr, 'id', l_col_code);
2723
2724
2725 l_char_item := create_region_item_for_vqr(p_plan_id, p_char_id,
2726 g_element_prefix, g_vqr_multiple_layout);
2727 l_char_dtl_item := create_region_item_for_vqr(p_plan_id, p_char_id,
2728 g_dtl_element_prefix, g_vqr_multiple_layout);
2729
2730 l_vo_attribute_name := get_export_vo_attribute_name(p_plan_id, p_char_id);
2731 jdr_docbuilder.setAttribute(l_char_item, 'viewName', g_export_vo_name);
2732 jdr_docbuilder.setAttribute(l_char_item, 'viewAttr', l_vo_attribute_name);
2733 jdr_docbuilder.setAttribute(l_char_dtl_item, 'viewName', g_export_vo_name);
2734 jdr_docbuilder.setAttribute(l_char_dtl_item, 'viewAttr', l_vo_attribute_name);
2735
2736 jdr_docbuilder.setAttribute(l_char_item, 'sortable', 'true');
2737 jdr_docbuilder.setAttribute(l_char_dtl_item, 'sortable', 'true');
2738 jdr_docbuilder.setAttribute(l_col_hdr, 'sortable' , 'true');
2739
2740
2741 add_child_to_parent(l_col_hdr, l_char_item, 'contents');
2742
2743 l_hrd_code := 'colHdr' || l_attr_code;
2744 l_sort_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'sortableHeader');
2745 jdr_docbuilder.setAttribute(l_sort_hdr, 'id', l_hrd_code);
2746 l_prompt := get_prompt(p_plan_id, p_char_id);
2747 jdr_docbuilder.setAttribute(l_sort_hdr, 'prompt', l_prompt);
2748 jdr_docbuilder.setAttribute(l_sort_hdr, 'sortable' , 'yes');
2749 jdr_docbuilder.setAttribute(l_sort_hdr, 'sortState' , 'yes');
2750 add_child_to_parent(l_col_hdr, l_sort_hdr, 'columnHeader');
2751
2752 l_datatype := qa_chars_api.datatype(p_char_id);
2753 c_datatype := convert_data_type(l_datatype);
2754 jdr_docbuilder.setAttribute(l_char_dtl_item, 'styleClass', 'OraTableDetail');
2755
2756 -- jdr_docbuilder.setAttribute(l_char_item, 'dataType', c_datatype);
2757 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'dataType', c_datatype);
2758
2759 x_char_item := l_col_hdr;
2760 x_char_dtl_item := l_char_dtl_item;
2761
2762 l_displayed_flag := qa_plan_element_api.qpc_displayed_flag(p_plan_id, p_char_id);
2763 c_displayed_flag := convert_boolean_flag(l_displayed_flag);
2764
2765 if c_displayed_flag = 'true' then
2769
2766 jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2767 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2768 end if;
2770 return c_displayed_flag;
2771
2772
2773 END create_item_for_mult_vqr;
2774
2775 PROCEDURE create_special_item_mult_vqr( p_attribute_code IN VARCHAR2,
2776 x_char_item OUT NOCOPY JDR_DOCBUILDER.ELEMENT,
2777 x_char_dtl_item OUT NOCOPY JDR_DOCBUILDER.ELEMENT)
2778 IS
2779
2780 l_vo_attribute_name VARCHAR2(50);
2781 l_attr_code VARCHAR2(50);
2782 l_col_code VARCHAR2(50);
2783 l_hrd_code VARCHAR2(50);
2784 l_prompt VARCHAR2(50);
2785
2786 l_col_hdr JDR_DOCBUILDER.ELEMENT;
2787 l_char_item JDR_DOCBUILDER.ELEMENT;
2788 l_char_dtl_item JDR_DOCBUILDER.ELEMENT;
2789 l_sort_hdr JDR_DOCBUILDER.ELEMENT;
2790
2791 BEGIN
2792
2793 l_attr_code := construct_code(g_element_prefix, p_attribute_code);
2794 l_col_code := 'column' || l_attr_code;
2795 l_col_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'column');
2796 jdr_docbuilder.setattribute(l_col_hdr, 'id', l_col_code);
2797
2798 l_char_item := create_special_region_item (p_attribute_code, 'messageStyledText',
2799 g_element_prefix, g_vqr_multiple_layout);
2800 l_char_dtl_item := create_special_region_item (p_attribute_code, 'messageStyledText',
2801 g_dtl_element_prefix, g_vqr_multiple_layout);
2802
2803 jdr_docbuilder.setAttribute(l_char_item, 'sortable', 'true');
2804 jdr_docbuilder.setAttribute(l_char_dtl_item, 'sortable', 'true');
2805 jdr_docbuilder.setAttribute(l_col_hdr, 'sortable' , 'true');
2806
2807 add_child_to_parent(l_col_hdr, l_char_item, 'contents');
2808
2809 l_hrd_code := 'colHdr' || l_attr_code;
2810 l_sort_hdr := jdr_docbuilder.createElement(jdr_docbuilder.oa_ns, 'sortableHeader');
2811 jdr_docbuilder.setAttribute(l_sort_hdr, 'id', l_hrd_code);
2812 l_prompt := get_special_item_label(p_attribute_code);
2813 jdr_docbuilder.setAttribute(l_sort_hdr, 'prompt', l_prompt);
2814 jdr_docbuilder.setAttribute(l_sort_hdr, 'sortable' , 'yes');
2815 jdr_docbuilder.setAttribute(l_sort_hdr, 'sortState' , 'yes');
2816 add_child_to_parent(l_col_hdr, l_sort_hdr, 'columnHeader');
2817
2818
2819 jdr_docbuilder.setAttribute(l_char_dtl_item, 'styleClass', 'OraTableDetail');
2820
2821 jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2822 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2823
2824
2825 l_vo_attribute_name := get_hc_export_vo_attr_name(p_attribute_code);
2826 jdr_docbuilder.setAttribute(l_char_item, 'viewName', g_export_vo_name);
2827 jdr_docbuilder.setAttribute(l_char_item, 'viewAttr', l_vo_attribute_name);
2828 jdr_docbuilder.setAttribute(l_char_dtl_item, 'viewName', g_export_vo_name);
2829 jdr_docbuilder.setAttribute(l_char_dtl_item, 'viewAttr', l_vo_attribute_name);
2830
2831
2832
2833 x_char_item := l_col_hdr;
2834 x_char_dtl_item := l_char_dtl_item;
2835
2836
2837 END create_special_item_mult_vqr;
2838
2839 PROCEDURE map_plan_vqr_multiple(
2840 p_plan_id IN NUMBER) IS
2841
2842 l_top_region_code VARCHAR2(35);
2843 l_dtl_region_code VARCHAR2(35);
2844 l_data_region_code VARCHAR2(35);
2845 l_comments_region_code VARCHAR2(35);
2846 l_vo_attribute_name VARCHAR2(35);
2847 l_prompt VARCHAR2(35);
2848 l_mode VARCHAR2(15) := g_vqr_multiple_layout;
2849 l_saved PLS_INTEGER;
2850 l_err_num NUMBER;
2851 l_err_msg VARCHAR2(100);
2852 l_counter NUMBER := 0;
2853 l_comments_exist VARCHAR2(1) := 'N';
2854 l_displayed_flag NUMBER;
2855 c_displayed_flag VARCHAR2(10);
2856
2857
2858 l_top_doc JDR_DOCBUILDER.DOCUMENT := NULL;
2859 l_top_region JDR_DOCBUILDER.ELEMENT := NULL;
2860 l_data_region JDR_DOCBUILDER.ELEMENT := NULL;
2861 l_dtl_region JDR_DOCBUILDER.ELEMENT := NULL;
2862 l_comments_region JDR_DOCBUILDER.ELEMENT := NULL;
2863 l_char_item JDR_DOCBUILDER.ELEMENT := NULL;
2864 l_char_dtl_item JDR_DOCBUILDER.ELEMENT := NULL;
2865
2866
2867 CURSOR plan_chars (p_char_type VARCHAR2)IS
2868 SELECT qpc.char_id
2869 FROM qa_plan_chars qpc,
2870 qa_chars qc
2871 WHERE qc.char_id = qpc.char_id
2872 AND qpc.enabled_flag = 1
2873 AND qpc.plan_id = p_plan_id
2874 AND ((p_char_type = 'NonComments' AND qc.datatype <> g_comments_datatype) OR
2875 (p_char_type = 'Comments' AND qc.datatype = g_comments_datatype))
2876 ORDER BY QPC.mandatory_flag, QPC.prompt_sequence;
2877
2878
2879 BEGIN
2880 -- The top region contains the data, comment regions.
2881 -- A document is created with the top region as its top level element
2882 -- The top region is a stack layout for a single row layout.
2886
2883 -- Deleting the top document should delete the existing regions for the plan.
2884
2885 l_top_region_code := construct_code(g_vqr_multiple_prefix, p_plan_id);
2887 delete_old_top_document(g_jrad_region_path || l_top_region_code);
2888
2889 l_top_doc := create_top_document(g_jrad_region_path || l_top_region_code);
2890
2891 l_prompt := get_region_prompt('DATA');
2892 l_top_region := create_jrad_region (l_top_region_code, 'advancedTable', l_prompt, null, g_vqr_multiple_layout);
2893 jdr_docbuilder.setAttribute(l_top_region, 'width', '100%');
2894 JDR_DOCBUILDER.setTopLevelElement(l_top_doc, l_top_region);
2895 JDR_DOCBUILDER.setAttribute(l_top_region, 'viewName', g_export_vo_name);
2896
2897 -- create the detail container region
2898 l_dtl_region_code := construct_code(g_vqr_mult_dtl_prefix, p_plan_id);
2899 l_dtl_region := create_jrad_region(l_dtl_region_code, 'stackLayout', null, '-1');
2900
2901 l_data_region_code := construct_code(g_vqr_data_prefix, p_plan_id);
2902 l_data_region := create_jrad_region(l_data_region_code, 'labeledFieldLayout', null, '2');
2903 add_child_to_parent(l_dtl_region, l_data_region, 'contents');
2904
2905
2906 -- Now add the plan items to main and detail regions.
2907 -- First the mandatory non-comment items, ordered by prompt sequence, followed by non-mandatory
2908 -- non-comment items ordered by prompt sequence. Only 5 items come in main region, everything
2909 -- else goes to detail region. Comment items are always in detail region and follw the non-comment
2910 -- items ordered by prompt sequence. Thereafter we will have the special attributes created_By,
2911 -- collection_id and last_updated_by. These will usually be in detail region, but will come in
2912 -- main region if the main region still has less than 5 items.
2913
2914 l_counter := 0;
2915 for rec in plan_chars ('NonComments')
2916 loop
2917 c_displayed_flag := create_item_for_mult_vqr(p_plan_id, rec.char_id, l_char_item, l_char_dtl_item);
2918 add_child_to_parent(l_top_region, l_char_item, 'contents');
2919 add_child_to_parent(l_data_region, l_char_dtl_item, 'contents');
2920
2921 if c_displayed_flag = 'false' then
2922 jdr_docbuilder.setAttribute(l_char_item, 'rendered', c_displayed_flag);
2923 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', c_displayed_flag);
2924 elsif c_displayed_flag = 'true' then
2925 if l_counter < 5 then
2926 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'true');
2927 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'false');
2928 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2929 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'false');
2930 l_counter := l_counter + 1;
2931 else
2932 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'false');
2933 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'true');
2934 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'false');
2935 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2936 end if;
2937 end if;
2938
2939 end loop;
2940
2941
2942 -- Now add the special region items
2943 create_special_item_mult_vqr(g_qa_created_by_attribute, l_char_item, l_char_dtl_item);
2944 add_child_to_parent(l_top_region, l_char_item, 'contents');
2945 add_child_to_parent(l_data_region, l_char_dtl_item, 'contents');
2946 if l_counter < 5 then
2947 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'true');
2948 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'false');
2949 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2950 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'false');
2951 l_counter := l_counter + 1;
2952 else
2953 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'false');
2954 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'true');
2955 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'false');
2956 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2957 end if;
2958
2959
2960
2961
2962 create_special_item_mult_vqr(g_collection_id_attribute, l_char_item, l_char_dtl_item);
2963 add_child_to_parent(l_top_region, l_char_item, 'contents');
2964 add_child_to_parent(l_data_region, l_char_dtl_item, 'contents');
2965 if l_counter < 5 then
2966 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'true');
2967 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'false');
2968 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2969 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'false');
2970 l_counter := l_counter + 1;
2971 else
2972 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'false');
2973 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'true');
2974 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'false');
2975 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2976 end if;
2977
2978
2979
2980 create_special_item_mult_vqr(g_last_update_date_attribute, l_char_item, l_char_dtl_item);
2981 add_child_to_parent(l_top_region, l_char_item, 'contents');
2985 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'false');
2982 add_child_to_parent(l_data_region, l_char_dtl_item, 'contents');
2983 if l_counter < 5 then
2984 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'true');
2986 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
2987 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'false');
2988 l_counter := l_counter + 1;
2989 else
2990 jdr_docbuilder.setAttribute(l_char_item, 'rendered', 'false');
2991 jdr_docbuilder.setAttribute(l_char_dtl_item, 'rendered', 'true');
2992 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'false');
2993 -- jdr_docbuilder.setAttribute(l_char_dtl_item, 'queryable', 'true');
2994 end if;
2995
2996
2997
2998 -- add the comment items, if any
2999 for rec in plan_chars ('Comments')
3000 loop
3001 -- create the comments region
3002 If l_comments_exist = 'N' then
3003 l_comments_region_code := construct_code(g_vqr_comments_prefix, p_plan_id);
3004 l_comments_region := create_jrad_region(l_comments_region_code, 'labeledFieldLayout', null, '1');
3005 l_comments_exist := 'Y';
3006 end if;
3007 -- add to comment items to the region
3008 c_displayed_flag := create_item_for_mult_vqr(p_plan_id, rec.char_id, l_char_item, l_char_dtl_item);
3009 add_child_to_parent(l_comments_region, l_char_dtl_item, 'contents');
3010 jdr_docbuilder.setAttribute(l_char_item, 'rendered', c_displayed_flag);
3011 jdr_docbuilder.setAttribute(l_char_item, 'styleClass', 'OraTableDetail');
3012
3013 -- if c_displayed_flag = 'true' then
3014 -- jdr_docbuilder.setAttribute(l_char_item, 'queryable', 'true');
3015 -- end if;
3016
3017 end loop;
3018
3019 -- Now add comments region to detail region
3020 if l_comments_exist = 'Y' then
3021 add_child_to_parent(l_dtl_region, l_comments_region, 'contents');
3022 end if;
3023
3024 -- now add the detail region to the main region
3025 add_child_to_parent(l_top_region, l_dtl_region, 'detail');
3026
3027 -- save the document
3028 l_saved := JDR_DOCBUILDER.SAVE;
3029
3030 EXCEPTION
3031
3032 WHEN OTHERS THEN
3033 l_err_num := SQLCODE;
3034 l_err_msg := SUBSTR(SQLERRM, 1, 100);
3035 -- dbms_output.put_line(err_msg);
3036
3037 END map_plan_vqr_multiple;
3038
3039 -- End: 12.1 Usability project changes for export
3040 -- abgangul
3041
3042
3043 PROCEDURE map_plan_eqr_multiple(
3044 p_plan_id IN NUMBER,
3045 p_special_segment VARCHAR2) IS
3046
3047 l_table_region_code VARCHAR2(35);
3048 l_dtl_region_code VARCHAR2(35);
3049
3050 l_mode VARCHAR2(15) := g_eqr_multiple_layout;
3051 l_saved PLS_INTEGER;
3052 l_err_num NUMBER;
3053 l_err_msg VARCHAR2(100);
3054 l_char_count NUMBER := NULL;
3055
3056 l_top_doc JDR_DOCBUILDER.DOCUMENT := NULL;
3057 l_table_region JDR_DOCBUILDER.ELEMENT := NULL;
3058 l_dtl_region JDR_DOCBUILDER.ELEMENT := NULL;
3059
3060 --
3061 -- 12.1 Device Integration Project
3062 -- Variables for adding device region
3063 -- to the multi row layout.
3064 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
3065 --
3066 l_stk_region JDR_DOCBUILDER.ELEMENT := NULL;
3067 l_device_region JDR_DOCBUILDER.ELEMENT := NULL;
3068 l_stk_region_code varchar2(35) := NULL;
3069 l_device_region_code varchar2(35) := NULL;
3070 l_prompt VARCHAR2(30);
3071 BEGIN
3072 -- The top region is a table
3073 -- It contains all the region items and the hide/show detailed region.
3074 -- Here I add all the plan chars to the table as well as the detailed region
3075 -- with a different ID. Comments are added only to detailed region.
3076 -- Adding multi row attachment link too to the table.
3077 -- At run time, CO decides what to render horizontally in the row and what
3078 -- to render in the detailed region depending on the number of elements in the
3079 -- plan and whether an element is a context element or not.
3080
3081 -- A document is created with the table region as its top level element
3082
3083
3084 l_stk_region_code := construct_code(g_eqr_multiple_prefix || p_special_segment, p_plan_id);
3085 l_dtl_region_code := construct_code(g_eqr_mult_dtl_prefix || p_special_segment, p_plan_id);
3086 l_table_region_code := construct_code(g_eqr_mult_data_prefix || p_special_segment, p_plan_id);
3087 l_device_region_code := construct_code(g_eqr_device_prefix || p_special_segment, p_plan_id);
3088 delete_old_top_document(g_jrad_region_path || l_stk_region_code);
3089
3090 l_top_doc := create_top_document(g_jrad_region_path || l_stk_region_code);
3091 --
3092 -- 12.1 Device Integration Project
3093 -- The top document needs to be a stack layout to
3094 -- stack the device region instead of table layout.
3095 -- Hence, commenting.
3096 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
3097 --
3098 -- l_table_region := create_and_set_top_element(l_top_doc, l_table_region_code,
3099 -- 'table');
3100
3101 -- Setting the top document as a stacklayout.
3102 l_stk_region := create_and_set_top_element(l_top_doc, l_stk_region_code,
3103 'stackLayout');
3104
3108 l_device_region := create_device_region(p_plan_id, l_device_region_code);
3105 -- Creating the device region if MES is uptaken
3106
3107 IF FND_PROFILE.VALUE('WIP_MES_OPS_FLAG') = 1 THEN
3109
3110 IF l_device_region.id is not null THEN
3111 add_child_to_parent(l_stk_region, l_device_region, 'contents');
3112 END IF;
3113 END IF;
3114
3115 -- Adding the table region (data region)
3116 -- to the stack region (top document) already created.
3117 l_prompt := get_region_prompt('DATA');
3118
3119 l_table_region := create_jrad_region (l_table_region_code, 'table', l_prompt, null);
3120 add_child_to_parent(l_stk_region, l_table_region, 'contents');
3121
3122 -- 12.1 Device Integration Project End.
3123
3124 -- Add non comment plan chars and special items as children to the table region
3125 l_char_count := add_plan_chars_to_region(p_plan_id, l_table_region,
3126 l_mode, 'NonComments');
3127 add_special_chars_to_region(p_plan_id, l_table_region, l_mode);
3128
3129 -- Create detail region and add it to the table region.
3130 l_dtl_region := create_detail_region(p_plan_id, l_dtl_region_code,
3131 g_eqr_multiple_layout);
3132 add_child_to_parent(l_table_region, l_dtl_region, 'detail');
3133
3134 -- 12.1 Inline Project
3135 -- saugupta
3136 add_table_selection(l_table_region);
3137 add_table_action(l_table_region);
3138
3139 -- save the document
3140 l_saved := JDR_DOCBUILDER.SAVE;
3141
3142 EXCEPTION
3143
3144 WHEN OTHERS THEN
3145 l_err_num := SQLCODE;
3146 l_err_msg := SUBSTR(SQLERRM, 1, 100);
3147 -- dbms_output.put_line(err_msg);
3148
3149 END map_plan_eqr_multiple;
3150
3151 PROCEDURE map_plan_eqr_multiple(
3152 p_plan_id IN NUMBER) IS
3153
3154 BEGIN
3155 -- this is a wrapper to map_plan_eqr_multiple (p_plan_id, <special segment string>)
3156 -- in this case, special segment is null
3157 map_plan_eqr_multiple(p_plan_id, NULL);
3158
3159 END map_plan_eqr_multiple;
3160
3161 -- 12.1 Inline Region in MES Transactions
3162 -- Project code start
3163
3164 -- create advanced table of inline region
3165 -- this should be called from the CP
3166 PROCEDURE map_plan_adv_table_eqr(p_plan_id IN NUMBER, p_special_segment VARCHAR2) IS
3167
3168 l_table_region_code VARCHAR2(35);
3169 l_dtl_region_code VARCHAR2(35);
3170
3171 l_mode VARCHAR2(15) := g_eqr_advtable_layout;
3172 -- change mode for inline region
3173 l_saved pls_integer;
3174 l_err_num NUMBER;
3175 l_err_msg VARCHAR2(100);
3176 l_char_count NUMBER := NULL;
3177
3178 l_top_doc jdr_docbuilder.DOCUMENT := NULL;
3179 l_table_region jdr_docbuilder.element := NULL;
3180 l_dtl_region jdr_docbuilder.element := NULL;
3181
3182 l_tbl_act jdr_docbuilder.element := NULL;
3183 l_tbl_s_sel jdr_docbuilder.element := NULL;
3184 l_tbl_footer jdr_docbuilder.element := NULL;
3185 l_api_name constant varchar2(50) := 'MAP_PLAN_ADV_TABLE_EQR';
3186
3187 --
3188 -- 12.1 Device Integration Project
3189 -- Variables for adding device region
3190 -- to the multi row layout.
3191 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
3192 --
3193 l_stk_region JDR_DOCBUILDER.ELEMENT := NULL;
3194 l_device_region JDR_DOCBUILDER.ELEMENT := NULL;
3195 l_stk_region_code varchar2(35) := NULL;
3196 l_device_region_code varchar2(35) := NULL;
3197 l_prompt VARCHAR2(30);
3198
3199
3200 BEGIN
3201 log_error(g_pkg_name || l_api_name, 'Function BEGIN');
3202 l_stk_region_code := construct_code(g_eqr_multiple_prefix || p_special_segment, p_plan_id);
3203 l_dtl_region_code := construct_code(g_eqr_mult_dtl_prefix || p_special_segment, p_plan_id);
3204 l_table_region_code := construct_code(g_eqr_mult_data_prefix || p_special_segment, p_plan_id);
3205 l_device_region_code := construct_code(g_eqr_device_prefix || p_special_segment, p_plan_id);
3206 delete_old_top_document(g_jrad_region_path || l_stk_region_code);
3207
3208 l_top_doc := create_top_document(g_jrad_region_path || l_stk_region_code);
3209 --
3210 -- 12.1 Device Integration Project
3211 -- The top document needs to be a stack layout to
3212 -- stack the device region instead of table layout.
3213 -- Hence, commenting.
3214 -- bhsankar Wed Oct 24 04:45:16 PDT 2007
3215 --
3216 -- l_table_region := create_and_set_top_element(l_top_doc, l_table_region_code,
3217 -- 'table');
3218
3219 -- Setting the top document as a stacklayout.
3220 l_stk_region := create_and_set_top_element(l_top_doc, l_stk_region_code,
3221 'stackLayout');
3222
3223 -- Creating the device region if MES is uptaken
3224
3225 IF FND_PROFILE.VALUE('WIP_MES_OPS_FLAG') = 1 THEN
3226 l_device_region := create_device_region(p_plan_id, l_device_region_code);
3227
3228 IF l_device_region.id is not null THEN
3229 add_child_to_parent(l_stk_region, l_device_region, 'contents');
3230 END IF;
3231 END IF;
3232
3233 -- Adding the table region (data region)
3234 -- to the stack region (top document) already created.
3235 l_prompt := get_region_prompt('DATA');
3236
3237 l_table_region := create_jrad_region (l_table_region_code, 'advancedTable', l_prompt, null);
3238 JDR_DOCBUILDER.setAttribute(l_table_region, 'viewName', g_vo_name);
3239 add_child_to_parent(l_stk_region, l_table_region, 'contents');
3240
3241 -- 12.1 Device Integration Project End.
3242
3243 -- l_table_region_code := construct_code(g_eqr_adv_table_prefix || p_special_segment, p_plan_id);
3244 -- l_dtl_region_code := construct_code(g_eqr_mult_dtl_prefix || p_special_segment, p_plan_id);
3245 log_error(g_pkg_name || l_api_name, 'Region Info: ' || l_table_region_code);
3246 -- delete the existing document
3247 -- delete_old_top_document(g_jrad_region_path || l_table_region_code);
3248
3249 -- l_top_doc := create_top_document(g_jrad_region_path || l_table_region_code);
3250 log_error(g_pkg_name || l_api_name, 'JRAD Doc created');
3251 -- either change the method or call a diff method for creating the advanced region
3252 -- l_table_region := create_and_set_top_element(l_top_doc, l_table_region_code, 'advancedTable');
3253 log_error(g_pkg_name || l_api_name,'Advanced Table Created ');
3254 -- Add non comment plan chars and special items as children to the table region
3255 -- below we neeed to add special colums to advanced table to work
3256 l_char_count := add_plan_chars_to_region(p_plan_id, l_table_region, l_mode, 'NonComments');
3257 log_error(g_pkg_name || l_api_name,'Elements added to Advanced Table: ' || to_char(l_char_count));
3258 -- Add attachments and special items like org etc
3259 add_special_chars_to_region(p_plan_id, l_table_region, g_eqr_multiple_layout);
3260
3261 -- Create detail region and add it to the table region.
3262 -- TODO -> hide show and detail region
3263 l_dtl_region := create_detail_region(p_plan_id, l_dtl_region_code, g_eqr_multiple_layout);
3264 add_child_to_parent(l_table_region, l_dtl_region, 'detail');
3265
3266 add_table_selection(l_table_region);
3267 add_table_action(l_table_region);
3268 add_table_footer(l_table_region);
3269
3270 -- save the document
3271 l_saved := jdr_docbuilder.save;
3272 log_error(g_pkg_name || l_api_name, 'Saved Document. Function END');
3273
3274 EXCEPTION
3275
3276 WHEN others THEN
3277 l_err_num := SQLCODE;
3278 l_err_msg := SUBSTR(sqlerrm, 1, 100);
3279 -- dbms_output.put_line(err_msg);
3280
3281 END map_plan_adv_table_eqr;
3282
3283 -- End 12.1 Inline Region in MES Txn
3284
3285 PROCEDURE map_plan_special(
3286 p_plan_id IN NUMBER) IS
3287
3288 PRAGMA AUTONOMOUS_TRANSACTION;
3289
3290 CURSOR plan IS
3291 SELECT template_plan_id
3292 FROM qa_plans
3293 WHERE plan_id = p_plan_id;
3294
3295 CURSOR valueLookups(c_char_id NUMBER) IS
3296 SELECT short_code
3297 FROM qa_plan_char_value_lookups
3298 WHERE plan_id = p_plan_id
3299 AND char_id = c_char_id;
3300
3301 l_template_plan_id NUMBER;
3302 l_short_code qa_plan_char_value_lookups.short_code%TYPE;
3303 BEGIN
3304 OPEN plan;
3305 FETCH plan INTO l_template_plan_id;
3306 CLOSE plan;
3307
3308 -- special logic if template_plan_id matches Nonconformance Master
3309 -- or Corrective Action Request plan
3310 -- map one plan per each Nonconformance Source (or Request type)
3311 -- the region name will embed the Nonconformance Source (or Request type)
3312 --
3313 -- this is a workaround to overcome the inability to personalize
3314 -- region with double default column style at user level
3315 -- admin will create one personalization per each Nonconformance Source (or Request type)
3316 --
3317 -- still map one with normal naming scheme
3318 IF l_template_plan_id in (18, 35) THEN -- Nonconformance master
3319 OPEN valueLookups(qa_ss_const.nonconformance_source);
3320 LOOP
3321 FETCH valueLookups INTO l_short_code;
3322 EXIT WHEN valueLookups%NOTFOUND;
3323 map_plan_eqr_single(p_plan_id, g_ncm || l_short_code || '_');
3324 map_plan_vqr_single(p_plan_id, g_ncm || l_short_code || '_');
3325 map_plan_eqr_multiple(p_plan_id, g_ncm || l_short_code || '_');
3326 END LOOP;
3327 CLOSE valueLookups;
3328 ELSIF l_template_plan_id = 65 THEN -- Corrective Action Request
3329 OPEN valueLookups(2147483607); -- should be qa_ss_const.request_type
3330 LOOP
3331 FETCH valueLookups INTO l_short_code;
3332 EXIT WHEN valueLookups%NOTFOUND;
3333 map_plan_eqr_single(p_plan_id, g_car || l_short_code || '_');
3334 map_plan_vqr_single(p_plan_id, g_car || l_short_code || '_');
3335 map_plan_eqr_multiple(p_plan_id, g_car || l_short_code || '_');
3336 END LOOP;
3337 CLOSE valueLookups;
3338 END IF;
3339
3340 COMMIT; --commit the autonomous txn.
3341
3342 END map_plan_special;
3343
3344 PROCEDURE map_plan(
3345 p_plan_id IN NUMBER) IS
3346
3347 -- jrad_doc_version was used to check for a jrad plan region in map on demand.
3348 -- During AK -> Jrad migration, since it would take a lot of installation time to
3349 -- create jrad regions for all the existing plans, mapping on demand was used.
3350 -- jrad_doc_version is also used as a work around for fwk's bug 2837618.
3351 -- Whenever we modify a plan, we needed to create a jrad region with a new name.
3352 -- This is achieved by appending jrad_doc_version to the prefix.
3353
3354 -- Here we assume the bug is fixed (11i10). But we still a boolean to check the
3355 -- existence for map on demand. It seems we can directly qiery fwk tables to find
3356 -- out whether a region exists. Needs further investigation.
3357
3358 -- For now, p_jrad_doc_version is null.
3359 l_err_num NUMBER;
3360 l_err_msg VARCHAR2(100);
3361
3362 PRAGMA AUTONOMOUS_TRANSACTION;
3363
3364 BEGIN
3365 set_debug_mode('FND');
3366 -- special logic if template_plan_id matches Nonconformance Master
3367 -- or Corrective Action Request plan
3368
3369 map_plan_special(p_plan_id);
3370
3371 -- map for all plan using normal naming scheme
3372 map_plan_eqr_single(p_plan_id);
3373 map_plan_vqr_single(p_plan_id);
3374 -- 12.1 QWB Usability Improvements
3375 -- map_plan_eqr_multiple(p_plan_id);
3376
3377
3378 -- 12.1 Inline Region Project
3379 -- saugupta
3380 -- log_error(g_pkg_name || 'Map_plan', 'Start Advanced table');
3381 map_plan_adv_table_eqr(p_plan_id, NULL);
3382
3383 -- 12.1 Usability Project
3384 -- Added for export page
3385 -- abgangul
3386 map_plan_vqr_multiple(p_plan_id);
3387
3388 COMMIT; --commit the autonomous txn.
3389
3390 END map_plan;
3391
3392
3393
3394 PROCEDURE map_on_demand (p_plan_id IN NUMBER) IS
3395
3396 PRAGMA AUTONOMOUS_TRANSACTION;
3397
3398 l_eqr_single_doc VARCHAR2(100);
3399 l_vqr_single_doc VARCHAR2(100);
3400 l_eqr_multiple_doc VARCHAR2(100);
3401 l_vqr_multiple_doc VARCHAR2(100);
3402
3403 l_jrad_upgrade_ver NUMBER;
3404 l_seed_ver NUMBER;
3405
3406 BEGIN
3407
3408 --
3409 -- Tracking Bug 4697145
3410 -- MOAC Upgrade feature to perform on demand mapping
3411 -- if a special JRad LOV is changed.
3412 -- Added the two SELECTs.
3413 -- bso Sun Nov 6 17:07:45 PST 2005
3414 --
3415
3416 SELECT jrad_upgrade_ver
3417 INTO l_jrad_upgrade_ver
3418 FROM qa_plans
3419 WHERE plan_id = p_plan_id
3420 FOR UPDATE;
3421
3422 SELECT jrad_upgrade_ver
3423 INTO l_seed_ver
3424 FROM qa_plans
3425 WHERE plan_id = qa_ss_const.JRAD_UPGRADE_PLAN;
3426
3427 fnd_msg_pub.initialize;
3428
3429 l_eqr_single_doc := g_jrad_region_path || construct_code(
3430 g_eqr_single_prefix, p_plan_id);
3431 l_vqr_single_doc := g_jrad_region_path || construct_code(
3432 g_vqr_single_prefix, p_plan_id);
3433 l_eqr_multiple_doc := g_jrad_region_path || construct_code(
3434 g_eqr_multiple_prefix, p_plan_id);
3435
3436
3437 -- 12.1 Usability project
3438 -- Added for export page.
3439 l_vqr_multiple_doc := g_jrad_region_path || construct_code(
3440 g_vqr_multiple_prefix, p_plan_id);
3441
3442
3443 --
3444 -- Tracking Bug 4697145
3445 -- MOAC Upgrade feature to perform on demand mapping
3446 -- if a special JRad LOV is changed.
3447 -- Added the two OR conditions.
3448 -- bso Sun Nov 6 17:07:45 PST 2005
3449 --
3450 -- Reformatted the logical conditions to a form that I
3451 -- believe is easier to understand.
3452 -- bso
3453 --
3454
3455 IF l_jrad_upgrade_ver IS NULL OR
3456 l_jrad_upgrade_ver < l_seed_ver OR
3457 NOT jdr_docbuilder.documentExists(l_eqr_single_doc) OR
3458 NOT jdr_docbuilder.documentExists(l_vqr_single_doc) OR
3459 NOT jdr_docbuilder.documentExists(l_vqr_multiple_doc) OR
3460 NOT jdr_docbuilder.documentExists(l_eqr_multiple_doc) THEN
3461 -- map plan. documents do not exist,
3462 -- or of lower version than wanted.
3463 map_plan(p_plan_id);
3464
3465 -- Tracking Bug 4697145
3466 -- Map iSP/eAM etc plans also.
3467 qa_jrad_pkg.map_plan(p_plan_id);
3468
3469
3470 -- Tracking Bug 4697145
3471 -- Now indicate the upgrade is completed.
3472 jrad_upgraded(p_plan_id);
3473 END IF;
3474
3475 --
3476 -- Bug 5182097
3477 -- Make a call to refetch the qpc cache in the validation
3478 -- API otherwise some subtle Setup Collection Plan changes
3479 -- such as turning mandatory flag on/off will not be
3480 -- immediately reflected in QWB.
3481 -- bso Mon May 1 17:43:03 PDT 2006
3482 --
3483 qa_plan_element_api.refetch_qa_plan_chars(p_plan_id);
3484
3485 COMMIT;
3486
3487 END map_on_demand;
3488
3489
3490
3491 --
3492 -- Bug 4697145
3493 -- MOAC upgrade needs to delete JRad region. But this procedure
3494 -- is generic to be used by other projects.
3495 -- Used by qajrad.sql
3496 --
3497 PROCEDURE delete_plan_jrad_region(p_plan_id IN NUMBER) IS
3498
3499 BEGIN
3500 delete_old_top_document(g_jrad_region_path ||
3501 construct_code(g_eqr_single_prefix, p_plan_id));
3502 delete_old_top_document(g_jrad_region_path ||
3503 construct_code(g_eqr_multiple_prefix, p_plan_id));
3504 END delete_plan_jrad_region;
3505
3506
3507 --
3508 -- Tracking Bug 4697145
3509 -- MOAC Upgrade feature to indicate this plan has
3510 -- been regenerated and on demand mapping can skip.
3511 -- bso Sun Nov 6 16:52:53 PST 2005
3512 --
3513 PROCEDURE jrad_upgraded(p_plan_id IN NUMBER) IS
3514
3515 BEGIN
3516 UPDATE qa_plans
3517 SET jrad_upgrade_ver =
3518 (SELECT nvl(jrad_upgrade_ver, 1)
3519 FROM qa_plans
3520 WHERE plan_id = qa_ss_const.JRAD_UPGRADE_PLAN)
3521 WHERE plan_id = p_plan_id;
3522 END jrad_upgraded;
3523
3524
3525 END qa_ssqr_jrad_pkg;