1 package body FND_FORM_CUSTOM_RULES_PKG as
2 /* $Header: AFFRRULB.pls 120.4 2005/08/23 17:39:52 dbowles noship $ */
3 g_function_rows_deleted VARCHAR2(30) := 'NULL';
4 g_form_rows_deleted VARCHAR2(30) := 'NULL';
5 g_industry_rows_deleted VARCHAR2(30) := 'NULL';
6 PROCEDURE DELETE_ROWS(
7 X_FUNCTION_NAME IN VARCHAR2) IS
8
9 BEGIN
10 if g_function_rows_deleted = X_FUNCTION_NAME then
11 RETURN;
12 else
13 delete from fnd_form_custom_params
14 where action_id in (select action_id
15 from fnd_form_custom_actions a , fnd_form_custom_rules r
16 where a.rule_id = r.id
17 and r.created_by <> 1
18 and r.function_name = X_FUNCTION_NAME
19 and (r.rule_type = 'A'or r.rule_type is null));
20 delete from fnd_form_custom_actions
21 where rule_id in (select id
22 from fnd_form_custom_rules r
23 where r.created_by <> 1
24 and r.function_name = X_FUNCTION_NAME
25 and (r.rule_type = 'A'or r.rule_type is null));
26 delete from fnd_form_custom_scopes
27 where rule_id in (select id
28 from fnd_form_custom_rules r
29 where r.created_by <> 1
30 and r.function_name = X_FUNCTION_NAME
31 and (r.rule_type = 'A'or r.rule_type is null));
32 delete from fnd_form_custom_rules
33 where created_by <> 1
34 and function_name = X_FUNCTION_NAME
35 and (rule_type = 'A'or rule_type is null);
36 g_function_rows_deleted := X_FUNCTION_NAME;
37 end if;
38 END DELETE_ROWS;
39
40 PROCEDURE DELETE_FORM_ROWS(
41 X_FORM_NAME IN VARCHAR2) IS
42
43 BEGIN
44 if g_form_rows_deleted = X_FORM_NAME then
45 RETURN;
46 else
47 delete from fnd_form_custom_params
48 where action_id in (select action_id
49 from fnd_form_custom_actions a , fnd_form_custom_rules r
50 where a.rule_id = r.id
51 and r.created_by <> 1
52 and r.form_name = X_FORM_NAME
53 and r.rule_type = 'F');
54 delete from fnd_form_custom_actions
55 where rule_id in (select id
56 from fnd_form_custom_rules r
57 where r.created_by <> 1
58 and r.form_name = X_FORM_NAME
59 and r.rule_type = 'F');
60 delete from fnd_form_custom_scopes
61 where rule_id in (select id
62 from fnd_form_custom_rules r
63 where r.created_by <> 1
64 and r.form_name = X_FORM_NAME
65 and r.rule_type = 'F');
66 delete from fnd_form_custom_rules
67 where created_by <> 1
68 and form_name = X_FORM_NAME
69 and rule_type = 'F';
70 g_form_rows_deleted := X_FORM_NAME;
71 end if;
72 END DELETE_FORM_ROWS;
73
74 PROCEDURE DELETE_INDUSTRY_ROWS(
75 X_RULE_KEY IN VARCHAR2,
76 X_FORM_NAME IN VARCHAR2 DEFAULT NULL) IS
77
78 BEGIN
79
80 if (g_form_rows_deleted = X_FORM_NAME OR X_FORM_NAME IS NULL)
81 AND g_industry_rows_deleted = X_RULE_KEY then
82 RETURN;
83 else
84 delete from fnd_form_custom_params
85 where action_id in (select action_id
86 from fnd_form_custom_actions a , fnd_form_custom_rules r
87 where a.rule_id = r.id
88 and r.created_by = 8
89 and r.rule_key = X_RULE_KEY
90 and X_FORM_NAME IS NULL or (X_FORM_NAME IS NOT NULL and
91 r.form_name = X_FORM_NAME));
92 delete from fnd_form_custom_actions
93 where rule_id in (select id
94 from fnd_form_custom_rules r
95 where r.created_by = 8
96 and r.rule_key = X_RULE_KEY
97 and X_FORM_NAME IS NULL or (X_FORM_NAME IS NOT NULL and
98 r.form_name = X_FORM_NAME));
99 delete from fnd_form_custom_scopes
100 where rule_id in (select id
101 from fnd_form_custom_rules r
102 where r.created_by = 8
103 and r.rule_key = X_RULE_KEY
104 and X_FORM_NAME IS NULL or (X_FORM_NAME IS NOT NULL and
105 r.form_name = X_FORM_NAME));
106 delete from fnd_form_custom_rules
107 where created_by = 8
108 and rule_key = X_RULE_KEY
109 and X_FORM_NAME IS NULL or (X_FORM_NAME IS NOT NULL and
110 form_name = X_FORM_NAME);
111 g_form_rows_deleted := X_FORM_NAME;
112 g_industry_rows_deleted := X_RULE_KEY;
113 end if;
114 END DELETE_INDUSTRY_ROWS;
115
116 END FND_FORM_CUSTOM_RULES_PKG;