-- ABS-89504 / ABS-90539
--- ARTRANSACTION ---
ALTER TABLE ARTRANSACTION DROP CONSTRAINT CHK_ARTRANSACTION_ORIGIN;

COMMENT ON COLUMN ARTRANSACTION.ORIGIN IS 'This field is only used internally for trouble shooting. It identifies where the ARTransaction is created.
0 = Undefined
1 = Finalize invoices
2 = Consolidated invoices
3 = Settlement
4 = Generate statement
5 = Cash application – Manual added
6 = Cash application – Generated (apply)
7 = DB Procedure ProcessPaymentTransaction
8 = DB Procedure ProcessUnappliedCredit
9 = Credit card transactions – cancel / refund
10 = Process credit card transactions
11 = Credit Card Portal
12 = Customer Financials – Credit card on demand
13 = Web Portal Credit Card payment
14 = Scheduled Credit Card Payment
15 = Card Test transaction
16 = Scheduled ACH Payment
17 = Route Assistant from Mark other invoices
18 = Electronic Payment Dialog';

ALTER TABLE ARTRANSACTION ADD CONSTRAINT CHK_ARTRANSACTION_ORIGIN CHECK (ORIGIN BETWEEN 0 AND 18);

--- CASHAPPLICATION ---
ALTER TABLE CASHAPPLICATION DROP CONSTRAINT CHK_CASHAPPLICATION_ORIGIN;

COMMENT ON COLUMN CASHAPPLICATION.ORIGIN IS '0 = Undefined (default)
1 = Cash application
2 = Settlement
3 = Credit card interface
4 = Conversion
5 = Credit Card Portal
6 = Web Portal (credit card payment)
7 = Credit Card Schedule
8 = ACH Schedule
9 = Electronic Payment Dialog';

ALTER TABLE CASHAPPLICATION ADD CONSTRAINT CHK_CASHAPPLICATION_ORIGIN CHECK (ORIGIN BETWEEN 0 AND 9);
