details:   https://code.openbravo.com/erp/devel/pi/rev/72d6045b34d9
changeset: 17713:72d6045b34d9
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Mon Aug 20 13:40:26 2012 +0200
summary:   Fixes issue 21389: Changes onCreateDefault for a moduleScript

diffstat:

 src-db/database/model/tables/M_TRANSACTION.xml                                 
                      |    2 +-
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateMTransactionCostingStatus.class
 |    0 
 
src-util/modulescript/src/org/openbravo/modulescript/UpdateMTransactionCostingStatus.java
            |   48 ++++++++++
 3 files changed, 49 insertions(+), 1 deletions(-)

diffs (66 lines):

diff -r 84e5da1deea9 -r 72d6045b34d9 
src-db/database/model/tables/M_TRANSACTION.xml
--- a/src-db/database/model/tables/M_TRANSACTION.xml    Mon Aug 20 13:30:45 
2012 +0200
+++ b/src-db/database/model/tables/M_TRANSACTION.xml    Mon Aug 20 13:40:26 
2012 +0200
@@ -115,7 +115,7 @@
       </column>
       <column name="COSTING_STATUS" primaryKey="false" required="true" 
type="VARCHAR" size="60" autoIncrement="false">
         <default><![CDATA[NC]]></default>
-        <onCreateDefault><![CDATA[CASE WHEN ISCOSTCALCULATED='Y' THEN 'CC' 
ELSE 'NC' END]]></onCreateDefault>
+        <onCreateDefault/>
       </column>
       <foreign-key foreignTable="M_INTERNAL_CONSUMPTIONLINE" 
name="M_INTL_CONSUMP_MTRANSACTION">
         <reference local="M_INTERNAL_CONSUMPTIONLINE_ID" 
foreign="M_INTERNAL_CONSUMPTIONLINE_ID"/>
diff -r 84e5da1deea9 -r 72d6045b34d9 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateMTransactionCostingStatus.class
Binary file 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateMTransactionCostingStatus.class
 has changed
diff -r 84e5da1deea9 -r 72d6045b34d9 
src-util/modulescript/src/org/openbravo/modulescript/UpdateMTransactionCostingStatus.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/modulescript/src/org/openbravo/modulescript/UpdateMTransactionCostingStatus.java
 Mon Aug 20 13:40:26 2012 +0200
@@ -0,0 +1,48 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.modulescript;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.modulescript.ModuleScript;
+
+public class UpdateMTransactionCostingStatus extends ModuleScript {
+
+  public void execute() {
+    PreparedStatement ps = null;
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+      ps = cp
+          .getPreparedStatement("UPDATE m_transaction SET costing_status = 
'CC' WHERE iscostcalculated = 'Y' AND costing_status = 'NC'");
+      ps.executeUpdate();
+    } catch (Exception e) {
+      handleError(e);
+    } finally {
+      try {
+        if (!ps.isClosed()) {
+          ps.close();
+        }
+      } catch (Exception e) {
+        handleError(e);
+      }
+    }
+  }
+}

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to