--ABS-38331/ ABS-54552
ALTER TABLE PURCHASEORDERHEADER ADD (EXPORTEDTOEDI NUMBER DEFAULT 1 NOT NULL
                                     CONSTRAINT EXPORTEDTOEDI_VALID1_1 CHECK (EXPORTEDTOEDI IN (0, 1, 2)));

COMMENT ON COLUMN PURCHASEORDERHEADER.EXPORTEDTOEDI
  IS '0 = Not Applicable
1 = Not exported (default)
2 = Exported
';

CREATE INDEX XIE5PURCHASEORDERHEADER ON PURCHASEORDERHEADER (EXPORTEDTOEDI ASC);

UPDATE PURCHASEORDERHEADER POH SET POH.EXPORTEDTOEDI = 0
WHERE POH.STATUS_ID NOT IN (SELECT S.STATUS_ID FROM STATUS S WHERE S.STATUSTYPE = 'PO' AND S.CODE IN ('05','10'));
COMMIT;

---SUPPLIER table---
ALTER TABLE SUPPLIER MODIFY (SENDPURCHASEORDER DEFAULT 0);

ALTER TABLE SUPPLIER ADD (ILNNUMBER NUMBER NULL,
                          EDI_POEXPORTFILEFORMAT NUMBER DEFAULT 0 NOT NULL
                                                 CONSTRAINT EDI_POEXPORTFILEFORMAT_VALID1 CHECK (EDI_POEXPORTFILEFORMAT IN (0, 1, 2)),
                          EDI_POCONFIRMFILEFORMAT NUMBER DEFAULT 0 NOT NULL
                                                 CONSTRAINT EDI_POCONFIRMFILEFORMAT_VALID CHECK (EDI_POCONFIRMFILEFORMAT IN (0, 1, 2)));

COMMENT ON COLUMN SUPPLIER.SENDPURCHASEORDER
  IS '0 = By regular mail
1 = By fax (default)
2 = By e-mail
3 = By mail
4 = By file';
COMMENT ON COLUMN SUPPLIER.EDI_POEXPORTFILEFORMAT
  IS 'Indicates if purchase order will be exported to supplier via EDI and which file format is used. Possible values:
0 = Not applicable
1 = ABS standard PO export
2 = Mulliez PO export
';
COMMENT ON COLUMN SUPPLIER.EDI_POCONFIRMFILEFORMAT
  IS 'Indicates if purchase order confirmation will be imported from supplier via EDI and which file format is used. Possible values:
0 = Not applicable
1 = ABS standard PO confirmation
2 = Mulliez PO confirmation
';