Rollback undesired changes.
authorDavid Miguelez <david.miguelez@openbravo.com>
Tue, 30 Apr 2013 20:12:54 +0200
changeset 20248 417c9e911cc0
parent 20247 acfb929ac422
child 20250 a7c5a974e6fa
Rollback undesired changes.
src-db/database/model/tables/AD_IMAGE.xml
src-db/database/model/triggers/AD_ORG_BEFORE_TRG.xml
src-db/database/model/triggers/AD_ORG_TRG.xml
src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml
--- a/src-db/database/model/tables/AD_IMAGE.xml	Tue Apr 30 20:06:23 2013 +0200
+++ b/src-db/database/model/tables/AD_IMAGE.xml	Tue Apr 30 20:12:54 2013 +0200
@@ -60,7 +60,7 @@
       <foreign-key foreignTable="AD_CLIENT" name="AD_IMAGE_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_IMAGE_AD_ORG" onDelete="cascade">
+      <foreign-key foreignTable="AD_ORG" name="AD_IMAGE_AD_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <check name="AD_IMAGE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
--- a/src-db/database/model/triggers/AD_ORG_BEFORE_TRG.xml	Tue Apr 30 20:06:23 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-  <database name="TRIGGER AD_ORG_BEFORE_TRG">
-    <trigger name="AD_ORG_BEFORE_TRG" table="AD_ORG" fires="before" insert="false" update="false" delete="true" foreach="row">
-      <body><![CDATA[
-  /*************************************************************************
-  * The contents of this file are subject to the Compiere Public
-  * License 1.1 ("License"); You may not use this file except in
-  * compliance with the License. You may obtain a copy of the License in
-  * the legal folder of your Openbravo installation.
-  * 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  Compiere  ERP &  Business Solution
-  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
-  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
-  * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
-  * All Rights Reserved.
-  * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2013 Openbravo, S.L.U.
-  *
-  * Specifically, this derivative work is based upon the following Compiere
-  * file and version.
-  *************************************************************************/
-  v_xTree_ID VARCHAR2(32);
-  v_xParent_ID VARCHAR2(32);
-  TYPE RECORD IS REF CURSOR;
-    CUR_PeriodControl RECORD;
-    v_count NUMBER;
-
-BEGIN
-
-    IF AD_isTriggerEnabled()='N' THEN RETURN;
-    END IF;
-
-  IF(DELETING) THEN
-    --  Delete TreeNode --
-    --  get AD_Tree_ID
-    SELECT c.AD_Tree_Org_ID
-    INTO v_xTree_ID
-    FROM AD_ClientInfo c
-    WHERE c.AD_Client_ID=:old.AD_Client_ID;
-    select COUNT(*) INTO v_count from AD_TREENODE where parent_id=:old.AD_ORG_ID
-  	and AD_TREE_ID=v_xTree_ID;
-    IF(v_count>0) THEN
-    	RAISE_APPLICATION_ERROR(-20000, '@ChildOrgCheck@') ;
-    END IF;
-    DELETE
-    FROM AD_TREENODE
-    WHERE AD_CLIENT_ID=:old.AD_Client_ID
-      AND AD_Tree_ID=v_xTree_ID
-      AND Node_ID=:old.AD_Org_ID;
-  END IF;
-  
-  -- Deleting
-EXCEPTION
-WHEN NO_DATA_FOUND THEN
-  RAISE_APPLICATION_ERROR(-20000, '@20014@') ;
-END AD_ORG_BEFORE_TRG
-]]></body>
-    </trigger>
-  </database>
--- a/src-db/database/model/triggers/AD_ORG_TRG.xml	Tue Apr 30 20:06:23 2013 +0200
+++ b/src-db/database/model/triggers/AD_ORG_TRG.xml	Tue Apr 30 20:12:54 2013 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
   <database name="TRIGGER AD_ORG_TRG">
-    <trigger name="AD_ORG_TRG" table="AD_ORG" fires="after" insert="true" update="false" delete="false" foreach="row">
+    <trigger name="AD_ORG_TRG" table="AD_ORG" fires="after" insert="true" update="true" delete="true" foreach="row">
       <body><![CDATA[
   /*************************************************************************
   * The contents of this file are subject to the Compiere Public
@@ -104,7 +104,26 @@
          '?'
       )
       ;
+        
+  ELSIF(DELETING) THEN
+    --  Delete TreeNode --
+    --  get AD_Tree_ID
+    SELECT c.AD_Tree_Org_ID
+    INTO v_xTree_ID
+    FROM AD_ClientInfo c
+    WHERE c.AD_Client_ID=:old.AD_Client_ID;
+    select COUNT(*) INTO v_count from AD_TREENODE where parent_id=:old.AD_ORG_ID
+  	and AD_TREE_ID=v_xTree_ID;
+    IF(v_count>0) THEN
+    	RAISE_APPLICATION_ERROR(-20000, '@ChildOrgCheck@') ;
+    END IF;
+    DELETE
+    FROM AD_TREENODE
+    WHERE AD_CLIENT_ID=:old.AD_Client_ID
+      AND AD_Tree_ID=v_xTree_ID
+      AND Node_ID=:old.AD_Org_ID;     
   END IF;
+  -- Deleting
 EXCEPTION
 WHEN NO_DATA_FOUND THEN
   RAISE_APPLICATION_ERROR(-20000, '@20014@') ;
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Tue Apr 30 20:06:23 2013 +0200
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Tue Apr 30 20:12:54 2013 +0200
@@ -2312,7 +2312,7 @@
 <!--FF8080812E77708D012E7796A94B0017-->  <SORTNO><![CDATA[110]]></SORTNO>
 <!--FF8080812E77708D012E7796A94B0017-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080812E77708D012E7796A94B0017-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
-<!--FF8080812E77708D012E7796A94B0017-->  <DEFAULT_EXPRESSION><![CDATA[if (OB.getWindowId() == '800051' ||  OB.getWindowId() == '800052' || OB.getWindowId() == '800096' || OB.getWindowId() == '800027') {false} else {if (OB.isSalesTransaction() == true) { true } else {if (OB.getWindowId() != '184') {false}}}]]></DEFAULT_EXPRESSION>
+<!--FF8080812E77708D012E7796A94B0017-->  <DEFAULT_EXPRESSION><![CDATA[if (OB.getWindowId() == '800051' ||  OB.getWindowId() == '800052' || OB.getWindowId() == '800096' || OB.getWindowId() == '800027') {false} else {if (OB.isSalesTransaction() == true) { true } else {false}}]]></DEFAULT_EXPRESSION>
 <!--FF8080812E77708D012E7796A94B0017-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--FF8080812E77708D012E7796A94B0017--></OBUISEL_SELECTOR_FIELD>