--ABS-75320 / ABS-78090

----------- ERP_I_INVOICEPAYMENTS -----------

ALTER TABLE ERP_I_INVOICEPAYMENTS DROP CONSTRAINT PAYMENTMETHODS_VALID;

ALTER TABLE ERP_I_INVOICEPAYMENTS ADD (PAYMENTTYPE NUMBER DEFAULT 0 NOT NULL 
                                       CONSTRAINT PAYMENTTYPE_VALID2 CHECK (PAYMENTTYPE IN(0,1,2,3,4,5,6,7,9)),
                                       REFERENCE VARCHAR2(50) NULL,
                                       PAYMENTTRANSACTION_ID NUMBER NULL,
                                       EMAILDOCUMENT_ID NUMBER NULL);
UPDATE ERP_I_INVOICEPAYMENTS 
SET PAYMENTMETHOD = 2
WHERE PAYMENTMETHOD NOT IN(1,2);
COMMIT;

ALTER TABLE ERP_I_INVOICEPAYMENTS MODIFY (PAYMENTMETHOD DEFAULT 2);
ALTER TABLE ERP_I_INVOICEPAYMENTS ADD CONSTRAINT PAYMENTMETHOD_VALID1 CHECK (PAYMENTMETHOD IN(1,2));

COMMENT ON COLUMN ERP_I_INVOICEPAYMENTS.PAYMENTTYPE
IS '0 = Cash
1 = Check
2 = Credit card
3 = EDT
4 = EDI
5 = Acceptgiro
6 = Automatic collection
7 = Pay-by customer
9 = Not applicable/unknown';

COMMENT ON COLUMN ERP_I_INVOICEPAYMENTS.PAYMENTMETHOD
IS '1 = COD
2 = Charge';                                        
                                     
                                       
                                       
                                       