--ABS-89251 / ABS-103489
--------	ONSITEINVENTORYADJUSTMENT  -----------
ALTER TABLE ONSITEINVENTORYADJUSTMENT DROP CONSTRAINT ORIGIN_VALID7;
ALTER TABLE ONSITEINVENTORYADJUSTMENT ADD CONSTRAINT CHK_ONSITEINVADJUST_ORIGIN CHECK (ORIGIN IN(1,2,3,4,5,6,7,8,9,10,11,12,13,14));
COMMENT ON COLUMN ONSITEINVENTORYADJUSTMENT.ORIGIN IS '1 = Manual Correction
2 = Delivery Note
3 = Correction Ticket
4 = Soil Count
5 = Inscan
6 = Straight Even Return
7 = On-site Inventory Check
9 = Conversion
10 = Shortage At Delivery
11 = Rejected At Delivery
12 = Allocation
13 = Used OR pack
14 = Electronic order'; 
ALTER TABLE ONSITEINVENTORYADJUSTMENT ADD (INTERNETORDER_ID NUMBER NULL);
COMMENT ON COLUMN ONSITEINVENTORYADJUSTMENT.INTERNETORDER_ID IS 'Only filled for Origin = 14 (Electronic order)';
CREATE INDEX XIF3ONSITEINVENTORYADJUSTMENT ON ONSITEINVENTORYADJUSTMENT(INTERNETORDER_ID ASC);
ALTER TABLE ONSITEINVENTORYADJUSTMENT ADD CONSTRAINT FK_ONSITEINVADJUST_INTERNETORD
FOREIGN KEY(INTERNETORDER_ID) REFERENCES INTERNETORDER(INTERNETORDER_ID) ON DELETE SET NULL;