1 Package ota_tfh_api_business_rules AUTHID CURRENT_USER as
2 /* $Header: ottfh02t.pkh 115.5 2002/11/29 09:30:35 arkashya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |------------------------< check_transfer_status >-------------------------|
6 -- ----------------------------------------------------------------------------
7 --
8 -- PUBLIC
9 -- Description:
10 -- The attribute 'Transfer Status' must be in the domain of
11 -- 'GL Transfer Status'.
12 --
13 Procedure check_transfer_status
14 (
15 p_transfer_status in varchar2
16 );
17 --
18 -- ----------------------------------------------------------------------------
19 -- |------------------------< check_transfer_rules >-------------------------|
20 -- ----------------------------------------------------------------------------
21 --
22 -- PUBLIC
23 -- Description:
24 -- The following changes to Transfer Status are allowed
25 -- NT -> AT
26 -- AT -> NT
27 -- UT -> NT
28 -- UT -> AT
29 -- When such a change takes place all the lines for the header that
30 -- have the same Transfer Status should also be changed.
31 --
32 -- In addition the following are permitted
33 -- AT -> ST
34 -- AT -> UT
35 -- ST -> UT
36 Procedure check_transfer_rules
37 (
38 p_new_transfer_status in varchar2
39 ,p_old_transfer_status in varchar2
40 );
41 --
42 -- ----------------------------------------------------------------------------
43 -- |--------------------< check_status_unauthorized >-------------------------|
44 -- ----------------------------------------------------------------------------
45 --
46 -- PUBLIC
47 -- Description:
48 -- The transfer status must be 'NT' if the header is not authorised,
49 -- ie: the authorised_by_person_id is null.
50 --
51 Procedure check_status_unauthorized
52 (
53 p_status in varchar2
54 ,p_authorized_person_id in number
55 );
56 --
57 -- ----------------------------------------------------------------------------
58 -- |-------------------------< check_authorized_by >--------------------------|
59 -- ----------------------------------------------------------------------------
60 --
61 -- PUBLIC
62 -- Description:
63 -- The authorised_by attribute must be a valid person_id from PER_PEOPLE_F
64 -- using the date_raised attribute as a limit for the derrivation of one date
65 -- tracked row.
66 --
67 Procedure check_authorized_by
68 (
69 p_person_id in number
70 );
71 --
72 -- ----------------------------------------------------------------------------
73 -- |-------------------------< set_date_raised >------------------------------|
74 -- ----------------------------------------------------------------------------
75 --
76 -- PUBLIC
77 -- Description:
78 -- The date_raised attribute must be set to the session date upon
79 -- creation. This attribute may not be updated.
80 --
81 Procedure set_date_raised
82 (
83 p_date_raised out nocopy date
84 ,p_session_date in date
85 );
86 --
87 -- ----------------------------------------------------------------------------
88 -- |--------------------< check_receivable_attributes >-----------------------|
89 -- ----------------------------------------------------------------------------
90 --
91 -- PUBLIC
92 -- Description:
93 -- If the header is of type 'Receivable' then the following
94 -- attributes must be NOT NULL:
95 -- CUSTOMER_CONTACT_ID
96 -- CUSTOMER_ADDRESS_ID
97 -- CUSTOMER_ID
98 -- INVOICE_ADDRESS
99 -- INVOICE_CONTACT
100 -- RECEIVABLE_TYPE
101 -- The following attributes must be NULL:
102 -- VENDOR_ID
103 -- VENDOR_CONTACT_ID
104 -- VENDOR_ADDRESS_ID
105 --
106 --
107 Procedure check_receivable_attributes
108 (
109 p_type in varchar2
110 ,p_customer_id in number
111 ,p_customer_contact_id in number
112 ,p_customer_address_id in number
113 ,p_invoice_address in varchar2
114 ,p_invoice_contact in varchar2
115 ,p_vendor_id in number
116 ,p_vendor_contact_id in number
117 ,p_vendor_address_id in number
118 ,p_receivable_type in varchar2
119 );
120 --
121 -- ----------------------------------------------------------------------------
122 -- |----------------------< check_customer_contact >--------------------------|
123 -- ----------------------------------------------------------------------------
124 --
125 -- PUBLIC
126 -- Description:
127 -- The customer_contact_id must be for the same customer as defined on the
128 -- header in the attribute customer_id, if the header is receivable .
129 --
130 Procedure check_customer_contact
131 (
132 p_customer_id in number
133 ,p_contact_id in number
134 );
135 --
136 -- ----------------------------------------------------------------------------
137 -- |-----------------------< check_customer_address >-------------------------|
138 -- ----------------------------------------------------------------------------
139 --
140 -- PUBLIC
141 -- Description:
142 -- The customer_address_id must be for the same customer as defined
143 -- on the header in the attribute customer_id, if the header is receivable.
144 --
145 Procedure check_customer_address
146 (
147 p_customer_id in number
148 ,p_address_id in number
149 );
150 --
151 -- ----------------------------------------------------------------------------
152 -- |------------------------< set_invoice_address >---------------------------|
153 -- ----------------------------------------------------------------------------
154 --
155 -- PUBLIC
156 -- Description:
157 -- Upon insert of a receivable header the address attributes must be
158 -- concatenated together in the invoice_address attribute. This must
159 -- be reset if the customer_address_id is changed. This changed must
160 -- then obey the change rules defined in the business rules. If the
161 -- header has been transfered, then a cancel and recreate would have
162 -- to be performed.
163 --
164 Procedure set_invoice_address
165 (
166 p_customer_id in number
167 ,p_address_id in number
168 ,p_invoice_address out nocopy varchar2
169 );
170 --
171 -- ----------------------------------------------------------------------------
172 -- |------------------------< set_invoice_contact >---------------------------|
173 -- ----------------------------------------------------------------------------
174 --
175 -- PUBLIC
176 -- Description:
177 --
178 Procedure set_invoice_contact
179 (
180 p_customer_id in number
181 ,p_contact_id in number
182 ,p_invoice_contact out nocopy varchar2
183 );
184 --
185 /************* ????????????????????????? ***********************
186 -- ----------------------------------------------------------------------------
187 -- |--------------------< check_update_invoice_address >----------------------|
188 -- ----------------------------------------------------------------------------
189 --
190 -- PUBLIC
191 -- Description:
192 --
193 Procedure check_update_invoice_address
194 (
195 p_invoice_address in varchar2
196 );
197 ************** ????????????????????????? ***********************/
198 --
199 -- ----------------------------------------------------------------------------
200 -- |-----------------------< check_vendor_contact >---------------------------|
201 -- ----------------------------------------------------------------------------
202 --
203 -- PUBLIC
204 -- Description:
205 -- The vendor_contact must be a valid contact for the vendor defined in
206 -- vendor_id on the header, if the header is 'Payable'.
207 --
208 Procedure check_vendor_contact
209 (
210 p_vendor_id in number
211 ,p_contact_id in number
212 );
213 --
214 -- ----------------------------------------------------------------------------
215 -- |-------------------------< check_vendor_address >-------------------------|
216 -- ----------------------------------------------------------------------------
217 --
218 -- PUBLIC
219 -- Description:
220 -- The vendor_address must be a valid address for the vendor defined
221 -- in VENDOR_ID on the header.
222 --
223 Procedure check_vendor_address
224 (
225 p_vendor_id in number
226 ,p_address_id in number
227 );
228 --
229 -- ----------------------------------------------------------------------------
230 -- |-----------------------< check_payable_attributes >-----------------------|
231 -- ----------------------------------------------------------------------------
232 --
233 -- PUBLIC
234 -- Description:
235 -- If the header is of type 'Payable' then the following
236 -- attributes must be NOT NULL:
237 -- VENDOR_CONTACT_ID
238 -- VENDOR_ADDRESS_ID
239 -- VENDOR_ID
240 -- INVOICE_CONTACT
241 -- The following attributes must be NULL:
242 -- CUSTOMER_CONTACT_ID
243 -- CUSTOMER_ADDRESS_ID
244 -- CUSTOMER_ID
245 -- INVOICE_ADDRESS
246 -- RECEIVABLE_TYPE
247 --
248 --
249 Procedure check_payable_attributes
250 (
251 p_type in varchar2
252 ,p_vendor_id in number
253 ,p_vendor_contact_id in number
254 ,p_vendor_address_id in number
255 ,p_invoice_contact in varchar2
256 ,p_invoice_address in varchar2
257 ,p_customer_id in number
258 ,p_customer_contact_id in number
259 ,p_customer_address_id in number
260 ,p_receivable_type in varchar2
261 );
262 --
263 -- ----------------------------------------------------------------------------
264 -- |-----------------------< check_cancelled_flag >---------------------------|
265 -- ----------------------------------------------------------------------------
266 --
267 -- PUBLIC
268 -- Description:
269 -- The cancelled_flag attribute must be in the domain 'Yes No'.
270 --
271 Procedure check_cancelled_flag
272 (
273 p_flag in varchar2
274 );
275 --
276 -- ----------------------------------------------------------------------------
277 -- |----------------------------< cancel_header >-----------------------------|
278 -- ----------------------------------------------------------------------------
279 --
280 -- PUBLIC
281 --
282 -- OVERLOADING PROCEDURE
283 --
284 -- Description:
285 -- The update of cancelled_flag is not permitted by any other means
286 -- than to call this procedure to cancel. This sets the cancelled_flag
287 -- to 'Y' and creates a cancellation header with the old header_id on
288 -- the new cancellation header in the supersedes_header_id attribute.
289 -- The procedure 'CANCEL_LINES_FOR_HEADER', found in the lines API,
290 -- will then be called.
291 --
292 Procedure cancel_header
293 (
294 p_rec_finance in out nocopy ota_tfh_api_shd.g_rec_type
295 ,p_cancel_header_id out nocopy number
296 ,p_date_raised in date
297 ,p_validate in boolean
298 );
299 --
300 -- ----------------------------------------------------------------------------
301 -- |----------------------------< cancel_header >-----------------------------|
302 -- ----------------------------------------------------------------------------
303 --
304 -- PUBLIC
305 --
306 -- OVERLOADING PROCEDURE
307 --
308 -- Description:
309 -- The update of cancelled_flag is not permitted by any other means
310 -- than to call this procedure to cancel. This sets the cancelled_flag
311 -- to 'Y' and creates a cancellation header with the old header_id on
312 -- the new cancellation header in the supersedes_header_id attribute.
313 -- The procedure 'CANCEL_LINES_FOR_HEADER', found in the lines API,
314 -- will then be called.
315 --
316 Procedure cancel_header
317 (
318 p_finance_header_id in number
319 ,p_cancel_header_id out nocopy number
320 ,p_date_raised in date
321 ,p_validate in boolean
322 ,p_commit in boolean default FALSE
323 );
324 --
325 -- ----------------------------------------------------------------------------
326 -- |--------------------------< recancel_header >-----------------------------|
327 -- ----------------------------------------------------------------------------
328 --
329 -- PUBLIC
330 --
331 -- PROCEDURE
332 --
333 -- Description:
334 -- The update of cancelled_flag is not permitted by any other means
335 -- than to call this procedure to recancel. This sets the cancelled_flag
336 -- to 'N'.
337 -- The procedure 'RECANCEL_LINES_FOR_HEADER', found in the lines API,
338 -- will then be called.
339 --
340 Procedure recancel_header
341 (
342 p_finance_header_id in number
343 ,p_validate in boolean
344 ,p_commit in boolean default FALSE
345 );
346 --
347 -- ----------------------------------------------------------------------------
348 -- |-------------------< check_cancellation_attributes >----------------------|
349 -- ----------------------------------------------------------------------------
350 --
351 -- PUBLIC
352 -- Description:
353 -- If the header is of type 'Cancellation' then the following
354 -- attributes must be NOT NULL:
355 -- SUPERSEDES_HEADER_ID
356 -- The following attributes must be NULL:
357 -- CUSTOMER_CONTACT_ID
358 -- CUSTOMER_ADDRESS_ID
359 -- CUSTOMER_ID
360 -- INVOICE_ADDRESS
361 -- INVOICE_CONTACT
362 -- VENDOR_ID
363 -- VENDOR_CONTACT_ID
364 -- VENDOR_ADDRESS_ID
365 -- PAYMENT_METHOD
366 -- RECEIVABLE_TYPE
367 --
368 --
369 Procedure check_cancellation_attributes
370 (
371 p_type in varchar2
372 ,p_supersedes_header_id in number
373 ,p_customer_id in number
374 ,p_customer_contact_id in number
375 ,p_customer_address_id in number
376 ,p_invoice_address in varchar2
377 ,p_invoice_contact in varchar2
378 ,p_vendor_id in number
379 ,p_vendor_contact_id in number
380 ,p_vendor_address_id in number
381 ,p_payment_method in varchar2
382 ,p_receivable_type in varchar2
383 );
384 --
385 -- ----------------------------------------------------------------------------
386 -- |----------------------< check_superseded_header >-------------------------|
387 -- ----------------------------------------------------------------------------
388 --
389 -- PUBLIC
390 -- Description:
391 -- For a cancellation header the superseded_header_id must be a valid
392 -- finance header.
393 --
394 Procedure check_superseded_header
395 (
396 p_finance_type in varchar2
397 ,p_superseding_header_id in number
398 );
399 --
400 -- ----------------------------------------------------------------------------
401 -- |----------------------< check_update_customer_id >------------------------|
402 -- ----------------------------------------------------------------------------
403 --
404 -- PUBLIC
405 -- Description:
406 -- Reference information check, if the customer_id is changed
407 --
408 Procedure check_update_customer_id
409 (
410 p_customer_id in number
411 ,p_address_id in number
412 ,p_contact_id in number
413 ,p_vendor_id in number
414 );
415 --
416 -- ----------------------------------------------------------------------------
417 -- |-------------------------< check_update_vendor_id >-----------------------|
421 -- Description:
418 -- ----------------------------------------------------------------------------
419 --
420 -- PUBLIC
422 -- Reference information check, if the vendor_id is changed
423 --
424 Procedure check_update_vendor_id
425 (
426 p_vendor_id in number
427 ,p_address_id in number
428 ,p_contact_id in number
429 ,p_customer_id in number
430 );
431 --
432 -- ----------------------------------------------------------------------------
433 -- |------------------------< cancel_and_recreate >---------------------------|
434 -- ----------------------------------------------------------------------------
435 --
436 -- PUBLIC
437 -- Description:
438 -- An API procedure is required to cancel a header and create a new
439 -- header in its place. This procedure will create a new header, which
440 -- supersedes the one which is to be cancelled. The procedure
441 -- 'COPY_LINES_TO_NEW_HEADER', found in the lines API, will then be called.
442 -- The old finance header will then be cancelled by using the 'CANCEL_HEADER'
443 -- procedure. The TRANSFER_STATUS on the newly created header must be set to
444 -- 'N' by default.
445 --
446 Procedure cancel_and_recreate
447 (
448 p_rec_finance in out nocopy ota_tfh_api_shd.g_rec_type
449 ,p_date_raised in date
450 ,p_validate in boolean
451 );
452 --
453 -- ----------------------------------------------------------------------------
454 -- |------------------------< cancel_and_recreate >---------------------------|
455 -- ----------------------------------------------------------------------------
456 --
457 -- PUBLIC
458 -- Description:
459 -- An API procedure is required to cancel a header and create a new
460 -- header in its place. This procedure will create a new header, which
461 -- supersedes the one which is to be cancelled. The procedure
462 -- 'COPY_LINES_TO_NEW_HEADER', found in the lines API, will then be called.
463 -- The old finance header will then be cancelled by using the 'CANCEL_HEADER'
464 -- procedure. The TRANSFER_STATUS on the newly created header must be set to
465 -- 'N' by default.
466 --
467 Procedure cancel_and_recreate
468 (
469 p_finance_header_id in number
470 ,p_recreation_header_id out nocopy number
471 ,p_cancel_header_id out nocopy number
472 ,p_date_raised in date
473 ,p_validate in boolean
474 ,p_commit in boolean default FALSE
475 );
476 --
477 -- ----------------------------------------------------------------------------
478 -- |-----------------------< check_payment_method >---------------------------|
479 -- ----------------------------------------------------------------------------
480 --
481 -- PUBLIC
482 -- Description:
483 -- The PAYMENT_METHOD attribute must be in the domain 'Payment Method'.
484 --
485 Procedure check_payment_method
486 (
487 p_payment_method in varchar2
488 );
489 --
490 -- ----------------------------------------------------------------------------
491 -- |-----------------------< check_allow_transfer >---------------------------|
492 -- ----------------------------------------------------------------------------
493 --
494 -- PUBLIC
495 -- Description:
496 -- If the TRANSFER_STATUS attribute is any other value than 'NT' the
497 -- PAYMENT_METHOD attribute must be NOT NULL.
498 --
499 Procedure check_allow_transfer
500 (
501 p_transfer_status in varchar2
502 ,p_payment_method in varchar2
503 );
504 --
505 -- ----------------------------------------------------------------------------
506 -- |------------------------< check_update_header >---------------------------|
507 -- ----------------------------------------------------------------------------
508 --
509 -- PUBLIC
510 -- Description:
511 -- The details of a header may not be updated if the header has been
512 -- transferred other than to set the 'PAYMENT_FLAG'.
513 -- Enforced by the constraint 'OTA_TFH_CHECK_UPDATE'
514 --
515 Procedure check_update_header
516 (
517 p_rec_old in ota_tfh_api_shd.g_rec_type
518 ,p_rec_new in ota_tfh_api_shd.g_rec_type
519 ,p_transaction_type in varchar2
520 );
521 --
522 -- ----------------------------------------------------------------------------
523 -- |---------------------< check_payment_status_flag >------------------------|
524 -- ----------------------------------------------------------------------------
525 --
526 -- PUBLIC
527 -- Description:
528 -- The attribute 'PAYMENT_STATUS_FLAG' must be in the domain 'Yes No'.
529 --
530 Procedure check_payment_status_flag
531 (
532 p_flag in varchar2
533 );
534 --
535 -- ----------------------------------------------------------------------------
536 -- |------------------------< check_administrator >---------------------------|
537 -- ----------------------------------------------------------------------------
538 --
539 -- PUBLIC
540 -- Description:
541 -- The ADMINISTRATOR attribute must be a valid AOL user.
542 --
543 Procedure check_administrator
544 (
545 p_administrator in number
546 );
547 --
551 --
548 -- ----------------------------------------------------------------------------
549 -- |----------------------------< check_deletion >----------------------------|
550 -- ----------------------------------------------------------------------------
552 -- PUBLIC
553 -- Description:
554 -- Checks whether a finance_header can be deleted.
555 --
556 Procedure check_deletion
557 (
558 p_finance_header_id in number
559 );
560 --
561 -- ----------------------------------------------------------------------------
562 -- |----------------------------< initialize_finance_header ------------------|
563 -- ----------------------------------------------------------------------------
564 --
565 -- PUBLIC
566 -- Description:
567 -- Get some default values for the Finance Header Form
568 --
569 procedure initialize_finance_header
570 (
571 p_business_group_id in number
572 ,p_fnd_user_id in number
573 ,p_deflt_currency_code out nocopy varchar2
574 ,p_deflt_trans_status_meaning out nocopy varchar2
575 ,p_deflt_administrator out nocopy varchar2
576 ,p_deflt_organization out nocopy varchar2
577 );
578 --
579 -- ----------------------------------------------------------------------------
580 -- |----------------------------< check_superseded >---------------------------
581 -- ----------------------------------------------------------------------------
582 --
583 -- PUBLIC
584 -- Description:
585 -- Check whether the Finance Header has been superceded and prevent update
586 -- if it has
587 --
588 procedure check_superseded (p_finance_header_id in number);
589 --
590 end ota_tfh_api_business_rules;