[Production-Development] Validate Work Effort and some fixes
authorrafaeldemiguel <rdm@openbravo.com>
Mon, 19 Sep 2011 12:50:06 +0200
changeset 14981 d60d2439880f
parent 14980 91be7a8ff363
child 14982 0efd2107a1a5
[Production-Development] Validate Work Effort and some fixes
src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml
src-db/database/model/tables/MA_COSTCENTER_EMPLOYEE.xml
src-db/database/model/tables/M_PRODUCTIONPLAN.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_PROCESS.xml
src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java
src/org/openbravo/erpCommon/ad_actionButton/ValidateWorkEffort_ProductionRun.java
--- a/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -16,7 +16,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2010 Openbravo SLU
+* All portions are Copyright (C) 2001-2011 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -65,6 +65,8 @@
     --  WRPhase products useed
     Cur_WRPUsed RECORD;
     --  Stocked Products
+    Cur_CostCenter_Employee RECORD;
+    -- CostCenter Employee
     CURSOR Cur_Stock (v_Product_old VARCHAR, v_UOM_old VARCHAR, v_Product_UOM_old VARCHAR, v_Org_old VARCHAR, v_Production_Id VARCHAR, v_Line NUMBER) IS
       SELECT T.M_PRODUCT_ID, T.C_UOM_ID, T.M_LOCATOR_ID, T.M_ATTRIBUTESETINSTANCE_ID,
         T.M_PRODUCT_UOM_ID, COALESCE(T.QtyOnHand, 0) AS Qty, T.QtyOrderOnHand AS QtyOrder,
@@ -450,17 +452,41 @@
         END LOOP; --Used Products
         --Insert salary categories.
 
-        INSERT INTO MA_PL_EMPLOYEE
-        (MA_PL_EMPLOYEE_ID,
-         CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
-         M_PRODUCTIONPLAN_ID, C_SALARY_CATEGORY_ID, QUANTITY)
-        SELECT AD_Get_Next_Sequence('MA_PL_Employee', v_Client_ID),
-         now(), v_User_ID, now(), v_User_ID, v_Client_ID, v_PlanOrg_ID, 'Y',
-         v_Record_ID, C_Salary_Category_ID, Quantity
-        FROM MA_COSTCENTER_EMPLOYEE cce, M_ProductionPlan pp
-        WHERE cce.MA_Costcenter_version_ID = pp.MA_COstCenter_Version_ID
-          AND pp.M_ProductionPlan_ID = v_Record_ID
-          AND cce.IsActive = 'Y';
+        FOR Cur_CostCenter_Employee IN
+		(SELECT C_Salary_Category_ID, Quantity, Split
+		FROM MA_COSTCENTER_EMPLOYEE cce, M_ProductionPlan pp
+		WHERE cce.MA_Costcenter_version_ID = pp.MA_COstCenter_Version_ID
+		  AND pp.M_ProductionPlan_ID = v_Record_ID
+		  AND cce.IsActive = 'Y')
+	LOOP
+		IF (Cur_COSTCENTER_EMPLOYEE.Split = 'Y') THEN 
+			FOR i IN 1..Cur_CostCenter_Employee.Quantity 
+			LOOP
+				INSERT INTO MA_PL_EMPLOYEE
+				(MA_PL_EMPLOYEE_ID,
+				 CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
+				 M_PRODUCTIONPLAN_ID, C_SALARY_CATEGORY_ID, QUANTITY)
+				 VALUES
+				(AD_Get_Next_Sequence('MA_PL_Employee', v_Client_ID),
+				 now(), v_User_ID, now(), v_User_ID, v_Client_ID, v_PlanOrg_ID, 'Y',
+				 v_Record_ID, Cur_CostCenter_Employee.C_Salary_Category_ID, 1)
+				 ;
+						
+			END LOOP;
+			
+		ELSE
+			INSERT INTO MA_PL_EMPLOYEE
+			(MA_PL_EMPLOYEE_ID,
+			 CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
+			 M_PRODUCTIONPLAN_ID, C_SALARY_CATEGORY_ID, QUANTITY)
+			 VALUES
+			(AD_Get_Next_Sequence('MA_PL_Employee', v_Client_ID),
+			 now(), v_User_ID, now(), v_User_ID, v_Client_ID, v_PlanOrg_ID, 'Y',
+			 v_Record_ID, Cur_CostCenter_Employee.C_Salary_Category_ID, Cur_CostCenter_Employee.Quantity)
+			 ;
+		END IF;
+	END LOOP;
+
 
         --Insert machines.
 
