src-db/database/model/triggers/C_DPMLINE_CHK_RESTRICTIONS_TRG.xml
changeset 1605 8a0fe0193bef
parent 756 ae11e4610537
child 1856 e5154c6661e4
equal deleted inserted replaced
1604:a1c518e6ed93 1605:8a0fe0193bef
    22     * All portions are Copyright (C) 2001-2006 Openbravo SL
    22     * All portions are Copyright (C) 2001-2006 Openbravo SL
    23     * All Rights Reserved.
    23     * All Rights Reserved.
    24     * Contributor(s):  ______________________________________.
    24     * Contributor(s):  ______________________________________.
    25     ************************************************************************/
    25     ************************************************************************/
    26   v_Processed CHAR(1) ;
    26   v_Processed CHAR(1) ;
    27   v_C_dp_ID NUMBER(10) ;
    27   v_C_dp_ID VARCHAR2(32) ;
    28 BEGIN
    28 BEGIN
    29   IF INSERTING THEN
    29   IF INSERTING THEN
    30     v_C_DP_ID:=:NEW.C_DP_MANAGEMENT_ID;
    30     v_C_DP_ID:=:NEW.C_DP_MANAGEMENT_ID;
    31   ELSE
    31   ELSE
    32     v_C_DP_ID:=:OLD.C_DP_MANAGEMENT_ID;
    32     v_C_DP_ID:=:OLD.C_DP_MANAGEMENT_ID;
    36   FROM C_DP_Management
    36   FROM C_DP_Management
    37   WHERE C_DP_Management_ID=v_C_DP_ID;
    37   WHERE C_DP_Management_ID=v_C_DP_ID;
    38   IF UPDATING THEN
    38   IF UPDATING THEN
    39     IF(v_Processed='Y'
    39     IF(v_Processed='Y'
    40       AND ((COALESCE(:OLD.LINE, 0) <> COALESCE(:NEW.LINE, 0))
    40       AND ((COALESCE(:OLD.LINE, 0) <> COALESCE(:NEW.LINE, 0))
    41       OR(COALESCE(:OLD.C_DEBT_PAYMENT_ID, 0) <> COALESCE(:NEW.C_DEBT_PAYMENT_ID, 0))
    41       OR(COALESCE(:OLD.C_DEBT_PAYMENT_ID, '0') <> COALESCE(:NEW.C_DEBT_PAYMENT_ID, '0'))
    42       OR(COALESCE(:OLD.STATUS_FROM, 0) <> COALESCE(:NEW.STATUS_FROM, 0))
    42       OR(COALESCE(:OLD.STATUS_FROM, 0) <> COALESCE(:NEW.STATUS_FROM, 0))
    43       OR(COALESCE(:OLD.STATUS_TO, 0) <> COALESCE(:NEW.STATUS_TO, 0))
    43       OR(COALESCE(:OLD.STATUS_TO, 0) <> COALESCE(:NEW.STATUS_TO, 0))
    44       OR(COALESCE(:old.AD_ORG_ID, 0) <> COALESCE(:new.AD_ORG_ID, 0))
    44       OR(COALESCE(:old.AD_ORG_ID, '0') <> COALESCE(:new.AD_ORG_ID, '0'))
    45       OR(COALESCE(:old.AD_CLIENT_ID, 0) <> COALESCE(:new.AD_CLIENT_ID, 0)))) THEN
    45       OR(COALESCE(:old.AD_CLIENT_ID, '0') <> COALESCE(:new.AD_CLIENT_ID, '0')))) THEN
    46         RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
    46         RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
    47     END IF;
    47     END IF;
    48   END IF;
    48   END IF;
    49   IF((DELETING OR INSERTING) AND v_Processed='Y') THEN
    49   IF((DELETING OR INSERTING) AND v_Processed='Y') THEN
    50     RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
    50     RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;