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