--- a/src-db/database/model/tables/MA_COSTCENTER_EMPLOYEE.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/model/tables/MA_COSTCENTER_EMPLOYEE.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -49,6 +49,10 @@
         <default><![CDATA[Y]]></default>
         <onCreateDefault/>
       </column>
+      <column name="SPLIT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="MA_COSTCENTER_EMPLOYEE_AD_CLIE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/M_PRODUCTIONPLAN.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/model/tables/M_PRODUCTIONPLAN.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -129,6 +129,10 @@
         <default><![CDATA[N]]></default>
         <onCreateDefault/>
       </column>
+      <column name="VALIDATING" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="M_PRODUCTIONPLAN_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -224783,6 +224783,39 @@
 <!--59FFF002FF8E3779E040007F01013B24-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--59FFF002FF8E3779E040007F01013B24--></AD_COLUMN>
 
+<!--5A02BD2E7E2C4C0497524E2748B11BBE--><AD_COLUMN>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_COLUMN_ID><![CDATA[5A02BD2E7E2C4C0497524E2748B11BBE]]></AD_COLUMN_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <NAME><![CDATA[Validate Work Effort]]></NAME>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <HELP><![CDATA[Process to validate the work effort.]]></HELP>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <COLUMNNAME><![CDATA[Validating]]></COLUMNNAME>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_TABLE_ID><![CDATA[385]]></AD_TABLE_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <SEQNO><![CDATA[232]]></SEQNO>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_ELEMENT_ID><![CDATA[800367]]></AD_ELEMENT_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_PROCESS_ID><![CDATA[FF808181326CD80501326CE906D70042]]></AD_PROCESS_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <POSITION><![CDATA[34]]></POSITION>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--5A02BD2E7E2C4C0497524E2748B11BBE--></AD_COLUMN>
+
 <!--5A15C409F86DAC19E040007F01000B04--><AD_COLUMN>
 <!--5A15C409F86DAC19E040007F01000B04-->  <AD_COLUMN_ID><![CDATA[5A15C409F86DAC19E040007F01000B04]]></AD_COLUMN_ID>
 <!--5A15C409F86DAC19E040007F01000B04-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -227034,6 +227067,40 @@
 <!--5E61B952F67C41A8829B222A7C6D7947-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--5E61B952F67C41A8829B222A7C6D7947--></AD_COLUMN>
 
+<!--5E6D181D9275479A982CF90D1D3DD497--><AD_COLUMN>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_COLUMN_ID><![CDATA[5E6D181D9275479A982CF90D1D3DD497]]></AD_COLUMN_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <NAME><![CDATA[Split]]></NAME>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <DESCRIPTION><![CDATA[Split]]></DESCRIPTION>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <HELP><![CDATA[Split]]></HELP>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <COLUMNNAME><![CDATA[Split]]></COLUMNNAME>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_TABLE_ID><![CDATA[800189]]></AD_TABLE_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_ELEMENT_ID><![CDATA[08204F656FDC49578931D85795FD64A4]]></AD_ELEMENT_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <POSITION><![CDATA[13]]></POSITION>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--5E6D181D9275479A982CF90D1D3DD497-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--5E6D181D9275479A982CF90D1D3DD497--></AD_COLUMN>
+
 <!--5E7C48B7AB0F46AEB4EDA3EA73871315--><AD_COLUMN>
 <!--5E7C48B7AB0F46AEB4EDA3EA73871315-->  <AD_COLUMN_ID><![CDATA[5E7C48B7AB0F46AEB4EDA3EA73871315]]></AD_COLUMN_ID>
 <!--5E7C48B7AB0F46AEB4EDA3EA73871315-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -19176,6 +19176,19 @@
 <!--07B757ED9603499A93F0F4E224616BD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--07B757ED9603499A93F0F4E224616BD2--></AD_ELEMENT>
 
