src-db/database/model/triggers/C_PROJECT_TRG.xml
changeset 1067 4a05c922c488
parent 785 8dba91261590
child 1605 8a0fe0193bef
equal deleted inserted replaced
1066:82e6c784e803 1067:4a05c922c488
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2   <database name="TRIGGER C_PROJECT_TRG">
     2   <database name="TRIGGER C_PROJECT_TRG">
     3     <trigger name="C_PROJECT_TRG" table="C_PROJECT" fires="after" insert="true" update="false" delete="false" foreach="row">
     3     <trigger name="C_PROJECT_TRG" table="C_PROJECT" fires="after" insert="true" update="true" delete="false" foreach="row">
     4       <body><![CDATA[
     4       <body><![CDATA[
     5     /*************************************************************************
     5     /*************************************************************************
     6     * The contents of this file are subject to the Compiere Public
     6     * The contents of this file are subject to the Compiere Public
     7     * License 1.1 ("License"); You may not use this file except in
     7     * License 1.1 ("License"); You may not use this file except in
     8     * compliance with the License. You may obtain a copy of the License in
     8     * compliance with the License. You may obtain a copy of the License in
    32     v_Tree_ID NUMBER;
    32     v_Tree_ID NUMBER;
    33   v_Parent_ID NUMBER;
    33   v_Parent_ID NUMBER;
    34   --
    34   --
    35   TYPE RECORD IS REF CURSOR;
    35   TYPE RECORD IS REF CURSOR;
    36     Cur_Defaults RECORD;
    36     Cur_Defaults RECORD;
    37   BEGIN
    37 BEGIN
       
    38   IF (INSERTING) THEN
    38     FOR Cur_Defaults IN
    39     FOR Cur_Defaults IN
    39       (
    40       (
    40       SELECT *
    41       SELECT *
    41       FROM C_AcctSchema_Default d
    42       FROM C_AcctSchema_Default d
    42       WHERE EXISTS
    43       WHERE EXISTS
    99           ELSE 999
   100           ELSE 999
   100         END
   101         END
   101         )
   102         )
   102       )
   103       )
   103       ;
   104       ;
       
   105     ELSIF (UPDATING) THEN
       
   106      UPDATE C_PROJECT_ACCT SET AD_ORG_ID = :new.AD_ORG_ID
       
   107      WHERE C_PROJECT_ID = :new.C_PROJECT_ID;
       
   108     END IF;
   104     -- Summary Nodes first
   109     -- Summary Nodes first
   105 EXCEPTION
   110 EXCEPTION
   106   WHEN NO_DATA_FOUND THEN
   111   WHEN NO_DATA_FOUND THEN
   107     RAISE_APPLICATION_ERROR(-20001, 'C_Project InsertTrigger Error: No ClientInfo or parent TreeNode') ;
   112     RAISE_APPLICATION_ERROR(-20001, 'C_Project InsertTrigger Error: No ClientInfo or parent TreeNode') ;
   108 END C_PROJECT_TRG
   113 END C_PROJECT_TRG