src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml
changeset 26421 908de9299675
parent 21737 fcb87e990fcd
child 26422 17cd117fb31b
equal deleted inserted replaced
26420:b509a9c376d0 26421:908de9299675
    17     * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    17     * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    18     * License for the specific  language  governing  rights  and  limitations
    18     * License for the specific  language  governing  rights  and  limitations
    19     * under the License.
    19     * under the License.
    20     * The Original Code is Openbravo ERP.
    20     * The Original Code is Openbravo ERP.
    21     * The Initial Developer of the Original Code is Openbravo SLU
    21     * The Initial Developer of the Original Code is Openbravo SLU
    22     * All portions are Copyright (C) 2001-2012 Openbravo SLU
    22     * All portions are Copyright (C) 2001-2015 Openbravo SLU
    23     * All Rights Reserved.
    23     * All Rights Reserved.
    24     * Contributor(s):  ______________________________________.
    24     * Contributor(s):  ______________________________________.
    25     ************************************************************************/
    25     ************************************************************************/
    26     v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
    26     v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
    27         
    27     v_ValidPeriod NUMBER;    
    28 BEGIN
    28 BEGIN
    29     
    29     
    30     IF AD_isTriggerEnabled()='N' THEN RETURN;
    30     IF AD_isTriggerEnabled()='N' THEN RETURN;
    31     END IF;
    31     END IF;
    32 
    32 
    57         OR(COALESCE(:OLD.C_BPartner_ID, '0') <> COALESCE(:NEW.C_BPartner_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'))
    58         OR(COALESCE(:OLD.M_Product_ID, '0') <> COALESCE(:NEW.M_Product_ID, '0'))
    59         )) 
    59         )) 
    60         THEN RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    60         THEN RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    61       END IF;    
    61       END IF;    
       
    62 
       
    63       
       
    64       IF (:old.DateAcct <> :new.DateAcct and 
       
    65         c_chk_open_period(:new.AD_ORG_ID, :new.DATEACCT, null, :new.C_DOCTYPE_ID) <> 1) THEN 
       
    66         RAISE_APPLICATION_ERROR(-20000, '@PeriodNotValid@');
       
    67       END IF;
       
    68 
    62     END IF;
    69     END IF;
    63     IF(DELETING) THEN
    70     IF(DELETING) THEN
    64       IF(:old.Processed='Y') THEN
    71       IF(:old.Processed='Y') THEN
    65         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    72         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    66       END IF;
    73       END IF;
    67     END IF;
    74     END IF;
    68     IF(INSERTING) THEN
    75     IF(INSERTING) THEN
    69       IF(:NEW.Processed='Y') THEN
    76       IF(:NEW.Processed='Y') THEN
    70         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    77         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
    71       END IF;
    78       END IF;
       
    79       IF (c_chk_open_period(:new.AD_ORG_ID, :new.DATEACCT, null, :new.C_DOCTYPE_ID) <> 1) THEN 
       
    80         RAISE_APPLICATION_ERROR(-20000, '@PeriodNotValid@');
       
    81       END IF;
    72     END IF;
    82     END IF;
    73     END GL_JOURNAL_CHK_RESTRICT_TRG
    83     END GL_JOURNAL_CHK_RESTRICT_TRG
    74 ]]></body>
    84 ]]></body>
    75     </trigger>
    85     </trigger>
    76   </database>
    86   </database>