+<!--08204F656FDC49578931D85795FD64A4--><AD_ELEMENT>
+<!--08204F656FDC49578931D85795FD64A4-->  <AD_ELEMENT_ID><![CDATA[08204F656FDC49578931D85795FD64A4]]></AD_ELEMENT_ID>
+<!--08204F656FDC49578931D85795FD64A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--08204F656FDC49578931D85795FD64A4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--08204F656FDC49578931D85795FD64A4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--08204F656FDC49578931D85795FD64A4-->  <COLUMNNAME><![CDATA[Split]]></COLUMNNAME>
+<!--08204F656FDC49578931D85795FD64A4-->  <NAME><![CDATA[Split]]></NAME>
+<!--08204F656FDC49578931D85795FD64A4-->  <PRINTNAME><![CDATA[Split]]></PRINTNAME>
+<!--08204F656FDC49578931D85795FD64A4-->  <DESCRIPTION><![CDATA[Split]]></DESCRIPTION>
+<!--08204F656FDC49578931D85795FD64A4-->  <HELP><![CDATA[Split]]></HELP>
+<!--08204F656FDC49578931D85795FD64A4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--08204F656FDC49578931D85795FD64A4--></AD_ELEMENT>
+
 <!--09B56C6C0BF34E80A4EFDEEE4ED5DBCD--><AD_ELEMENT>
 <!--09B56C6C0BF34E80A4EFDEEE4ED5DBCD-->  <AD_ELEMENT_ID><![CDATA[09B56C6C0BF34E80A4EFDEEE4ED5DBCD]]></AD_ELEMENT_ID>
 <!--09B56C6C0BF34E80A4EFDEEE4ED5DBCD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -118007,6 +118007,7 @@
 <!--801864-->  <AD_TAB_ID><![CDATA[800117]]></AD_TAB_ID>
 <!--801864-->  <AD_COLUMN_ID><![CDATA[802028]]></AD_COLUMN_ID>
 <!--801864-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--801864-->  <DISPLAYLOGIC><![CDATA[@Processed@='N']]></DISPLAYLOGIC>
 <!--801864-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--801864-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--801864-->  <SEQNO><![CDATA[110]]></SEQNO>
@@ -118138,7 +118139,7 @@
 <!--801990-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--801990-->  <AD_TAB_ID><![CDATA[800117]]></AD_TAB_ID>
 <!--801990-->  <AD_COLUMN_ID><![CDATA[802029]]></AD_COLUMN_ID>
-<!--801990-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--801990-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--801990-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--801990-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--801990-->  <SEQNO><![CDATA[130]]></SEQNO>
@@ -164327,7 +164328,7 @@
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <AD_TAB_ID><![CDATA[C9B5394DBA8C465C9CE26A361696B06E]]></AD_TAB_ID>
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <AD_COLUMN_ID><![CDATA[802029]]></AD_COLUMN_ID>
-<!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--1FCBC5DAD3A8478389F60DFBB0F81CA8-->  <SEQNO><![CDATA[130]]></SEQNO>
@@ -164518,6 +164519,7 @@
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <AD_TAB_ID><![CDATA[C9B5394DBA8C465C9CE26A361696B06E]]></AD_TAB_ID>
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <AD_COLUMN_ID><![CDATA[802028]]></AD_COLUMN_ID>
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <DISPLAYLOGIC><![CDATA[@Processed@='N']]></DISPLAYLOGIC>
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--22D230F3B7A044C1AD5D8CDFE7C36AF7-->  <SEQNO><![CDATA[110]]></SEQNO>
@@ -165412,7 +165414,7 @@
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <DISPLAYLENGTH><![CDATA[2]]></DISPLAYLENGTH>
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
-<!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <SEQNO><![CDATA[135]]></SEQNO>
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--30D6C84CE8FB45B6B00C8F38C28A38F5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -165580,6 +165582,33 @@
 <!--324F38F6762346AEA6A39777B40B04E1-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--324F38F6762346AEA6A39777B40B04E1--></AD_FIELD>
 
