--ABSN-9693

--UNIQUEITEM TABLE
ALTER TABLE UNIQUEITEM ADD (LASTCLEANSCANDATE DATE NULL);

--FLAGOPTIONS
UPDATE FLAGOPTIONS FO
   SET FO.SHOW = 'Y' , FO.REMOVE = 'N', FO.TIMESTAMP = SYSDATE, FO.SYSTEMUSER_ID = 1
   WHERE FO.DIALOG_ID IN
         (SELECT D.DIALOG_ID
           FROM DIALOGS D
           WHERE D.CODE = 'CleanScanSingleRead')
   AND EXISTS (SELECT 1
         FROM FLAG F, AUTOMATICFLAG AF
         WHERE FO.FLAG_ID = F.FLAG_ID
         AND   AF.FLAG_ID = F.FLAG_ID
         AND   AF.AUTOMATICFLAG_ID IN (4, 12, 16, 7));
         
--PLANTFLAGOPTIONS
UPDATE PLANTFLAGOPTIONS PFO
   SET PFO.SHOW = 'Y', PFO.REMOVE = 'N', PFO.TIMESTAMP = SYSDATE, PFO.SYSTEMUSER_ID = 1
   WHERE PFO.DIALOG_ID IN
         (SELECT D.DIALOG_ID
          FROM DIALOGS D
          WHERE D.CODE = 'CleanScanSingleRead')
   AND EXISTS (SELECT 1
        FROM  FLAG F, AUTOMATICFLAG AF
        WHERE PFO.FLAG_ID = F.FLAG_ID
        AND   AF.FLAG_ID = F.FLAG_ID
        AND   AF.EVENT IN
              ('Replacement requested using replacement button',
               'Substitute garment',
               'Decrease max inv. after return to stock items with this flag',
               'Flag for return to stock due to manual decrease of max inv'));
commit;
