1 PACKAGE OTA_EVT_SHD AUTHID CURRENT_USER as
2 /* $Header: otevt01t.pkh 120.0 2005/05/29 07:14:01 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 event_id number(9),
11 vendor_id number(15),
12 activity_version_id number(9),
13 business_group_id number(9),
14 organization_id number(9),
15 event_type varchar2(30),
16 object_version_number number(9), -- Increased length
17 title varchar2(80),
18 budget_cost number,
19 actual_cost number,
20 budget_currency_code varchar2(30),
21 centre varchar2(30),
22 comments varchar2(2000),
23 course_end_date date,
24 course_end_time varchar2(9), -- Increased length
25 course_start_date date,
26 course_start_time varchar2(9), -- Increased length
27 duration number,
28 duration_units varchar2(30),
29 enrolment_end_date date,
30 enrolment_start_date date,
31 language_id number(9),
32 user_status varchar2(80),
33 development_event_type varchar2(30),
34 event_status varchar2(30),
35 price_basis varchar2(30),
36 currency_code varchar2(30),
37 maximum_attendees number(9),
38 maximum_internal_attendees number(9),
39 minimum_attendees number(9),
40 standard_price number,
41 category_code varchar2(30),
42 parent_event_id number(9),
43 book_independent_flag varchar2(30),
44 public_event_flag varchar2(30),
45 secure_event_flag varchar2(30),
46 evt_information_category varchar2(30),
47 evt_information1 varchar2(150),
48 evt_information2 varchar2(150),
49 evt_information3 varchar2(150),
50 evt_information4 varchar2(150),
51 evt_information5 varchar2(150),
52 evt_information6 varchar2(150),
53 evt_information7 varchar2(150),
54 evt_information8 varchar2(150),
55 evt_information9 varchar2(150),
56 evt_information10 varchar2(150),
57 evt_information11 varchar2(150),
58 evt_information12 varchar2(150),
59 evt_information13 varchar2(150),
60 evt_information14 varchar2(150),
61 evt_information15 varchar2(150),
62 evt_information16 varchar2(150),
63 evt_information17 varchar2(150),
64 evt_information18 varchar2(150),
65 evt_information19 varchar2(150),
66 evt_information20 varchar2(150),
67 project_id number(15),
68 owner_id number(10),
69 line_id number(15),
70 org_id number(15),
71 training_center_id number(15),
72 location_id number(15),
73 offering_id number,
74 timezone varchar2(30),
75 parent_offering_id number,
76 data_source varchar2(30)
77 );
78 --
79 -- ----------------------------------------------------------------------------
80 -- | Global Definitions - Internal Development Use Only |
81 -- ----------------------------------------------------------------------------
82 --
83 g_old_rec g_rec_type; -- Global record definition
84 g_api_dml boolean; -- Global api dml status
85 g_tab_nam constant varchar2(30) := 'OTA_EVENTS' ;
86 --
87 -- ----------------------------------------------------------------------------
88 -- |------------------------< return_api_dml_status >-------------------------|
89 -- ----------------------------------------------------------------------------
90 -- {Start Of Comments}
91 --
92 -- Description:
93 -- This function will return the current g_api_dml private global
94 -- boolean status.
95 -- The g_api_dml status determines if at the time of the function
96 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
97 -- is being issued from within an api.
98 -- If the status is TRUE then a dml statement is being issued from
99 -- within this entity api.
100 -- This function is primarily to support database triggers which
101 -- need to maintain the object_version_number for non-supported
102 -- dml statements (i.e. dml statement issued outside of the api layer).
103 --
104 -- Pre Conditions:
105 -- None.
106 --
107 -- In Arguments:
108 -- None.
109 --
110 -- Post Success:
111 -- Processing continues.
112 -- If the function returns a TRUE value then, dml is being executed from
113 -- within this api.
114 --
115 -- Post Failure:
116 -- None.
117 --
118 -- Access Status:
119 -- Public.
120 --
121 -- {End Of Comments}
122 -- ----------------------------------------------------------------------------
123 Function return_api_dml_status Return Boolean;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------< constraint_error >---------------------------|
127 -- ----------------------------------------------------------------------------
128 -- {Start Of Comments}
129 --
130 -- Description:
131 -- This procedure is called when a constraint has been violated (i.e.
132 -- The exception hr_api.check_integrity_violated,
133 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
134 -- hr_api.unique_integrity_violated has been raised).
135 -- The exceptions can only be raised as follows:
136 -- 1) A check constraint can only be violated during an INSERT or UPDATE
137 -- dml operation.
138 -- 2) A parent integrity constraint can only be violated during an
139 -- INSERT or UPDATE dml operation.
140 -- 3) A child integrity constraint can only be violated during an
141 -- DELETE dml operation.
142 -- 4) A unique integrity constraint can only be violated during INSERT or
143 -- UPDATE dml operation.
144 --
145 -- Pre Conditions:
146 -- 1) Either hr_api.check_integrity_violated,
147 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
148 -- hr_api.unique_integrity_violated has been raised with the subsequent
149 -- stripping of the constraint name from the generated error message
150 -- text.
151 -- 2) Standalone validation test which correspond with a constraint error.
152 --
153 -- In Arguments:
154 -- p_constraint_name is in upper format and is just the constraint name
155 -- (e.g. not prefixed by brackets, schema owner etc).
156 --
157 -- Post Success:
158 -- Development dependant.
159 --
160 -- Post Failure:
161 -- Developement dependant.
162 --
163 -- Developer Implementation Notes:
164 -- For each constraint being checked the hr system package failure message
165 -- has been generated as a template only. These system error messages should
166 -- be modified as required (i.e. change the system failure message to a user
167 -- friendly defined error message).
168 --
169 -- Access Status:
170 -- Public.
171 --
172 -- {End Of Comments}
173 -- ----------------------------------------------------------------------------
174 Procedure constraint_error
175 (p_constraint_name in varchar2);
176 --
177 -- ----------------------------------------------------------------------------
178 -- |-----------------------------< api_updating >-----------------------------|
179 -- ----------------------------------------------------------------------------
180 -- {Start Of Comments}
181 --
182 -- Description:
183 -- This function is used to populate the g_old_rec record with the
184 -- current row from the database for the specified primary key
185 -- provided that the primary key exists and is valid and does not
186 -- already match the current g_old_rec. The function will always return
187 -- a TRUE value if the g_old_rec is populated with the current row.
188 -- A FALSE value will be returned if all of the primary key arguments
189 -- are null.
190 --
191 -- Pre Conditions:
192 -- None.
193 --
194 -- In Arguments:
195 --
196 -- Post Success:
197 -- A value of TRUE will be returned indiciating that the g_old_rec
198 -- is current.
199 -- A value of FALSE will be returned if all of the primary key arguments
200 -- have a null value (this indicates that the row has not be inserted into
201 -- the Schema), and therefore could never have a corresponding row.
202 --
203 -- Post Failure:
204 -- A failure can only occur under two circumstances:
205 -- 1) The primary key is invalid (i.e. a row does not exist for the
206 -- specified primary key values).
207 -- 2) If an object_version_number exists but is NOT the same as the current
208 -- g_old_rec value.
209 --
210 -- Developer Implementation Notes:
211 -- None.
212 --
213 -- Access Status:
214 -- Internal Development Use Only.
215 --
216 -- {End Of Comments}
217 -- ----------------------------------------------------------------------------
218 Function api_updating
219 (
220 p_event_id in number,
221 p_object_version_number in number
222 ) Return Boolean;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |---------------------------------< lck >----------------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 -- The Lck process has two main functions to perform. Firstly, the row to be
231 -- updated or deleted must be locked. The locking of the row will only be
232 -- successful if the row is not currently locked by another user.
233 -- Secondly, during the locking of the row, the row is selected into
234 -- the g_old_rec data structure which enables the current row values from the
235 -- server to be available to the api.
236 --
237 -- Pre Conditions:
238 -- When attempting to call the lock the object version number (if defined)
239 -- is mandatory.
240 --
241 -- In Arguments:
242 -- The arguments to the Lck process are the primary key(s) which uniquely
243 -- identify the row and the object version number of row.
244 --
245 -- Post Success:
246 -- On successful completion of the Lck process the row to be updated or
247 -- deleted will be locked and selected into the global data structure
248 -- g_old_rec.
249 --
250 -- Post Failure:
251 -- The Lck process can fail for three reasons:
252 -- 1) When attempting to lock the row the row could already be locked by
253 -- another user. This will raise the HR_Api.Object_Locked exception.
254 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
255 -- This error is trapped and reported using the message name
256 -- 'HR_7220_INVALID_PRIMARY_KEY'.
257 -- 3) The row although existing in the HR Schema has a different object
258 -- version number than the object version number specified.
259 -- This error is trapped and reported using the message name
260 -- 'HR_7155_OBJECT_INVALID'.
261 --
262 -- Developer Implementation Notes:
263 -- For each primary key and the object version number arguments add a
264 -- call to hr_api.mandatory_arg_error procedure to ensure that these
265 -- argument values are not null.
266 --
267 -- Access Status:
268 -- Public.
269 --
270 -- {End Of Comments}
271 -- ----------------------------------------------------------------------------
272 Procedure lck
273 (
274 p_event_id in number,
275 p_object_version_number in number
276 );
277 --
278 -- ----------------------------------------------------------------------------
279 -- |-----------------------------< convert_args >-----------------------------|
280 -- ----------------------------------------------------------------------------
281 -- {Start Of Comments}
282 --
283 -- Description:
284 -- This function is used to turn attribute arguments into the record
285 -- structure g_rec_type.
286 --
287 -- Pre Conditions:
288 -- This is a private function and can only be called from the ins or upd
289 -- attribute processes.
290 --
291 -- In Arguments:
292 --
293 -- Post Success:
294 -- A returning record structure will be returned.
295 --
296 -- Post Failure:
297 -- No direct error handling is required within this function. Any possible
298 -- errors within this function will be a PL/SQL value error due to conversion
299 -- of datatypes or data lengths.
300 --
301 -- Developer Implementation Notes:
302 -- None.
303 --
304 -- Access Status:
305 -- Internal Development Use Only.
306 --
307 -- {End Of Comments}
308 -- ----------------------------------------------------------------------------
309 Function convert_args
310 (
311 p_event_id in number,
312 p_vendor_id in number,
313 p_activity_version_id in number,
314 p_business_group_id in number,
315 p_organization_id in number,
316 p_event_type in varchar2,
317 p_object_version_number in number,
318 p_title in varchar2,
319 p_budget_cost in number,
320 p_actual_cost in number,
321 p_budget_currency_code in varchar2,
322 p_centre in varchar2,
323 p_comments in varchar2,
324 p_course_end_date in date,
325 p_course_end_time in varchar2,
326 p_course_start_date in date,
327 p_course_start_time in varchar2,
328 p_duration in number,
329 p_duration_units in varchar2,
330 p_enrolment_end_date in date,
331 p_enrolment_start_date in date,
332 p_language_id in number,
333 p_user_status in varchar2,
334 p_development_event_type in varchar2,
335 p_event_status in varchar2,
336 p_price_basis in varchar2,
337 p_currency_code in varchar2,
338 p_maximum_attendees in number,
339 p_maximum_internal_attendees in number,
340 p_minimum_attendees in number,
341 p_standard_price in number,
342 p_category_code in varchar2,
343 p_parent_event_id in number,
344 p_book_independent_flag in varchar2,
345 p_public_event_flag in varchar2,
346 p_secure_event_flag in varchar2,
347 p_evt_information_category in varchar2,
348 p_evt_information1 in varchar2,
349 p_evt_information2 in varchar2,
350 p_evt_information3 in varchar2,
351 p_evt_information4 in varchar2,
352 p_evt_information5 in varchar2,
353 p_evt_information6 in varchar2,
354 p_evt_information7 in varchar2,
355 p_evt_information8 in varchar2,
356 p_evt_information9 in varchar2,
357 p_evt_information10 in varchar2,
358 p_evt_information11 in varchar2,
359 p_evt_information12 in varchar2,
360 p_evt_information13 in varchar2,
361 p_evt_information14 in varchar2,
362 p_evt_information15 in varchar2,
363 p_evt_information16 in varchar2,
364 p_evt_information17 in varchar2,
365 p_evt_information18 in varchar2,
366 p_evt_information19 in varchar2,
367 p_evt_information20 in varchar2,
368 p_project_id in number,
369 p_owner_id in number,
370 p_line_id in number,
371 p_org_id in number,
372 p_training_center_id in number,
373 p_location_id in number,
374 p_offering_id in number,
375 p_timezone in varchar2,
376 p_parent_offering_id in number,
377 p_data_source in varchar2
378 )
379 Return g_rec_type;
380 --
381 -- ----------------------------------------------------------------------------
382 -- -------------------------< FETCH_EVENT_DETAILS >----------------------------
383 -- ----------------------------------------------------------------------------
384 --
385 -- Populates the g_fetched_rec record with the specified event's details.
386 -- These details are then used throughout the package in checks etc.
387 --
388 procedure FETCH_EVENT_DETAILS (
389 P_EVENT_ID number,
390 P_EVENT_EXISTS out nocopy boolean
391 );
392 --
393 -- ----------------------------------------------------------------------------
394 -- -------------------------< CHECK_PROGRAMME_MEMBERS >------------------------
395 -- ----------------------------------------------------------------------------
396 --
397 -- Checks whether all programme members are normal status
398 --
399 function CHECK_PROGRAMME_MEMBERS (P_EVENT_ID in number) return boolean;
400 --
401 -- ----------------------------------------------------------------------------
402 -- ---------------------------< GET_EVENT_DETAILS >----------------------------
403 -- ----------------------------------------------------------------------------
404 --
405 -- A public procedure for other objects to use to return a single,
406 -- complete event row.
407 --
408 procedure GET_EVENT_DETAILS (
409 P_EVENT_ID number,
410 P_EVENT_REC out nocopy OTA_EVT_SHD.g_rec_type,
411 P_EVENT_EXISTS out nocopy boolean
412 );
413 --
414 -- ----------------------------------------------------------------------------
415 -- ---------------------------< GET_COURSE_DATES >-----------------------------
416 -- ----------------------------------------------------------------------------
417 --
418 -- Returns the course dates of a specified event.
419 --
420 procedure GET_COURSE_DATES (
421 P_EVENT_ID in number,
422 P_COURSE_START_DATE in out nocopy date,
423 P_COURSE_END_DATE in out nocopy date
424 );
425 --
426 -- ----------------------------------------------------------------------------
427 -- -----------------------< CHECK_EVENT_IS_VALID >-----------------------------
428 -- ----------------------------------------------------------------------------
429 --
430 -- Raises an error if the event ID used does not exist on OTA_EVENTS.
431 --
432 procedure CHECK_EVENT_IS_VALID (
433 P_EVENT_ID in number
434 );
435 --
436 -- ----------------------------------------------------------------------------
437 -- ---------------------< RESOURCE_BOOKING_FLAG >------------------------------
438 -- ----------------------------------------------------------------------------
439 --
440 -- Returns 'Y' if event has any resources booked to it.
441 --
442 function RESOURCE_BOOKING_FLAG (
443 P_EVENT_ID in number
444 ) return varchar2;
445 --
446 pragma restrict_references (RESOURCE_BOOKING_FLAG, WNDS, WNPS);
447 --
448 -- ----------------------------------------------------------------------------
449 -- -----------------------< PUBLIC_EVENT_FLAG >--------------------------------
450 -- ----------------------------------------------------------------------------
451 --
452 -- ----------------------------------------------------------------------------
453 -- -----------------------< PUBLIC_EVENT_FLAG >--------------------------------
454 -- ----------------------------------------------------------------------------
455 --
456 -- Returns OTA_EVT_API.EVENT_IS_PUBLIC as a Y/N varchar2 for use in
457 -- views.
458 --
459 function PUBLIC_EVENT_FLAG (
460 P_EVENT_ID in number
461 ) return varchar2;
462 --
463 pragma restrict_references (PUBLIC_EVENT_FLAG, WNDS, WNPS);
464 --
465 -- ----------------------------------------------------------------------------
466 -- -----------------------< INVOICED_AMOUNT_TOTAL >----------------------------
467 -- ----------------------------------------------------------------------------
468 --
469 -- Returns the total invoiced amount for an event.
470 --
471 function INVOICED_AMOUNT_TOTAL (
472 P_EVENT_ID in number
473 ) return number;
474 --
475 pragma restrict_references (INVOICED_AMOUNT_TOTAL, WNDS, WNPS);
476 --
477 end ota_evt_shd;