+<!--326B46ABC9644BDFB5358DBC226EA3E3--><AD_FIELD>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_FIELD_ID><![CDATA[326B46ABC9644BDFB5358DBC226EA3E3]]></AD_FIELD_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <NAME><![CDATA[Split]]></NAME>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <DESCRIPTION><![CDATA[Split]]></DESCRIPTION>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <HELP><![CDATA[Split]]></HELP>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_TAB_ID><![CDATA[800227]]></AD_TAB_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_COLUMN_ID><![CDATA[5E6D181D9275479A982CF90D1D3DD497]]></AD_COLUMN_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <GRID_SEQNO><![CDATA[50]]></GRID_SEQNO>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--326B46ABC9644BDFB5358DBC226EA3E3-->  <ISSHOWNINSTATUSBAR><![CDATA[Y]]></ISSHOWNINSTATUSBAR>
+<!--326B46ABC9644BDFB5358DBC226EA3E3--></AD_FIELD>
+
 <!--32F5F85430DF4FF499FF4485C69DEB9E--><AD_FIELD>
 <!--32F5F85430DF4FF499FF4485C69DEB9E-->  <AD_FIELD_ID><![CDATA[32F5F85430DF4FF499FF4485C69DEB9E]]></AD_FIELD_ID>
 <!--32F5F85430DF4FF499FF4485C69DEB9E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -193331,7 +193360,7 @@
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <DISPLAYLENGTH><![CDATA[2]]></DISPLAYLENGTH>
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
-<!--C81180C829FD44D48C9D04D09DA96A39-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--C81180C829FD44D48C9D04D09DA96A39-->  <SEQNO><![CDATA[135]]></SEQNO>
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--C81180C829FD44D48C9D04D09DA96A39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -195651,6 +195680,33 @@
 <!--F1CDE453637D43958F8CD4916A86760E-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--F1CDE453637D43958F8CD4916A86760E--></AD_FIELD>
 
+<!--F36C5360FCA7427AA77D5543BE7B0C46--><AD_FIELD>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_FIELD_ID><![CDATA[F36C5360FCA7427AA77D5543BE7B0C46]]></AD_FIELD_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <NAME><![CDATA[Validate Work Effort]]></NAME>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <HELP><![CDATA[Process to validate the work effort in Production Run Window.]]></HELP>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_TAB_ID><![CDATA[C9B5394DBA8C465C9CE26A361696B06E]]></AD_TAB_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_COLUMN_ID><![CDATA[5A02BD2E7E2C4C0497524E2748B11BBE]]></AD_COLUMN_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <DISPLAYLOGIC><![CDATA[@Processed@='Y']]></DISPLAYLOGIC>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <SEQNO><![CDATA[170]]></SEQNO>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <GRID_SEQNO><![CDATA[170]]></GRID_SEQNO>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--F36C5360FCA7427AA77D5543BE7B0C46-->  <ISSHOWNINSTATUSBAR><![CDATA[Y]]></ISSHOWNINSTATUSBAR>
+<!--F36C5360FCA7427AA77D5543BE7B0C46--></AD_FIELD>
+
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5--><AD_FIELD>
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5-->  <AD_FIELD_ID><![CDATA[F489C0DA5BFE40D28C0C888FBC1EF4A5]]></AD_FIELD_ID>
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -19747,8 +19747,8 @@
 <!--FF80818132626D6F01326328BA9400B4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--FF80818132626D6F01326328BA9400B4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--FF80818132626D6F01326328BA9400B4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--FF80818132626D6F01326328BA9400B4-->  <VALUE><![CDATA[WorkRequirementCreated]]></VALUE>
-<!--FF80818132626D6F01326328BA9400B4-->  <MSGTEXT><![CDATA[Work Requirement Created for day ]]></MSGTEXT>
+<!--FF80818132626D6F01326328BA9400B4-->  <VALUE><![CDATA[WorkEffortCreated]]></VALUE>
+<!--FF80818132626D6F01326328BA9400B4-->  <MSGTEXT><![CDATA[Work Effort Created for day ]]></MSGTEXT>
 <!--FF80818132626D6F01326328BA9400B4-->  <MSGTYPE><![CDATA[S]]></MSGTYPE>
 <!--FF80818132626D6F01326328BA9400B4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FF80818132626D6F01326328BA9400B4--></AD_MESSAGE>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -4155,4 +4155,16 @@
 <!--FF808181324D007801324D2BDC8E006A-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--FF808181324D007801324D2BDC8E006A--></AD_MODEL_OBJECT>
 
+<!--FF808181326CD80501326CEA3BA8004A--><AD_MODEL_OBJECT>
+<!--FF808181326CD80501326CEA3BA8004A-->  <AD_MODEL_OBJECT_ID><![CDATA[FF808181326CD80501326CEA3BA8004A]]></AD_MODEL_OBJECT_ID>
+<!--FF808181326CD80501326CEA3BA8004A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181326CD80501326CEA3BA8004A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181326CD80501326CEA3BA8004A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181326CD80501326CEA3BA8004A-->  <ACTION><![CDATA[P]]></ACTION>
+<!--FF808181326CD80501326CEA3BA8004A-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_actionButton.ValidateWorkEffort_ProductionRun]]></CLASSNAME>
+<!--FF808181326CD80501326CEA3BA8004A-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--FF808181326CD80501326CEA3BA8004A-->  <AD_PROCESS_ID><![CDATA[FF808181326CD80501326CE906D70042]]></AD_PROCESS_ID>
+<!--FF808181326CD80501326CEA3BA8004A-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--FF808181326CD80501326CEA3BA8004A--></AD_MODEL_OBJECT>
+
 </data>
