--ABSN-6909
UPDATE ERP_I_PRODUCTLISTPERCUSTOMER
SET ALLOWRETURNTOSTOCK = 4
WHERE ALLOWRETURNTOSTOCK <> 4
AND MBYOPPERCENTAGE >0;
COMMIT;

ALTER TABLE ERP_I_PRODUCTLISTPERCUSTOMER
  ADD CONSTRAINT CHK_ERP_I_PLPC_MBYOPPERCENTAGE2
  CHECK (MBYOPPERCENTAGE = 0 OR ( MBYOPPERCENTAGE >0 AND ALLOWRETURNTOSTOCK = 4));


UPDATE ERP_I_CONTRACTPRODUCT
SET ALLOWRETURNTOSTOCK = 4
WHERE ALLOWRETURNTOSTOCK <> 4
AND MBYOPPERCENTAGE >0;
COMMIT;

ALTER TABLE ERP_I_CONTRACTPRODUCT
  ADD CONSTRAINT CHK_ERP_I_CONTRACTPRODUCT_MBYOPPERCENTAGE2
  CHECK (MBYOPPERCENTAGE = 0 OR ( MBYOPPERCENTAGE >0 AND ALLOWRETURNTOSTOCK = 4));


