| |
|
1 |
|
| |
|
2 |
|
| |
|
3 |
|
| |
|
4 |
|
| |
|
5 |
|
| |
|
6 |
|
| |
|
7 |
|
| |
|
8 |
|
| |
|
9 |
create or replace package bt_bug |
| |
|
10 |
as |
| |
|
11 |
function new ( |
| |
|
12 |
bug_id in integer default null, |
| |
|
13 |
bug_number in integer default null, |
| |
|
14 |
package_id in integer, |
| |
|
15 |
component_id in integer, |
| |
|
16 |
found_in_version in integer, |
| |
|
17 |
summary in varchar2, |
| |
|
18 |
user_agent in varchar2 default null, |
| |
|
19 |
comment_content in varchar2, |
| |
|
20 |
comment_format in varchar2, |
| |
|
21 |
creation_date in date default sysdate(), |
| |
|
22 |
creation_user in integer, |
| |
|
23 |
creation_ip in varchar2 default null, |
| |
|
24 |
fix_for_version in integer default null, |
| |
|
25 |
item_subtype in varchar2 default 'bt_bug', |
| |
|
26 |
content_type in varchar2 default 'bt_bug_revision' |
| |
|
27 |
) return integer; |
| |
|
28 |
|
| |
|
29 |
procedure del ( |
| |
|
30 |
bug_id in integer |
| |
|
31 |
); |
| |
|
32 |
|
| |
|
33 |
function name ( |
| |
|
34 |
bug_id in integer |
| |
|
35 |
) return varchar2; |
| |
|
36 |
|
| |
|
37 |
end bt_bug; |
| |
|
38 |
/ |
| |
|
39 |
show errors |
| |
|
40 |
|
| |
|
41 |
|
| |
|
42 |
create or replace package body bt_bug |
| |
|
43 |
as |
| |
|
44 |
function new ( |
| |
|
45 |
bug_id in integer default null, |
| |
|
46 |
bug_number in integer default null, |
| |
|
47 |
package_id in integer, |
| |
|
48 |
component_id in integer, |
| |
|
49 |
found_in_version in integer, |
| |
|
50 |
summary in varchar2, |
| |
|
51 |
user_agent in varchar2 default null, |
| |
|
52 |
comment_content in varchar2, |
| |
|
53 |
comment_format in varchar2, |
| |
|
54 |
creation_date in date default sysdate(), |
| |
|
55 |
creation_user in integer, |
| |
|
56 |
creation_ip in varchar2 default null, |
| |
|
57 |
fix_for_version in integer default null, |
| |
|
58 |
item_subtype in varchar2 default 'bt_bug', |
| |
|
59 |
content_type in varchar2 default 'bt_bug_revision' |
| |
|
60 |
) return integer |
| |
|
61 |
is |
| |
|
62 |
v_bug_id integer; |
| |
|
63 |
v_revision_id integer; |
| |
|
64 |
v_bug_number integer; |
| |
|
65 |
v_folder_id integer; |
| |
|
66 |
begin |
| |
|
67 |
|
| |
|
68 |
select folder_id |
| |
|
69 |
into v_folder_id |
| |
|
70 |
from bt_projects |
| |
|
71 |
where project_id = bt_bug.new.package_id; |
| |
|
72 |
|
| |
|
73 |
|
| |
|
74 |
if bug_number is null then |
| |
|
75 |
select nvl(max(bug_number),0) + 1 |
| |
|
76 |
into v_bug_number |
| |
|
77 |
from bt_bugs |
| |
|
78 |
where parent_id = v_folder_id; |
| |
|
79 |
else |
| |
|
80 |
v_bug_number := bug_number; |
| |
|
81 |
end if; |
| |
|
82 |
|
| |
|
83 |
|
| |
|
84 |
v_bug_id := content_item.new( |
| |
|
85 |
name => v_bug_number, |
| |
|
86 |
parent_id => v_folder_id, |
| |
|
87 |
item_id => bt_bug.new.bug_id, |
| |
|
88 |
locale => null, |
| |
|
89 |
creation_date => bt_bug.new.creation_date, |
| |
|
90 |
creation_user => bt_bug.new.creation_user, |
| |
|
91 |
context_id => v_folder_id, |
| |
|
92 |
creation_ip => bt_bug.new.creation_ip, |
| |
|
93 |
item_subtype => bt_bug.new.item_subtype, |
| |
|
94 |
content_type => bt_bug.new.content_type, |
| |
|
95 |
title => null, |
| |
|
96 |
description => null, |
| |
|
97 |
nls_language => null, |
| |
|
98 |
mime_type => null, |
| |
|
99 |
data => null |
| |
|
100 |
); |
| |
|
101 |
|
| |
|
102 |
|
| |
|
103 |
insert into bt_bugs |
| |
|
104 |
(bug_id, |
| |
|
105 |
bug_number, |
| |
|
106 |
comment_content, |
| |
|
107 |
comment_format, |
| |
|
108 |
parent_id, |
| |
|
109 |
project_id, |
| |
|
110 |
creation_date, |
| |
|
111 |
creation_user, |
| |
|
112 |
fix_for_version) |
| |
|
113 |
values |
| |
|
114 |
(v_bug_id, |
| |
|
115 |
v_bug_number, |
| |
|
116 |
bt_bug.new.comment_content, |
| |
|
117 |
bt_bug.new.comment_format, |
| |
|
118 |
v_folder_id, |
| |
|
119 |
bt_bug.new.package_id, |
| |
|
120 |
bt_bug.new.creation_date, |
| |
|
121 |
bt_bug.new.creation_user, |
| |
|
122 |
bt_bug.new.fix_for_version); |
| |
|
123 |
|
| |
|
124 |
|
| |
|
125 |
v_revision_id := bt_bug_revision.new( |
| |
|
126 |
bug_revision_id => null, |
| |
|
127 |
bug_id => v_bug_id, |
| |
|
128 |
component_id => bt_bug.new.component_id, |
| |
|
129 |
found_in_version => bt_bug.new.found_in_version, |
| |
|
130 |
fix_for_version => null, |
| |
|
131 |
fixed_in_version => bt_bug.new.fix_for_version, |
| |
|
132 |
resolution => null, |
| |
|
133 |
user_agent => bt_bug.new.user_agent, |
| |
|
134 |
summary => bt_bug.new.summary, |
| |
|
135 |
creation_date => bt_bug.new.creation_date, |
| |
|
136 |
creation_user => bt_bug.new.creation_user, |
| |
|
137 |
creation_ip => bt_bug.new.creation_ip |
| |
|
138 |
); |
| |
|
139 |
|
| |
|
140 |
return v_bug_id; |
| |
|
141 |
end new; |
| |
|
142 |
|
| |
|
143 |
procedure del ( |
| |
|
144 |
bug_id in integer |
| |
|
145 |
) |
| |
|
146 |
is |
| |
|
147 |
v_case_id integer; |
| |
|
148 |
foo integer; |
| |
|
149 |
begin |
| |
|
150 |
|
| |
|
151 |
select case_id into v_case_id |
| |
|
152 |
from workflow_cases |
| |
|
153 |
where object_id = bt_bug.del.bug_id; |
| |
|
154 |
|
| |
|
155 |
foo := workflow_case_pkg.del(v_case_id); |
| |
|
156 |
|
| |
|
157 |
|
| |
|
158 |
|
| |
|
159 |
|
| |
|
160 |
for rec in (select notification_id from notifications where response_id = bt_bug.del.bug_id) |
| |
|
161 |
loop |
| |
|
162 |
notification.del (rec.notification_id); |
| |
|
163 |
end loop; |
| |
|
164 |
|
| |
|
165 |
acs_object.del(bug_id); |
| |
|
166 |
|
| |
|
167 |
return; |
| |
|
168 |
end del; |
| |
|
169 |
|
| |
|
170 |
function name ( |
| |
|
171 |
bug_id in integer |
| |
|
172 |
) return varchar2 |
| |
|
173 |
is |
| |
|
174 |
v_name bt_bugs.summary%TYPE; |
| |
|
175 |
begin |
| |
|
176 |
select summary |
| |
|
177 |
into v_name |
| |
|
178 |
from bt_bugs |
| |
|
179 |
where bug_id = name.bug_id; |
| |
|
180 |
|
| |
|
181 |
return v_name; |
| |
|
182 |
end name; |
| |
|
183 |
|
| |
|
184 |
end bt_bug; |
| |
|
185 |
/ |
| |
|
186 |
show errors |