--- a/src-db/database/sourcedata/AD_PROCESS.xml	Wed Sep 14 09:49:11 2011 +0200
+++ b/src-db/database/sourcedata/AD_PROCESS.xml	Mon Sep 19 12:50:06 2011 +0200
@@ -5602,4 +5602,23 @@
 <!--FF808181324D007801324D2AE1130066-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
 <!--FF808181324D007801324D2AE1130066--></AD_PROCESS>
 
+<!--FF808181326CD80501326CE906D70042--><AD_PROCESS>
+<!--FF808181326CD80501326CE906D70042-->  <AD_PROCESS_ID><![CDATA[FF808181326CD80501326CE906D70042]]></AD_PROCESS_ID>
+<!--FF808181326CD80501326CE906D70042-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181326CD80501326CE906D70042-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181326CD80501326CE906D70042-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181326CD80501326CE906D70042-->  <VALUE><![CDATA[ValidateWorkEffort_ProductionRun]]></VALUE>
+<!--FF808181326CD80501326CE906D70042-->  <NAME><![CDATA[Validate Work Effort]]></NAME>
+<!--FF808181326CD80501326CE906D70042-->  <HELP><![CDATA[Process to validate the work effort in Production Run Window.]]></HELP>
+<!--FF808181326CD80501326CE906D70042-->  <ACCESSLEVEL><![CDATA[7]]></ACCESSLEVEL>
+<!--FF808181326CD80501326CE906D70042-->  <ISUSERSTARTABLE><![CDATA[N]]></ISUSERSTARTABLE>
+<!--FF808181326CD80501326CE906D70042-->  <ISREPORT><![CDATA[N]]></ISREPORT>
+<!--FF808181326CD80501326CE906D70042-->  <ISDIRECTPRINT><![CDATA[N]]></ISDIRECTPRINT>
+<!--FF808181326CD80501326CE906D70042-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--FF808181326CD80501326CE906D70042-->  <ISJASPER><![CDATA[N]]></ISJASPER>
+<!--FF808181326CD80501326CE906D70042-->  <ISEXTERNALSERVICE><![CDATA[N]]></ISEXTERNALSERVICE>
+<!--FF808181326CD80501326CE906D70042-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF808181326CD80501326CE906D70042-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
+<!--FF808181326CD80501326CE906D70042--></AD_PROCESS>
+
 </data>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java	Wed Sep 14 09:49:11 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java	Mon Sep 19 12:50:06 2011 +0200
@@ -79,9 +79,6 @@
       Timestamp starttime = Timestamp.valueOf(dateformatTime + " " + strStartTime + ".0");
       Timestamp endtime = Timestamp.valueOf(dateformatTime + " " + strEndTime + ".0");
 
-      // Long startimelong = new
-      // Timestamp starttime = new Timestamp();
-
       // Search Phases To Be Created
       WorkRequirement workReq = OBDal.getInstance().get(WorkRequirement.class, strWorkRequirement);
 
@@ -200,7 +197,7 @@
       msg.setType("Success");
       msg.setTitle(Utility.messageBD(conn, "Success", bundle.getContext().getLanguage()));
       msg.setMessage(counter + " "
-          + Utility.messageBD(conn, "WorkRequirementCreated", bundle.getContext().getLanguage())
+          + Utility.messageBD(conn, "WorkEffortCreated", bundle.getContext().getLanguage())
           + strdate);
       bundle.setResult(msg);
     } catch (final Exception e) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ValidateWorkEffort_ProductionRun.java	Mon Sep 19 12:50:06 2011 +0200
