src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml
changeset 21682 337545057885
parent 18880 aa594e52b24d
child 21737 fcb87e990fcd
equal deleted inserted replaced
21681:cc6aa6bf2fc9 21682:337545057885
    29     
    29     
    30     IF AD_isTriggerEnabled()='N' THEN RETURN;
    30     IF AD_isTriggerEnabled()='N' THEN RETURN;
    31     END IF;
    31     END IF;
    32 
    32 
    33 
    33 
    34     IF UPDATING
    34     IF UPDATING THEN  
    35     THEN  IF(:old.Processed='Y'
    35       IF(:old.Processed='Y'
    36     AND ((COALESCE(:old.DATEDOC, v_DateNull) <> COALESCE(:new.DATEDOC, v_DateNull))
    36         AND ((COALESCE(:old.DATEDOC, v_DateNull) <> COALESCE(:new.DATEDOC, v_DateNull))
    37     OR(COALESCE(:old.C_PERIOD_ID, '0') <> COALESCE(:new.C_PERIOD_ID, '0'))
    37         OR(COALESCE(:old.C_PERIOD_ID, '0') <> COALESCE(:new.C_PERIOD_ID, '0'))
    38     OR(COALESCE(:old.CURRENCYRATE, 0) <> COALESCE(:new.CURRENCYRATE, 0))
    38         OR(COALESCE(:old.CURRENCYRATE, 0) <> COALESCE(:new.CURRENCYRATE, 0))
    39     OR(COALESCE(:old.CURRENCYRATETYPE, '.') <> COALESCE(:new.CURRENCYRATETYPE, '.'))
    39         OR(COALESCE(:old.CURRENCYRATETYPE, '.') <> COALESCE(:new.CURRENCYRATETYPE, '.'))
    40     OR(COALESCE(:old.CONTROLAMT, 0) <> COALESCE(:new.CONTROLAMT, 0))
    40         OR(COALESCE(:old.CONTROLAMT, 0) <> COALESCE(:new.CONTROLAMT, 0))
    41     OR(COALESCE(:old.AD_ORG_ID, '0') <> COALESCE(:new.AD_ORG_ID, '0'))
    41         OR(COALESCE(:old.AD_ORG_ID, '0') <> COALESCE(:new.AD_ORG_ID, '0'))
    42     OR(COALESCE(:old.AD_CLIENT_ID, '0') <> COALESCE(:new.AD_CLIENT_ID, '0'))))
    42         OR(COALESCE(:old.AD_CLIENT_ID, '0') <> COALESCE(:new.AD_CLIENT_ID, '0'))))
    43     THEN  RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    43         THEN  RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       
    44       END IF;
       
    45     
       
    46       IF(:old.Posted='Y' 
       
    47         AND ((COALESCE(:old.DATEACCT, v_DateNull) <> COALESCE(:new.DATEACCT, v_DateNull)) 
       
    48         OR(COALESCE(:old.C_ACCTSCHEMA_ID, '0') <> COALESCE(:new.C_ACCTSCHEMA_ID, '0')) 
       
    49         OR(COALESCE(:old.GL_CATEGORY_ID, '0') <> COALESCE(:new.GL_CATEGORY_ID, '0')) 
       
    50         OR(COALESCE(:old.POSTINGTYPE, '.') <> COALESCE(:new.POSTINGTYPE, '.'))
       
    51         OR(COALESCE(:OLD.User1_ID, '0') <> COALESCE(:NEW.User1_ID, '0'))
       
    52         OR(COALESCE(:OLD.User2_ID, '0') <> COALESCE(:NEW.User2_ID, '0'))
       
    53         OR(COALESCE(:OLD.C_Campaign_ID, '0') <> COALESCE(:NEW.C_Campaign_ID, '0'))
       
    54         OR(COALESCE(:OLD.C_Project_ID, '0') <> COALESCE(:NEW.C_Project_ID, '0'))
       
    55         OR(COALESCE(:OLD.A_Asset_ID, '0') <> COALESCE(:NEW.A_Asset_ID, '0'))
       
    56         OR(COALESCE(:OLD.C_Costcenter_ID, '0') <> COALESCE(:NEW.C_Costcenter_ID, '0'))
       
    57         OR(COALESCE(:OLD.C_BPartner_ID, '0') <> COALESCE(:NEW.C_BPartner_ID, '0'))
       
    58         OR(COALESCE(:OLD.M_Product_ID, '0') <> COALESCE(:NEW.M_Product_ID, '0'))
       
    59         )) 
       
    60         THEN RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       
    61       END IF;
       
    62     
       
    63       IF (:old.c_currency_id <> :new.c_currency_id) THEN
       
    64         UPDATE gl_journalline SET c_currency_id = :new.c_currency_id where gl_journal_id = :old.gl_journal_id;
       
    65       END IF;
    44     END IF;
    66     END IF;
    45     
    67     IF(DELETING) THEN
    46     IF(:old.Posted='Y' 
    68       IF(:old.Processed='Y') THEN
    47       AND ((COALESCE(:old.DATEACCT, v_DateNull) <> COALESCE(:new.DATEACCT, v_DateNull)) 
    69         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    48       OR(COALESCE(:old.C_ACCTSCHEMA_ID, '0') <> COALESCE(:new.C_ACCTSCHEMA_ID, '0')) 
    70       END IF;
    49       OR(COALESCE(:old.GL_CATEGORY_ID, '0') <> COALESCE(:new.GL_CATEGORY_ID, '0')) 
       
    50       OR(COALESCE(:old.POSTINGTYPE, '.') <> COALESCE(:new.POSTINGTYPE, '.'))
       
    51       OR(COALESCE(:OLD.User1_ID, '0') <> COALESCE(:NEW.User1_ID, '0'))
       
    52       OR(COALESCE(:OLD.User2_ID, '0') <> COALESCE(:NEW.User2_ID, '0'))
       
    53       OR(COALESCE(:OLD.C_Campaign_ID, '0') <> COALESCE(:NEW.C_Campaign_ID, '0'))
       
    54       OR(COALESCE(:OLD.C_Project_ID, '0') <> COALESCE(:NEW.C_Project_ID, '0'))
       
    55       OR(COALESCE(:OLD.A_Asset_ID, '0') <> COALESCE(:NEW.A_Asset_ID, '0'))
       
    56       OR(COALESCE(:OLD.C_Costcenter_ID, '0') <> COALESCE(:NEW.C_Costcenter_ID, '0'))
       
    57       OR(COALESCE(:OLD.C_BPartner_ID, '0') <> COALESCE(:NEW.C_BPartner_ID, '0'))
       
    58       OR(COALESCE(:OLD.M_Product_ID, '0') <> COALESCE(:NEW.M_Product_ID, '0'))
       
    59       )) 
       
    60     THEN
       
    61       RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       
    62     END IF;
    71     END IF;
    63  END IF;
    72     IF(INSERTING) THEN
    64  IF(DELETING) THEN
    73       IF(:NEW.Processed='Y') THEN
    65   IF(:old.Processed='Y') THEN
    74         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    66     RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    75       END IF;
    67   END IF;
    76     END IF;
    68  END IF;
    77     END GL_JOURNAL_CHK_RESTRICT_TRG
    69  IF(INSERTING) THEN
       
    70   IF(:NEW.Processed='Y') THEN
       
    71     RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       
    72   END IF;
       
    73  END IF;
       
    74 END GL_JOURNAL_CHK_RESTRICT_TRG
       
    75 ]]></body>
    78 ]]></body>
    76     </trigger>
    79     </trigger>
    77   </database>
    80   </database>