-- ABS-62318/ ABS-66110

--- ARTRANSACTION table ---
ALTER TABLE ARTRANSACTION
  DROP CONSTRAINT ORIGIN_VALID1;
ALTER TABLE ARTRANSACTION
  ADD CONSTRAINT ORIGIN_VALID1
  CHECK (ORIGIN IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));

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';

-- CREDITCARDTRANSACTION table ---
ALTER TABLE CREDITCARDTRANSACTION ADD (AMOUNT NUMBER DEFAULT 0 NOT NULL);

COMMENT ON COLUMN CREDITCARDTRANSACTION.ORIGIN
  IS '1 = Remittance (manual via Cash application)
2 = Refund
3 = Miscellaneous
4 = Generated via Statement
5 = Generated via Settlement
6 = Credit Card on Demand';

ALTER TABLE CREDITCARDTRANSACTION
  DROP CONSTRAINT ORIGIN_VALID2;
ALTER TABLE CREDITCARDTRANSACTION
  ADD CONSTRAINT ORIGIN_VALID2
  CHECK (ORIGIN IN (1, 2, 3, 4, 5, 6));
