details: /erp/devel/pi/rev/16290ade5194 changeset: 8544:16290ade5194 user: Sathiyan Sivaprakasam <sathiyan.sivaprakasam <at> openbravo.com> date: Fri Oct 15 11:59:42 2010 +0530 summary: Fixes Issue 14760: Activity tree does not work
diffstat: src-db/database/model/triggers/C_ACTIVITY_TRG.xml | 109 ++++++++++++++++++++++ 1 files changed, 109 insertions(+), 0 deletions(-) diffs (113 lines): diff -r c4a8d1ac4bd7 -r 16290ade5194 src-db/database/model/triggers/C_ACTIVITY_TRG.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-db/database/model/triggers/C_ACTIVITY_TRG.xml Fri Oct 15 11:59:42 2010 +0530 @@ -0,0 +1,109 @@ +<?xml version="1.0"?> + <database name="TRIGGER C_ACTIVITY_TRG"> + <trigger name="C_ACTIVITY_TRG" table="C_ACTIVITY" fires="before" insert="true" update="true" delete="false" foreach="row"> + <body><![CDATA[/************************************************************************* +* The contents of this file are subject to the Openbravo Public License +* Version 1.0 (the "License"), being the Mozilla Public License +* Version 1.1 with a permitted attribution clause; you may not use this +* file except in compliance with the License. You may obtain a copy of +* the License at http://www.openbravo.com/legal/license.html +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +* License for the specific language governing rights and limitations +* under the License. +* The Original Code is Openbravo ERP. +* The Initial Developer of the Original Code is Openbravo SLU +* All portions are Copyright (C) 2010 Openbravo SLU +* All Rights Reserved. +* Contributor(s): ______________________________________. +************************************************************************/ + v_xTree_ID VARCHAR2(32); + v_xParent_ID VARCHAR2(32); + v_NextNo VARCHAR2(32); + +BEGIN + + IF AD_isTriggerEnabled()='N' THEN RETURN; + END IF; + + + -- Insert AD_Menu Trigger + -- for Translation + -- and TreeNode + IF INSERTING THEN + -- Create TreeNode -- + -- get AD_Tree_ID + ParentID + --SELECT c.AD_Tree_Menu_ID, n.Node_ID + -- INTO v_xTree_ID, v_xParent_ID + -- FROM AD_CLIENTINFO c, AD_TREENODE n -- AD_TreeNodeMM n + -- WHERE c.AD_Tree_Menu_ID=n.AD_Tree_ID + -- AND n.Parent_ID IS NULL + --AND c.AD_Client_ID=:NEW.AD_Client_ID; + SELECT AD_TREE_ID, + 0 + INTO v_xTree_ID, + v_xParent_ID + FROM AD_TREE + WHERE treetype='AY' + AND AD_Client_ID=:NEW.AD_Client_ID; + -- DBMS_OUTPUT.PUT_LINE('Tree='||v_xTree_ID||' Node='||:new.AD_Menu_ID||' Parent='||v_xParent_ID); + -- Insert into TreeNode + INSERT + INTO AD_TREENODE + -- AD_TreeNodeMM + ( + AD_TreeNode_Id, AD_Client_ID, AD_Org_ID, IsActive, + Created, CreatedBy, Updated, + UpdatedBy, AD_Tree_ID, Node_ID, + Parent_ID, SeqNo + ) + VALUES + ( + get_uuid(), :NEW.AD_Client_ID, :NEW.AD_Org_ID, :NEW.IsActive, + :NEW.Created, :NEW.CreatedBy, :NEW.Updated, + :NEW.UpdatedBy, v_xTree_ID, :NEW.C_ACTIVITY_ID, + v_xParent_ID,( + CASE :NEW.IsSummary + WHEN 'Y' + THEN 100 + ELSE 999 + END + ) + ) + ; + -- Summary Nodes first + END IF; + -- Inserting + -- AD_Ref_List update trigger + -- synchronize name,... + IF UPDATING THEN + IF((COALESCE(:OLD.NAME, '.') <> COALESCE(:NEW.NAME, '.') + OR COALESCE(:OLD.Description, '.') <> COALESCE(:NEW.Description, '.') + OR COALESCE(:OLD.IsActive, '.') <> COALESCE(:NEW.IsActive, '.'))) + THEN + IF(:OLD.IsActive!=:NEW.IsActive) THEN + -- get AD_Tree_ID + ParentID + --SELECT c.AD_Tree_Menu_ID, n.Node_ID + --INTO v_xTree_ID, v_xParent_ID + --FROM AD_CLIENTINFO c, AD_TREENODE n -- AD_TreeNodeMM n + --WHERE c.AD_Tree_Menu_ID=n.AD_Tree_ID + -- AND n.Parent_ID IS NULL + --AND c.AD_Client_ID=:NEW.AD_Client_ID; + -- Update + UPDATE AD_TREENODE + -- AD_TreeNodeMM + SET IsActive=:NEW.IsActive + WHERE AD_Tree_ID=v_xTree_ID + AND Node_ID=:NEW.C_ACTIVITY_ID; + END IF; + END IF; + END IF; + -- Updating +/*EXCEPTION +WHEN NO_DATA_FOUND THEN + RAISE_APPLICATION_ERROR(-20002, 'AD_AccountingRpt_Element InsertTrigger Error: No ClientInfo or parent TreeNode') ; + */ +END C_ACTIVITY_TRG +]]></body> + </trigger> + </database> ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
