[order Preparation] Changes M_MOVEMENT_POST process to accept Id and pinstance
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Mon, 07 Mar 2016 12:08:38 +0100
changeset 28830 637037788ad7
parent 28829 798b079b6972
child 28831 1a77447abb0e
[order Preparation] Changes M_MOVEMENT_POST process to accept Id and pinstance
src-db/database/model/functions/M_MOVEMENT_POST.xml
src-db/database/model/functions/M_MOVEMENT_POST0.xml
src-db/database/sourcedata/AD_PROCESS.xml
--- a/src-db/database/model/functions/M_MOVEMENT_POST.xml	Fri Mar 04 14:44:51 2016 +0100
+++ b/src-db/database/model/functions/M_MOVEMENT_POST.xml	Mon Mar 07 12:08:38 2016 +0100
@@ -4,6 +4,9 @@
       <parameter name="pinstance_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_movement_id" type="VARCHAR" mode="in">
+        <default><![CDATA[NULL]]></default>
+      </parameter>
       <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
@@ -57,30 +60,36 @@
     END_PROCESS BOOLEAN:=false;
     v_productname m_product.name%TYPE;
   BEGIN
+  IF (pinstance_id IS NOT NULL) THEN
     --  Update AD_PInstance
     DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || PInstance_ID) ;
     v_ResultStr:='PInstanceNotFound';
     AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'Y', NULL, NULL) ;
+  END IF;
   BEGIN --BODY
-    -- Get Parameters
-    v_ResultStr:='ReadingParameters';
-    FOR Cur_Parameter IN
-      (SELECT i.Record_ID,
-        i.AD_User_ID,
-        p.ParameterName,
-        p.P_String,
-        p.P_Number,
-        p.P_Date
-      FROM AD_PInstance i
-      LEFT JOIN AD_PInstance_Para p
-        ON i.AD_PInstance_ID=p.AD_PInstance_ID
-      WHERE i.AD_PInstance_ID=PInstance_ID
-      ORDER BY p.SeqNo
-      )
-    LOOP
-      v_Record_ID:=Cur_Parameter.Record_ID;
-      v_p_User:=Cur_Parameter.AD_User_ID;
-    END LOOP; -- Get Parameter
+	  IF (pinstance_id IS NOT NULL) THEN
+	    -- Get Parameters
+	    v_ResultStr:='ReadingParameters';
+	    FOR Cur_Parameter IN
+	      (SELECT i.Record_ID,
+	        i.AD_User_ID,
+	        p.ParameterName,
+	        p.P_String,
+	        p.P_Number,
+	        p.P_Date
+	      FROM AD_PInstance i
+	      LEFT JOIN AD_PInstance_Para p
+	        ON i.AD_PInstance_ID=p.AD_PInstance_ID
+	      WHERE i.AD_PInstance_ID=PInstance_ID
+	      ORDER BY p.SeqNo
+	      )
+	    LOOP
+	      v_Record_ID:=Cur_Parameter.Record_ID;
+	      v_p_User:=Cur_Parameter.AD_User_ID;
+	    END LOOP; -- Get Parameter
+    ELSE
+	    v_Record_ID:=p_movement_id;
+	  END IF;
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
     -- Reading Movement
     SELECT MovementDate,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_MOVEMENT_POST0.xml	Mon Mar 07 12:08:38 2016 +0100
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_MOVEMENT_POST0">
+    <function name="M_MOVEMENT_POST0" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <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) 2001-2008 Openbravo, S.L.U.
+  *
+  * Specifically, this derivative work is based upon the following Compiere
+  * file and version.
+  *************************************************************************
+  * $Id: C_Invoice_Post0.sql,v 1.2 2002/10/21 04:49:46 jjanke Exp $
+  ***
+  * Title:  Post single Invoice
+  *************************************************************************/
+BEGIN
+  M_MOVEMENT_POST(pinstance_id, NULL);
+END M_MOVEMENT_POST0
+]]></body>
+    </function>
+  </database>
--- a/src-db/database/sourcedata/AD_PROCESS.xml	Fri Mar 04 14:44:51 2016 +0100
+++ b/src-db/database/sourcedata/AD_PROCESS.xml	Mon Mar 07 12:08:38 2016 +0100
@@ -506,7 +506,7 @@
 <!--122-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--122-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--122-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--122-->  <VALUE><![CDATA[M_Movement_Post]]></VALUE>
+<!--122-->  <VALUE><![CDATA[M_Movement_Post0]]></VALUE>
 <!--122-->  <NAME><![CDATA[Process Movements]]></NAME>
 <!--122-->  <DESCRIPTION><![CDATA[Process Inventory Movements]]></DESCRIPTION>
 <!--122-->  <HELP><![CDATA[Process Inventory Movements will update inventory quantities based on the defined movements between warehouses or locations.]]></HELP>