DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_TEMPLATE_HEIRARCHY

Source


1 package body icx_template_heirarchy as
2 /* $Header: ICXTMPHB.pls 115.5 99/07/17 03:29:42 porting ship $ */
3 
4 
5 
6 procedure main is
7 
8 l_title       varchar2(80);
9 l_prompts     icx_util.g_prompts_table;
10 
11 begin
12 if icx_sec.validateSession then
13     icx_util.getPrompts(601,'ICX_RELATED_TEMPLATES_R',l_title,l_prompts);
14 
15     htp.htmlOpen;
16     htp.headOpen;
17         icx_util.copyright;
18         htp.title(l_title);
19     htp.headClose;
20 
21     htp.p('<FRAMESET rows="285,*">
22 	       <FRAME name="header" src="ICX_TEMPLATE_HEIRARCHY.template_head">
23 	       <FRAME name="tail" src="ICX_TEMPLATE_HEIRARCHY.template_tail">
24 	   </FRAMESET>');
25 
26 
27     htp.p('<NOFRAMESET>');
28 	  FND_MESSAGE.SET_NAME('ICX','ICX_BROWSER');
29           htp.p(FND_MESSAGE.Get);
30     htp.p('</NOFRAMESET>');
31 
32     htp.htmlClose;
33 end if;  -- validateSession
34 
35 end main;
36 
37 
38 
39 procedure template_head(p_template in varchar2 default null,
40  		        p_query_flag in varchar2 default 'F') is
41 
42 
43 cursor relations is
44 select lookup_code,
45        meaning
46 from   fnd_lookups
47 where  lookup_type = 'ICX_RELATIONS'
48 and    enabled_flag = 'Y';
49 
50 c_browser varchar2(400) := owa_util.get_cgi_env('HTTP_USER_AGENT');
51 l_agent varchar2(100) := owa_util.get_cgi_env('SCRIPT_NAME');
52 l_language varchar2(30);
53 i number;
54 l_title       varchar2(80);
55 l_prompts     icx_util.g_prompts_table;
56 lov_title       varchar2(80);
57 lov_prompts     icx_util.g_prompts_table;
58 err_num number;
59 err_mesg varchar2(512);
60 temp_text varchar2(2000);
61 temp_relation_code varchar2(30);
62 temp_relation varchar2(80);
63 
64 begin
65 if icx_sec.validateSession then
66     icx_util.error_page_setup;
67     l_language := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
68     icx_util.getPrompts(601,'ICX_RELATED_TEMPLATES_R',l_title,l_prompts);
69     icx_util.getPrompts(601,'ICX_LOV',lov_title,lov_prompts);
70 
71     htp.htmlOpen;
72     htp.headOpen;
73         icx_util.copyright;
74 
75         htp.title(l_title);
76 
77         js.scriptOpen;
78             icx_util.LOVScript;
79             icx_admin_sig.help_win_script('/OA_HTML/'||l_language||'/ICXHLMTH.htm');
80 
81 	    js.null_alert;
82 	    js.equal_alert;
83 
84 	    htp.p('function autoquery() {
85 		parent.tail.document.Tail.p_template.value = document.Template.ICX_TEMPLATE1.value
86 		parent.tail.document.Tail.submit()
87 	    }');
88 
89 
90 	    htp.p('function template_changed() {
91 		parent.tail.document.Tail.p_template.value = document.Template.ICX_TEMPLATE1.value
92 		parent.tail.document.Tail.submit()
93 	    }');
94 
95 	    htp.p('function pre_template_LOV() {
96 	        LOV(''178'',''ICX_TEMPLATE1'',''601'',''ICX_RELATED_TEMPLATES_R'',''Template'',''header'','''','''')
97 	    }');
98 
99 	    htp.p('function post_template_LOV(template_name) {
100 		parent.tail.document.Tail.p_template.value = template_name
101 		parent.tail.document.Tail.submit()
102 	    }');
103 
104 	    FND_MESSAGE.SET_NAME('ICX','ICX_TMP_BEFORE');
105 	    htp.p('function pre_rel_template_LOV() {
106 		if (!null_alert(document.Template.ICX_TEMPLATE1.value,"'||icx_util.replace_quotes(FND_MESSAGE.Get)||'")) {
107 	          LOV(''178'',''ICX_RELATED_TEMPLATE'',''601'',''ICX_RELATED_TEMPLATES_R'',''Template'',''header'','''','''')
108 		}
109 	    }');
110 	    -- remove manual where clause for now because html can not deal
111  	    -- with the spaces in the template name
112 	    -- var l_where = "EXPRESS_NAME<>''" + document.Template.ICX_TEMPLATE1.value + "''"
113 
114 
115 	    FND_MESSAGE.SET_NAME('ICX','ICX_NOT_NULL');
116 	    htp.p('function template_submit() {
117 		if (!null_alert(document.Template.ICX_TEMPLATE1.value,"'||icx_util.replace_quotes(l_prompts(1))||' '||icx_util.replace_quotes(FND_MESSAGE.Get)||'")) {
118 		  if (document.Template.ICX_RELATION.options[document.Template.ICX_RELATION.selectedIndex].value != "TOP") {');
119 	    FND_MESSAGE.SET_NAME('ICX','ICX_NOT_NULL');
120 	    htp.p('   if (!null_alert(document.Template.ICX_RELATED_TEMPLATE.value,"'||icx_util.replace_quotes(l_prompts(2))||' '||icx_util.replace_quotes(FND_MESSAGE.Get)||'")) {');
121 	    FND_MESSAGE.SET_NAME('ICX','ICX_CAT_PARENT');
122 	    htp.p('      if (!equal_alert(document.Template.ICX_TEMPLATE1.value,document.Template.ICX_RELATED_TEMPLATE.value,"'||icx_util.replace_quotes(FND_MESSAGE.Get)||'")) {
123 		        document.Template.submit()
124 		      }
125 		    }
126 		  } else {
127 		    document.Template.submit()
128 		  }
129 		}
130 	    }');
131 
132         js.scriptClose;
133     htp.headClose;
134 
135     htp.bodyOpen(icx_admin_sig.background);
136     icx_admin_sig.toolbar(language_code => l_language);
137 
138     htp.formOpen(l_agent||'/icx_template_heirarchy.template_insert','POST','','','NAME="Template"');
139 
140     htp.tableOpen;
141     htp.tableRowOpen;
142       htp.tableData('<H2>'||l_title||'</H2>');
143     htp.tableRowClose;
144     htp.tableClose;
145 
146     htp.tableOpen;
147     htp.tableRowOpen;
148 
149     -- Blank table data
150       htp.tableData('<BR>');
151       htp.tableData('<BR>');
152 
153     -- Template text field
154       htp.tableData(l_prompts(1),'RIGHT');
155         htp.tableData(htf.formText('ICX_TEMPLATE1',30,81,p_template,'onchange="template_changed()"'));
156           htp.tableData(htf.anchor('javascript:pre_template_LOV()',htf.img('/OA_MEDIA/'||l_language||'/FNDILOV.gif','CENTER',icx_util.replace_alt_quotes(lov_title),
157 '','BORDER=0 WIDTH=23 HEIGHT=21'),'','onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(lov_title)||''';return true"'));
158     htp.tableRowClose;
159 
160     -- Relation poplist
161     htp.tableRowOpen;
162       htp.tableData(l_prompts(3),'RIGHT');
163       htp.p('<TD>'||htf.formSelectOpen('ICX_RELATION'));
164         open relations;
165 	loop
166 	    fetch relations into temp_relation_code, temp_relation;
167 	    exit when relations%NOTFOUND;
168 	    htp.formSelectOption(temp_relation,'','VALUE="'||temp_relation_code||'"');
169 	end loop;
170         close relations;
171       htp.p(htf.formSelectClose||'</TD>');
172 
173     -- Related Category text field
174       htp.tableData(l_prompts(2),'RIGHT');
175         htp.tableData(htf.formText('ICX_RELATED_TEMPLATE',30,81,''));
176           htp.tableData(htf.anchor('javascript:pre_rel_template_LOV()',htf.img('/OA_MEDIA/'||l_language||'/FNDILOV.gif','CENTER',icx_util.replace_alt_quotes(lov_title),
177 '','BORDER=0 WIDTH=23 HEIGHT=21'),'','onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(lov_title)||''';return true"'));
178     htp.tableRowClose;
179     htp.tableClose;
180 
181 
182     -- Write submit and clear buttons
183     htp.tableOpen;
184     htp.tableRowOpen;
185       icx_util.DynamicButton(l_prompts(4),'FNDBSBMT.gif',l_prompts(4),'javascript:template_submit()',l_language,FALSE);
186         if (instr(c_browser, 'MSIE') = 0) then
187             icx_util.DynamicButton(l_prompts(5),'FNDBCLR.gif',l_prompts(5),'javascript:document.Template.reset()',l_language,FALSE);
188         end if;
189     htp.tableRowClose;
190     htp.tableClose;
191 
192 
193     -- Query relationships if screen is being repainted after a commit
194     if p_query_flag = 'T' then
195         htp.p('<SCRIPT LANGUAGE="JavaScript">');
196 	htp.p('autoquery()');
197         htp.p('</SCRIPT>');
198     end if;
199 
200 
201     htp.formClose;
202     icx_sig.footer;
203     htp.bodyClose;
204     htp.htmlClose;
205 
206 end if;  -- ValidateSession
207 
208 exception
209   when others then
210     err_num := SQLCODE;
211     temp_text := SQLERRM;
212     select substr(temp_text,12,512) into err_mesg from dual;
213          icx_util.add_error(err_mesg);
214          icx_admin_sig.error_screen(l_title,l_language);
215 
216 end;  -- template_head
217 
218 
219 
220 procedure template_tail(p_template in varchar2 default null,
221 		        p_start_row in number default 1,
222 		        p_end_row in number default null) is
223 
224 l_agent 		varchar2(100) := owa_util.get_cgi_env('SCRIPT_NAME');
225 l_responsibility_id 	number := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
226 l_user_id 		number := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
227 l_title       		varchar2(80);
228 l_prompts     		icx_util.g_prompts_table;
229 err_num 		number;
230 err_mesg 		varchar2(512);
231 temp_text 		varchar2(2000);
232 l_language 		varchar2(30);
233 l_result_row_table 	icx_util.char240_table;
234 l_total_rows		number;
235 l_end_row		number;
236 l_query_size		number;
237 l_where 		varchar2(2000);
238 /* Change wrto Bug Fix to implement the Bind Vars **/
239   l_where_binds      ak_query_pkg.bind_tab;
240   v_index            NUMBER;
241 
242 l_order_by              varchar2(2000);
243 l_count 		number;
244 j			number;
245 temp_relation_item 	number;
246 temp_template		varchar2(240);
247 temp_related_template	varchar2(240);
248 
249 begin
250 if icx_sec.validateSession then
251 
252    v_index := 1;
253 
254 
255      icx_util.error_page_setup;
256     l_language := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
257     icx_util.getPrompts(601,'ICX_RELATED_TEMPLATES_DISP_R',l_title,l_prompts);
258 
259     htp.htmlOpen;
260     htp.headOpen;
261         icx_util.copyright;
262         js.scriptOpen;
263 
264 	    -- Javascript function to handle CD buttons
265             htp.p('function rows(start_num, end_num) {
266                 document.Tail.p_start_row.value = start_num
267                 document.Tail.p_end_row.value = end_num
268                 document.Tail.submit()
269                 }');
270 
271 	    -- javascript function to confirm delete of relationship
272  	    FND_MESSAGE.Set_name('ICX','ICX_DELETE');
273             htp.p('function delete_relation(template, related_template, html_template, html_related_template) {
274               if (confirm("'||icx_util.replace_onMouseOver_quotes(FND_MESSAGE.Get)||': " + template + " - " + related_template)) {
275                   open('''||l_agent||'/ICX_TEMPLATE_HEIRARCHY.template_delete?icx_template1='' + html_template + ''&icx_related_template='' + html_related_template,''tail'')
276               }
277             }');
278 
279         js.scriptClose;
280     htp.headClose;
281 
282     htp.bodyOpen(icx_admin_sig.background);
283 
284     htp.formOpen(l_agent||'/icx_template_heirarchy.template_tail','POST','','','NAME="Tail"');
285 
286     htp.formHidden('p_template',p_template);
287     htp.formHidden('p_start_row',p_start_row);
288     htp.formHidden('p_end_row',p_end_row);
289 
290 
291     -- check if p_template is valid
292     select count(*) into l_count
293     from po_reqexpress_headers
294     where express_name = p_template;
295 
296 
297     -- if p_template is valid perform object navigator query
298     if l_count = 1 then
299 
300         -- Construct where clause
301 	-- l_where := 'EXPRESS_NAME = '''||p_template||'''';
302         -- replace single quotes, bug 677606, aahmad-6/2/98
303 --        l_where := 'EXPRESS_NAME = '''||replace(p_template, '''', '''''')||'''';
304         l_where := 'EXPRESS_NAME = :express_name_bin';
305 
306   l_where_binds(v_index).name := 'express_name_bin';
307   l_where_binds(v_index).value := p_template;
308   v_index := v_index + 1;
309 
310         -- Construct orderby clause
311         l_order_by := 'RELATIONSHIP_TYPE DESC, RELATED_EXPRESS_NAME ASC';
312 
313         -- Look up the number of rows to display
314         select QUERY_SET into l_query_size
315         from ICX_PARAMETERS;
316 
317         -- figure end row value to display
318         if p_end_row is null then
319             l_end_row := l_query_size;
320         else
321             l_end_row := p_end_row;
322         end if;
323 
324 	-- Call to Object Navigator to execute query and return data
325         -- as well as object and region structures
326 
327         ak_query_pkg.exec_query (
328  	     P_PARENT_REGION_APPL_ID => 601			,
329 	     P_PARENT_REGION_CODE    => 'ICX_RELATED_TEMPLATES_DISP_R',
330 	     P_WHERE_CLAUSE  	     => l_where			,
331              P_ORDER_BY_CLAUSE       => l_order_by              ,
332 	     P_RESPONSIBILITY_ID     => l_responsibility_id	,
333 	     P_USER_ID	             => l_user_id		,
334 	     P_RETURN_PARENTS	     => 'T'			,
335 	     P_RETURN_CHILDREN	     => 'F'			,
336              P_RANGE_LOW             => p_start_row,
337              P_RANGE_HIGH            => l_end_row,
338             p_WHERE_BINDS      => l_where_binds);
339 
340 
341 
342         -- get number of total rows returned by lov to be used to
343         -- determine if we need to display the next/previous buttons
344         l_total_rows := ak_query_pkg.g_regions_table(0).total_result_count;
345 
346 
347         -- check end row value
348         if l_end_row > l_total_rows then
349             l_end_row := l_total_rows;
350         end if;
351 
352 
353 	-- display data and CD buttons if necessary
354 	j := 0;
355 	for i in 1..ak_query_pkg.g_results_table.COUNT loop
356 	    j := j + 1;
357 
358             -- If this is the first iteration of the loop then
359 	    -- display next/previous set buttons if list of values returns
360 	    -- more than the standard query size and also display
361  	    -- the table header
362             if j = 1 then
363                 if (l_total_rows > l_query_size) and not
364 		   (p_start_row = 1 and l_end_row = l_total_rows) then
365 		        icx_on_utilities2.displaySetIcons (
366 				P_LANGUAGE_CODE    => l_language,
367 				P_PACKPROC	   => 'JS',
368 			      	P_START_ROW	   => p_start_row,
369 				P_STOP_ROW	   => l_end_row,
370 				P_ENCRYPTED_WHERE  => '1',
371 				P_QUERY_SET	   => l_query_size,
372 				P_ROW_COUNT	   => l_total_rows,
373 		 		P_JSPROC	   => 'rows');
374 
375 		end if;  -- CD Buttons
376 
377 
378 	        -- display table header
379 		htp.tableOpen('BORDER=1');
380 		htp.p('<TR BGColor="#'||icx_util.get_color('TABLE_HEADER')||'">');
381 		for k in ak_query_pkg.g_items_table.FIRST..ak_query_pkg.g_items_table.LAST loop
382  		    if ak_query_pkg.g_items_table(k).secured_column = 'F' and
383 		       ak_query_pkg.g_items_table(k).node_display_flag = 'Y' then
384 		         htp.tableData(htf.strong(ak_query_pkg.g_items_table(k).attribute_label_long),'LEFT');
385                     end if;
386 		end loop;
387 		htp.tableRowClose;
388 
389             end if;  -- CD Buttons and table header
390 
391 
392  	    -- load data for current row into temp pl/sql table
393 	    icx_util.transfer_Row_To_Column(ak_query_pkg.g_results_table(i-1), l_result_row_table);
394 
395 
396 	    -- display one row of data
397 	    htp.p('<TR BGColor="#'||icx_util.get_color('TABLE_DATA_MULTIROW')||'">');
398 	    for k in ak_query_pkg.g_items_table.FIRST..ak_query_pkg.g_items_table.LAST loop
399 		if ak_query_pkg.g_items_table(k).secured_column = 'F' and
400 		   ak_query_pkg.g_items_table(k).node_display_flag = 'Y' then
401 
402 		     if (ak_query_pkg.g_items_table(k).attribute_code = 'ICX_RELATED_TEMPLATE' or
403 			 ak_query_pkg.g_items_table(k).attribute_code = 'ICX_RELATED_TEMPLATE_DESC') then
404 			 for x in ak_query_pkg.g_items_table.FIRST..ak_query_pkg.g_items_table.LAST loop
405 			     if ak_query_pkg.g_items_table(x).attribute_code = 'ICX_RELATION' then
406 			         temp_relation_item := x;
407 			     end if;
408 			 end loop;
409 		         -- dont display related category if relationship is TOP
410 			 if l_result_row_table(ak_query_pkg.g_items_table(temp_relation_item).value_id) = 'TOP' then
411 			     htp.tableData('<BR>');
412 			 else
413                              htp.p(icx_on_utilities.formatData(icx_on_utilities.formatText(l_result_row_table(ak_query_pkg.g_items_table(k).value_id),
414 ak_query_pkg.g_items_table(k).bold,ak_query_pkg.g_items_table(k).italic),ak_query_pkg.g_items_table(k).horizontal_alignment,ak_query_pkg.g_items_table(k).vertical_alignment));
415 			 end if;
416 		     else
417                          htp.p(icx_on_utilities.formatData(icx_on_utilities.formatText(l_result_row_table(ak_query_pkg.g_items_table(k).value_id),
418 ak_query_pkg.g_items_table(k).bold,ak_query_pkg.g_items_table(k).italic),ak_query_pkg.g_items_table(k).horizontal_alignment,ak_query_pkg.g_items_table(k).vertical_alignment));
419 		     end if;
420 		end if;
421 
422 		if ak_query_pkg.g_items_table(k).attribute_code = 'ICX_TEMPLATE1' then
423 		    temp_template := l_result_row_table(ak_query_pkg.g_items_table(k).value_id);
424 		end if;
425 
426 		if ak_query_pkg.g_items_table(k).attribute_code = 'ICX_RELATED_TEMPLATE' then
427 		    temp_related_template := l_result_row_table(ak_query_pkg.g_items_table(k).value_id);
428 		end if;
429 
430 	    end loop;
431 
432             htp.tableData(htf.anchor('javascript:delete_relation('''||icx_util.replace_quotes(temp_template)||''','''||icx_util.replace_quotes(temp_related_template)||''',
433 '''||replace(icx_util.replace_quotes(temp_template),' ','@~$')||''','''||replace(icx_util.replace_quotes(temp_related_template),' ','@~$')||''')',
434 htf.img('/OA_MEDIA/'||l_language||'/FNDIDELR.gif','CENTER',icx_util.replace_alt_quotes(l_prompts(6)),'',
435 'BORDER=0 WIDTH=16 HEIGHT=17'),'','onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(6))||''';return true"'));
436 
437 	    htp.tableRowClose;
438 
439 	end loop;  -- Display data
440 
441         htp.tableClose;
442 
443 
444 	-- print button set if appropriate
445         if (l_total_rows > l_query_size) and not
446 	   (p_start_row = 1 and l_end_row = l_total_rows) then
447 		 icx_on_utilities2.displaySetIcons (
448 			P_LANGUAGE_CODE    => l_language,
449 			P_PACKPROC	   => 'JS',
450 			P_START_ROW	   => p_start_row,
451 			P_STOP_ROW	   => l_end_row,
452 			P_ENCRYPTED_WHERE  => '1',
453 			P_QUERY_SET	   => l_query_size,
454 			P_ROW_COUNT	   => l_total_rows,
455 		 	P_JSPROC	   => 'rows');
456 
457         end if;
458 
459 
460 	-- display message if no rows were returned by query
461         if j = 0 then
462             fnd_message.set_name('ICX','ICX_TMP_NO_RELATION');
463             fnd_message.set_token('TEMPLATE',p_template);
464             htp.p('<H3>'||fnd_message.get||'</H3>');
465         end if;
466 
467 
468     else -- p_template is not valid
469 	if p_template is not null then
470 	    -- display message that category name is not valid
471 	    FND_MESSAGE.SET_NAME('ICX','ICX_INVALID_ENTRY');
472 	    FND_MESSAGE.SET_TOKEN('INVALID_TOKEN',p_template);
473 	    htp.p('<H3>'||FND_MESSAGE.Get||'<H3>');
474 	end if;
475 
476     end if;
477 
478 
479     htp.formClose;
480     htp.bodyClose;
481     htp.htmlClose;
482 
483 end if;  -- ValidateSession
484 
485 exception
486   when others then
487     err_num := SQLCODE;
488     temp_text := SQLERRM;
489     select substr(temp_text,12,512) into err_mesg from dual;
490          fnd_message.set_name('ICX','ICX_ERROR');
491          icx_util.add_error(err_mesg);
492          icx_admin_sig.error_screen(l_title,l_language);
493 
494 end template_tail;
495 
496 
497 
498 procedure template_insert(icx_template1 in varchar2 default null,
499 		          icx_relation in varchar2 default null,
500 		          icx_related_template in varchar2 default null) is
501 
502 l_return_status  varchar2(1) := 'S';
503 l_msg_count	 number;
504 l_msg_data	 varchar2(240);
505 l_user_id 	 number := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
506 
507 
508 begin
509 if icx_sec.validateSession then
510     icx_util.error_page_setup;
511 
512     -- insert top relation for this category if needed
513     if icx_relation = 'TOP' then
514 
515         ICX_Related_Templates_PUB.Insert_Relation
516         ( p_api_version_number 	=> 1.0				,
517           p_init_msg_list	=> FND_API.G_TRUE		,
518           p_simulate		=> FND_API.G_FALSE 		,
519           p_commit		=> FND_API.G_TRUE		,
520           p_validation_level	=> FND_API.G_VALID_LEVEL_FULL	,
521           p_return_status	=> l_return_status		,
522           p_msg_count		=> l_msg_count			,
523           p_msg_data		=> l_msg_data			,
524           p_template		=> icx_template1		,
525           p_related_template	=> icx_template1		,
526           p_relationship_type	=> 'TOP'			,
527           p_created_by		=> l_user_id
528         );
529 
530     end if;
531 
532 
533     -- insert child relation for this category if needed
534     if l_return_status = 'S' and icx_related_template is not null then
535         ICX_Related_Templates_PUB.Insert_Relation
536         ( p_api_version_number 	=> 1.0				,
537           p_init_msg_list	=> FND_API.G_FALSE		,
538           p_simulate		=> FND_API.G_FALSE 		,
539           p_commit		=> FND_API.G_TRUE		,
540           p_validation_level	=> FND_API.G_VALID_LEVEL_FULL	,
541           p_return_status	=> l_return_status		,
542           p_msg_count		=> l_msg_count			,
543           p_msg_data		=> l_msg_data			,
544           p_template		=> icx_template1			,
545           p_related_template	=> icx_related_template		,
546           p_relationship_type	=> 'CHILD'			,
547           p_created_by		=> l_user_id
548         );
549 
550     end if;
551 
552 
553     -- if API call did not succeed, then print errors with standard error page
554     if l_return_status <> 'S' then
555 
556 	icx_admin_sig.error_screen(null,null,l_msg_count,l_msg_data);
557 
558     else
559 
560         -- repaint header
561         icx_template_heirarchy.template_head(icx_template1,'T');
562 
563     end if;
564 
565 
566 end if;  -- ValidateSession
567 
568 end template_insert;
569 
570 
571 
572 procedure template_delete(icx_template1 in varchar2 default null,
573 		          icx_related_template in varchar2 default null) is
574 
575 l_return_status  varchar2(1) := 'S';
576 l_msg_count	 number;
577 l_msg_data	 varchar2(240);
578 l_user_id 	 number := icx_sec.getID(icx_sec.PV_WEB_USER_ID);
579 l_icx_template1  varchar2(240) := replace(icx_template1,'@~$',' ');
580 l_icx_related_template varchar2(240) := replace(icx_related_template,'@~$',' ');
581 
582 
583 begin
584 if icx_sec.validateSession then
585     icx_util.error_page_setup;
586 
587 
588     -- delete relation
589 
590         ICX_Related_Templates_PUB.Delete_Relation
591         ( p_api_version_number 	=> 1.0				,
592           p_init_msg_list	=> FND_API.G_TRUE		,
593           p_simulate		=> FND_API.G_FALSE 		,
594           p_commit		=> FND_API.G_TRUE		,
595           p_validation_level	=> FND_API.G_VALID_LEVEL_FULL	,
596           p_return_status	=> l_return_status		,
597           p_msg_count		=> l_msg_count			,
598           p_msg_data		=> l_msg_data			,
599           p_template		=> l_icx_template1		,
600           p_related_template	=> l_icx_related_template
601         );
602 
603 
604     -- if API call did not succeed, then print errors with standard error page
605     if l_return_status <> 'S' then
606 
607 	icx_admin_sig.error_screen(null,null,l_msg_count,l_msg_data);
608 
609     else
610 
611         -- repaint relationships
612         icx_template_heirarchy.template_tail(l_icx_template1);
613 
614     end if;
615 
616 
617 end if;  -- ValidateSession
618 
619 end template_delete;
620 
621 
622 
623 
624 end icx_template_heirarchy;