details:   /erp/devel/pi/rev/c2c3302e8951
changeset: 7399:c2c3302e8951
user:      Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
date:      Tue May 18 17:48:39 2010 +0530
summary:   Fixes issue 13357: \"create standard\" process does not work in 
\"production run\" tab

TRIGGERS are trying to retrieve old data for INSERT operation, which is invalid 
and causes error. In order to fix it, new and old data assignment has been 
moved into their IF and ELSE block respectively.

diffstat:

 src-db/database/model/triggers/MA_PL_EMPLOYEE_TRG.xml    |  4 ++--
 src-db/database/model/triggers/MA_PL_IC_TRG.xml          |  4 ++--
 src-db/database/model/triggers/MA_PL_INVOICELINE_TRG.xml |  4 ++--
 src-db/database/model/triggers/MA_PL_MACHINE_TRG.xml     |  4 ++--
 src-db/database/model/triggers/MA_TOOLSETUSED_TRG.xml    |  4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r d4e0b9369ccf -r c2c3302e8951 
src-db/database/model/triggers/MA_PL_EMPLOYEE_TRG.xml
--- a/src-db/database/model/triggers/MA_PL_EMPLOYEE_TRG.xml     Tue May 18 
13:26:54 2010 +0200
+++ b/src-db/database/model/triggers/MA_PL_EMPLOYEE_TRG.xml     Tue May 18 
17:48:39 2010 +0530
@@ -28,12 +28,12 @@
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
 
-  v_New_Plan_ID:=:new.M_ProductionPlan_ID;
-  v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
   -- Get ID
   IF(UPDATING OR INSERTING) THEN
+    v_New_Plan_ID:=:new.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_New_Plan_ID;
   ELSE
+    v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_Old_Plan_ID;
   END IF;
   -- ReadOnly Check
diff -r d4e0b9369ccf -r c2c3302e8951 
src-db/database/model/triggers/MA_PL_IC_TRG.xml
--- a/src-db/database/model/triggers/MA_PL_IC_TRG.xml   Tue May 18 13:26:54 
2010 +0200
+++ b/src-db/database/model/triggers/MA_PL_IC_TRG.xml   Tue May 18 17:48:39 
2010 +0530
@@ -28,12 +28,12 @@
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
 
-  v_New_Plan_ID:=:new.M_ProductionPlan_ID;
-  v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
   -- Get ID
   IF(UPDATING OR INSERTING) THEN
+    v_New_Plan_ID:=:new.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_New_Plan_ID;
   ELSE
+    v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_Old_Plan_ID;
   END IF;
   -- ReadOnly Check
diff -r d4e0b9369ccf -r c2c3302e8951 
src-db/database/model/triggers/MA_PL_INVOICELINE_TRG.xml
--- a/src-db/database/model/triggers/MA_PL_INVOICELINE_TRG.xml  Tue May 18 
13:26:54 2010 +0200
+++ b/src-db/database/model/triggers/MA_PL_INVOICELINE_TRG.xml  Tue May 18 
17:48:39 2010 +0530
@@ -28,12 +28,12 @@
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
 
-  v_New_Plan_ID:=:new.M_ProductionPlan_ID;
-  v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
   -- Get ID
   IF(UPDATING OR INSERTING) THEN
+    v_New_Plan_ID:=:new.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_New_Plan_ID;
   ELSE
+    v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_Old_Plan_ID;
   END IF;
   -- ReadOnly Check
diff -r d4e0b9369ccf -r c2c3302e8951 
src-db/database/model/triggers/MA_PL_MACHINE_TRG.xml
--- a/src-db/database/model/triggers/MA_PL_MACHINE_TRG.xml      Tue May 18 
13:26:54 2010 +0200
+++ b/src-db/database/model/triggers/MA_PL_MACHINE_TRG.xml      Tue May 18 
17:48:39 2010 +0530
@@ -28,12 +28,12 @@
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
 
-  v_New_Plan_ID:=:new.M_ProductionPlan_ID;
-  v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
   -- Get ID
   IF(UPDATING OR INSERTING) THEN
+    v_New_Plan_ID:=:new.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_New_Plan_ID;
   ELSE
+    v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_Old_Plan_ID;
   END IF;
   -- ReadOnly Check
diff -r d4e0b9369ccf -r c2c3302e8951 
src-db/database/model/triggers/MA_TOOLSETUSED_TRG.xml
--- a/src-db/database/model/triggers/MA_TOOLSETUSED_TRG.xml     Tue May 18 
13:26:54 2010 +0200
+++ b/src-db/database/model/triggers/MA_TOOLSETUSED_TRG.xml     Tue May 18 
17:48:39 2010 +0530
@@ -28,12 +28,12 @@
     IF AD_isTriggerEnabled()='N' THEN RETURN;
     END IF;
 
-  v_New_Plan_ID:=:new.M_ProductionPlan_ID;
-  v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
   -- Get ID
   IF(UPDATING OR INSERTING) THEN
+    v_New_Plan_ID:=:new.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_New_Plan_ID;
   ELSE
+    v_Old_Plan_ID:=:old.M_ProductionPlan_ID;
     SELECT mp.M_Production_ID INTO v_ID FROM M_ProductionPlan mp WHERE 
mp.M_ProductionPlan_ID = v_Old_Plan_ID;
   END IF;
   -- ReadOnly Check

------------------------------------------------------------------------------

_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to