Fixes issue 19620: A Commit is done in
authorJavier Etxarri <javier.echarri@openbravo.com>
Tue, 28 Feb 2012 13:33:47 +0100
changeset 15635 93367ec81ec7
parent 15634 5e2e3880c5ef
child 15636 d0b25330b16b
Fixes issue 19620: A Commit is done in
ma_workeffort_validate() with an Extension Point configures
src-db/database/model/functions/MA_WORKEFFORT_VALIDATE.xml
src-db/database/model/functions/MA_WRPHASE_CLOSE.xml
--- a/src-db/database/model/functions/MA_WORKEFFORT_VALIDATE.xml	Tue Feb 28 13:26:38 2012 +0100
+++ b/src-db/database/model/functions/MA_WORKEFFORT_VALIDATE.xml	Tue Feb 28 13:33:47 2012 +0100
@@ -343,7 +343,7 @@
 	  v_User_ID, v_Client_ID, v_Org_ID, now(), v_User_ID,
 	  now(), v_User_ID
 	  );
-	  MA_WRPHASE_CLOSE(v_AD_Pinstance_ID);
+	  MA_WRPHASE_CLOSE(v_AD_Pinstance_ID,'N');
 	END IF;
       END LOOP;
       -- Indicate that we are done
--- a/src-db/database/model/functions/MA_WRPHASE_CLOSE.xml	Tue Feb 28 13:26:38 2012 +0100
+++ b/src-db/database/model/functions/MA_WRPHASE_CLOSE.xml	Tue Feb 28 13:33:47 2012 +0100
@@ -4,6 +4,9 @@
       <parameter name="p_pinstance_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_calledfromapp" type="VARCHAR" mode="in">
+        <default><![CDATA[Y]]></default>
+      </parameter>
       <body><![CDATA[/*************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
@@ -37,7 +40,7 @@
       --  Update AD_PInstance
       DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
       v_ResultStr:='PInstanceNotFound';
-      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
+      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL, p_calledfromapp) ;
       --  Get Parameters
       v_ResultStr:='ReadingParameters';
       FOR Cur_Parameter IN
@@ -84,7 +87,7 @@
     IF(p_PInstance_ID IS NOT NULL) THEN
       --  Update AD_PInstance
       DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 1, v_Message) ;
+      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 1, v_Message, p_calledfromapp) ;
     ELSE
       DBMS_OUTPUT.PUT_LINE('--<<MA_WorkRequirement_Process finished>> ' || v_Message) ;
     END IF;
@@ -95,11 +98,15 @@
   v_ResultStr:= '@ERROR=' || SQLERRM;
   DBMS_OUTPUT.PUT_LINE(v_ResultStr) ;
   IF(p_PInstance_ID IS NOT NULL) THEN
-    ROLLBACK;
-    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
+    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 0, v_ResultStr,p_calledfromapp) ;
+    IF (p_calledfromapp = 'Y') THEN
+      ROLLBACK;
+      RETURN;
+    ELSE
+      RAISE;
+    END IF;
   END IF;
   --p_Invoice_ID := 0;        --  Error Indicator
-  RETURN;
 END MA_WRPHASE_CLOSE
 ]]></body>
     </function>