@@ -0,0 +1,139 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (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) 2011 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.erpCommon.ad_actionButton;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.provider.OBProvider;
+import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.reference.PInstanceProcessData;
+import org.openbravo.erpCommon.utility.OBError;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.process.ProcessInstance;
+import org.openbravo.model.materialmgmt.transaction.ProductionPlan;
+import org.openbravo.model.materialmgmt.transaction.ProductionTransaction;
+import org.openbravo.scheduling.ProcessBundle;
+
+public class ValidateWorkEffort_ProductionRun implements org.openbravo.scheduling.Process {
+
+  @Override
+  public void execute(ProcessBundle bundle) throws Exception {
+
+    try {
+
+      final String strMProductionPlanID = (String) bundle.getParams().get("M_ProductionPlan_ID");
+      final ConnectionProvider conn = bundle.getConnection();
+      ProductionPlan productionPlan = OBDal.getInstance().get(ProductionPlan.class,
+          strMProductionPlanID);
+      ProductionTransaction production = productionPlan.getProduction();
+
+      validateWorkEffort(production, conn, bundle.getContext().toVars());
+      OBDal.getInstance().save(production);
+      OBDal.getInstance().flush();
+
+      final OBError msg = new OBError();
+
+      msg.setType("Success");
+      msg.setTitle(Utility.messageBD(conn, "Success", bundle.getContext().getLanguage()));
+      msg.setMessage(Utility.messageBD(conn, "Success", bundle.getContext().getLanguage()));
+      bundle.setResult(msg);
+    } catch (final Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      e.printStackTrace(System.err);
+      final OBError msg = new OBError();
+      msg.setType("Error");
+      if (e instanceof org.hibernate.exception.GenericJDBCException) {
+        msg.setMessage(((org.hibernate.exception.GenericJDBCException) e).getSQLException()
+            .getNextException().getMessage());
+      } else if (e instanceof org.hibernate.exception.ConstraintViolationException) {
+        msg.setMessage(((org.hibernate.exception.ConstraintViolationException) e).getSQLException()
+            .getNextException().getMessage());
+      } else {
+        msg.setMessage(e.getMessage());
+      }
+      msg.setTitle("Error occurred");
+      bundle.setResult(msg);
+    }
+  }
+
+  private void validateWorkEffort(ProductionTransaction production, ConnectionProvider conn,
+      VariablesSecureApp vars) throws Exception {
+
+    OBContext.setAdminMode();
+
+    org.openbravo.model.ad.ui.Process process = OBDal.getInstance().get(
+        org.openbravo.model.ad.ui.Process.class, "800106");
+
+    final ProcessInstance pInstance = OBProvider.getInstance().get(ProcessInstance.class);
+    pInstance.setProcess(process);
+    pInstance.setActive(true);
+    pInstance.setRecordID(production.getId());
+    pInstance.setUserContact(OBContext.getOBContext().getUser());
+
+    OBDal.getInstance().save(pInstance);
+    OBDal.getInstance().flush();
+
+    try {
+      final Connection connection = OBDal.getInstance().getConnection();
+      PreparedStatement ps = null;
+      final Properties obProps = OBPropertiesProvider.getInstance().getOpenbravoProperties();
+      if (obProps.getProperty("bbdd.rdbms") != null
+          && obProps.getProperty("bbdd.rdbms").equals("POSTGRE")) {
+        ps = connection.prepareStatement("SELECT * FROM ma_workeffort_validate(?)");
+      } else {
+        ps = connection.prepareStatement("CALL ma_workeffort_validate(?)");
+      }
+      ps.setString(1, pInstance.getId());
+      ps.execute();
+
+    } catch (Exception e) {
+      throw new IllegalStateException(e);
+    }
+
+    OBDal.getInstance().getSession().refresh(pInstance);
+
+    if (pInstance.getResult() == 0) {
+      // Error Processing
+      OBError myMessage = Utility
+          .getProcessInstanceMessage(conn, vars, getPInstanceData(pInstance));
+      throw new OBException("ERROR: " + myMessage.getMessage());
+    }
+    OBContext.restorePreviousMode();
+  }
+
+  private PInstanceProcessData[] getPInstanceData(ProcessInstance pInstance) throws Exception {
+    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
+    PInstanceProcessData objectPInstanceProcessData = new PInstanceProcessData();
+    objectPInstanceProcessData.result = pInstance.getResult().toString();
+    objectPInstanceProcessData.errormsg = pInstance.getErrorMsg();
+    objectPInstanceProcessData.pMsg = "";
+    vector.addElement(objectPInstanceProcessData);
+    PInstanceProcessData pinstanceData[] = new PInstanceProcessData[1];
+    vector.copyInto(pinstanceData);
+    return pinstanceData;
+  }
+}