[Home] [Help]
PACKAGE BODY: APPS.JTF_TASK_RECURRENCES_PUB
Source
1 PACKAGE BODY jtf_task_recurrences_pub AS
2 /* $Header: jtfptkub.pls 115.25 2002/12/06 02:00:23 sachoudh ship $ */
3 PROCEDURE create_task_recurrence (
4 p_api_version IN NUMBER,
5 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
6 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
7 p_task_id IN NUMBER DEFAULT NULL,
8 p_task_number IN VARCHAR2 DEFAULT NULL,
9 p_occurs_which IN INTEGER DEFAULT NULL,
10 p_template_flag IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
11 p_day_of_week IN INTEGER DEFAULT NULL,
12 p_date_of_month IN INTEGER DEFAULT NULL,
13 p_occurs_month IN INTEGER DEFAULT NULL,
14 p_occurs_uom IN VARCHAR2 DEFAULT NULL,
15 p_occurs_every IN INTEGER DEFAULT NULL,
16 p_occurs_number IN INTEGER DEFAULT NULL,
17 p_start_date_active IN DATE DEFAULT NULL,
18 p_end_date_active IN DATE DEFAULT NULL,
19 x_return_status OUT NOCOPY VARCHAR2,
20 x_msg_count OUT NOCOPY NUMBER,
21 x_msg_data OUT NOCOPY VARCHAR2,
22 x_recurrence_rule_id OUT NOCOPY NUMBER,
23 x_task_rec OUT NOCOPY jtf_task_recurrences_pub.task_details_rec,
24 x_reccurences_generated OUT NOCOPY INTEGER,
25 p_attribute1 IN VARCHAR2 DEFAULT null ,
26 p_attribute2 IN VARCHAR2 DEFAULT null ,
27 p_attribute3 IN VARCHAR2 DEFAULT null ,
28 p_attribute4 IN VARCHAR2 DEFAULT null ,
29 p_attribute5 IN VARCHAR2 DEFAULT null ,
30 p_attribute6 IN VARCHAR2 DEFAULT null ,
31 p_attribute7 IN VARCHAR2 DEFAULT null ,
32 p_attribute8 IN VARCHAR2 DEFAULT null ,
33 p_attribute9 IN VARCHAR2 DEFAULT null ,
34 p_attribute10 IN VARCHAR2 DEFAULT null ,
35 p_attribute11 IN VARCHAR2 DEFAULT null ,
36 p_attribute12 IN VARCHAR2 DEFAULT null ,
37 p_attribute13 IN VARCHAR2 DEFAULT null ,
38 p_attribute14 IN VARCHAR2 DEFAULT null ,
39 p_attribute15 IN VARCHAR2 DEFAULT null ,
40 p_attribute_category IN VARCHAR2 DEFAULT null ,
41 p_sunday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
42 p_monday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
43 p_tuesday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
44 p_wednesday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
45 p_thursday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
46 p_friday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
47 p_saturday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char
48 )
49 IS
50 l_api_version CONSTANT NUMBER := 1.0;
51 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK_RECURRENCE';
52 l_task_id jtf_tasks_b.task_id%TYPE;
53 l_recurrence_rule_id jtf_task_recur_rules.recurrence_rule_id%TYPE;
54 l_output_dates_tbl jtf_task_recurrences_pub.output_dates_rec;
55 l_template_flag CHAR := p_template_flag;
56 l_output_dates_counter NUMBER;
57 l_rowid ROWID;
58 x CHAR;
59
60 CURSOR c_jtf_task_recurrences (
61 l_rowid IN ROWID
62 )
63 IS
64 SELECT 1
65 FROM jtf_task_recur_rules
66 WHERE ROWID = l_rowid;
67 BEGIN
68 SAVEPOINT create_task_recurrence_pub;
69 x_return_status := fnd_api.g_ret_sts_success;
70
71 IF NOT fnd_api.compatible_api_call (l_api_version, p_api_version, l_api_name, g_pkg_name)
72 THEN
73 RAISE fnd_api.g_exc_unexpected_error;
74 END IF;
75
76 IF fnd_api.to_boolean (p_init_msg_list)
77 THEN
78 fnd_msg_pub.initialize;
79 END IF;
80
81
82
83 IF jtf_task_utl.to_boolean (l_template_flag)
84 THEN
85 jtf_task_utl.validate_task_template (
86 x_return_status => x_return_status,
87 p_task_id => p_task_id,
88 p_task_number => p_task_number,
89 x_task_id => l_task_id
90 );
91
92 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
93 THEN
94 x_return_status := fnd_api.g_ret_sts_unexp_error;
95 RAISE fnd_api.g_exc_unexpected_error;
96 END IF;
97
98
99
100 ELSE
101 jtf_task_utl.validate_task (
102 x_return_status => x_return_status,
103 p_task_id => p_task_id,
104 p_task_number => p_task_number,
105 x_task_id => l_task_id
106 );
107
108 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
109 THEN
110 x_return_status := fnd_api.g_ret_sts_unexp_error;
111 RAISE fnd_api.g_exc_unexpected_error;
112 END IF;
113 END IF;
114
115 IF l_task_id IS NULL
116 THEN
117 x_return_status := fnd_api.g_ret_sts_unexp_error;
118 fnd_message.set_name ('JTF', 'JTF_TASK_MISSING_TASK');
119 fnd_msg_pub.add;
120 RAISE fnd_api.g_exc_unexpected_error;
121 END IF;
122
123
124 jtf_task_recurrences_pvt.create_task_recurrence (
125 p_api_version => 1.0,
126 p_init_msg_list => 'F',
127 p_commit => 'F',
128 p_task_id => p_task_id,
129 p_occurs_which => p_occurs_which,
130 p_day_of_week => p_day_of_week,
131 p_date_of_month => p_date_of_month,
132 p_occurs_month => p_occurs_month,
133 p_occurs_uom => p_occurs_uom,
134 p_occurs_every => p_occurs_every,
135 p_occurs_number => p_occurs_number,
136 p_start_date_active => p_start_date_active,
137 p_end_date_active => p_end_date_active,
138 p_template_flag => p_template_flag ,
139 x_return_status => x_return_status,
140 x_msg_count => x_msg_count,
141 x_msg_data => x_msg_data,
142 x_recurrence_rule_id => x_recurrence_rule_id,
143 x_task_rec => x_task_rec,
144 x_output_dates_counter => x_reccurences_generated,
145 p_attribute1 => p_attribute1 ,
146 p_attribute2 => p_attribute2 ,
147 p_attribute3 => p_attribute3 ,
148 p_attribute4 => p_attribute4 ,
149 p_attribute5 => p_attribute5 ,
150 p_attribute6 => p_attribute6 ,
151 p_attribute7 => p_attribute7 ,
152 p_attribute8 => p_attribute8 ,
153 p_attribute9 => p_attribute9 ,
154 p_attribute10 => p_attribute10 ,
155 p_attribute11 => p_attribute11 ,
156 p_attribute12 => p_attribute12 ,
157 p_attribute13 => p_attribute13 ,
158 p_attribute14 => p_attribute14 ,
159 p_attribute15 => p_attribute15,
160 p_attribute_category => p_attribute_category,
161 p_sunday => p_sunday,
162 p_monday => p_monday,
163 p_tuesday => p_tuesday,
164 p_wednesday => p_wednesday,
165 p_thursday => p_thursday,
166 p_friday => p_friday,
167 p_saturday => p_saturday
168 );
169
170 IF (x_return_status = fnd_api.g_ret_sts_error)
171 THEN
172 RAISE fnd_api.g_exc_error;
173 ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error)
174 THEN
175 RAISE fnd_api.g_exc_unexpected_error;
176 END IF;
177
178 IF fnd_api.to_boolean (p_commit)
179 THEN
180 COMMIT WORK;
181 END IF;
182
183 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
184 EXCEPTION
185 WHEN fnd_api.g_exc_unexpected_error
186 THEN
187 ROLLBACK TO create_task_recurrence_pub;
188 x_return_status := fnd_api.g_ret_sts_unexp_error;
189 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
190 WHEN OTHERS
191 THEN
192
193
194 ROLLBACK TO create_task_recurrence_pub;
195 x_return_status := fnd_api.g_ret_sts_unexp_error;
196 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
197 END;
198
199 PROCEDURE update_task_recurrence (
200 p_api_version IN NUMBER,
201 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
202 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
203 p_task_id IN NUMBER,
204 p_recurrence_rule_id IN NUMBER,
205 p_occurs_which IN INTEGER DEFAULT NULL,
206 p_day_of_week IN INTEGER DEFAULT NULL,
207 p_date_of_month IN INTEGER DEFAULT NULL,
208 p_occurs_month IN INTEGER DEFAULT NULL,
209 p_occurs_uom IN VARCHAR2 DEFAULT NULL,
210 p_occurs_every IN INTEGER DEFAULT NULL,
211 p_occurs_number IN INTEGER DEFAULT NULL,
212 p_start_date_active IN DATE DEFAULT NULL,
213 p_end_date_active IN DATE DEFAULT NULL,
214 p_template_flag IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
215 p_attribute1 IN VARCHAR2 DEFAULT NULL ,
216 p_attribute2 IN VARCHAR2 DEFAULT NULL ,
217 p_attribute3 IN VARCHAR2 DEFAULT NULL ,
218 p_attribute4 IN VARCHAR2 DEFAULT NULL ,
219 p_attribute5 IN VARCHAR2 DEFAULT NULL ,
220 p_attribute6 IN VARCHAR2 DEFAULT NULL ,
221 p_attribute7 IN VARCHAR2 DEFAULT NULL ,
222 p_attribute8 IN VARCHAR2 DEFAULT NULL ,
223 p_attribute9 IN VARCHAR2 DEFAULT NULL ,
224 p_attribute10 IN VARCHAR2 DEFAULT NULL ,
225 p_attribute11 IN VARCHAR2 DEFAULT NULL ,
226 p_attribute12 IN VARCHAR2 DEFAULT NULL ,
227 p_attribute13 IN VARCHAR2 DEFAULT NULL ,
228 p_attribute14 IN VARCHAR2 DEFAULT NULL ,
229 p_attribute15 IN VARCHAR2 DEFAULT NULL ,
230 p_attribute_category IN VARCHAR2 DEFAULT NULL ,
231 p_sunday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
232 p_monday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
233 p_tuesday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
234 p_wednesday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
235 p_thursday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
236 p_friday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
237 p_saturday IN VARCHAR2 DEFAULT jtf_task_utl.g_no_char,
238 x_new_recurrence_rule_id OUT NOCOPY NUMBER,
239 x_return_status OUT NOCOPY VARCHAR2,
240 x_msg_count OUT NOCOPY NUMBER,
241 x_msg_data OUT NOCOPY VARCHAR2
242 )
243 IS
244 BEGIN
245 SAVEPOINT update_task_recurrence_pub;
246
247 x_return_status := fnd_api.g_ret_sts_success;
248
249 IF fnd_api.to_boolean (p_init_msg_list)
250 THEN
251 fnd_msg_pub.initialize;
252 END IF;
253
254 jtf_task_recurrences_pvt.update_task_recurrence (
255 p_api_version => 1.0,
256 p_init_msg_list => fnd_api.g_false,
257 p_commit => fnd_api.g_false,
258 p_task_id => p_task_id,
259 p_recurrence_rule_id => p_recurrence_rule_id,
260 p_occurs_which => p_occurs_which,
261 p_day_of_week => p_day_of_week,
262 p_date_of_month => p_date_of_month,
263 p_occurs_month => p_occurs_month,
264 p_occurs_uom => p_occurs_uom,
265 p_occurs_every => p_occurs_every,
266 p_occurs_number => p_occurs_number,
267 p_start_date_active => p_start_date_active,
268 p_end_date_active => p_end_date_active,
269 p_template_flag => p_template_flag,
270 p_attribute1 => p_attribute1,
271 p_attribute2 => p_attribute2,
272 p_attribute3 => p_attribute3,
273 p_attribute4 => p_attribute4,
274 p_attribute5 => p_attribute5,
275 p_attribute6 => p_attribute6,
276 p_attribute7 => p_attribute7,
277 p_attribute8 => p_attribute8,
278 p_attribute9 => p_attribute9,
279 p_attribute10 => p_attribute10,
280 p_attribute11 => p_attribute11,
281 p_attribute12 => p_attribute12,
282 p_attribute13 => p_attribute13,
283 p_attribute14 => p_attribute14,
284 p_attribute15 => p_attribute15,
285 p_attribute_category => p_attribute_category,
286 p_sunday => p_sunday,
287 p_monday => p_monday,
288 p_tuesday => p_tuesday,
289 p_wednesday => p_wednesday,
290 p_thursday => p_thursday,
291 p_friday => p_friday,
292 p_saturday => p_saturday,
293 x_new_recurrence_rule_id => x_new_recurrence_rule_id,
294 x_return_status => x_return_status,
295 x_msg_count => x_msg_count,
296 x_msg_data => x_msg_data
297 );
298
299 IF fnd_api.to_boolean (p_commit)
300 THEN
301 COMMIT WORK;
302 END IF;
303
304 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
305 EXCEPTION
306 WHEN fnd_api.g_exc_unexpected_error
307 THEN
308 ROLLBACK TO update_task_recurrence_pub;
309 x_return_status := fnd_api.g_ret_sts_unexp_error;
310 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
311 WHEN OTHERS
312 THEN
313 ROLLBACK TO update_task_recurrence_pub;
314 x_return_status := fnd_api.g_ret_sts_unexp_error;
315 fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
316 END update_task_recurrence;
317
318 END;