details:   /erp/devel/pi/rev/7719a5d32346
changeset: 7403:7719a5d32346
user:      Sathiyan Sivaprakasam <sathiyan.sivaprakasam <at> openbravo.com>
date:      Wed May 19 17:24:09 2010 +0530
summary:   13362: api check build 393 fails

diffstat:

 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheck.class
     |    0 
 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheckData.class
 |    0 
 
src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck.java
                |   50 ++++++++++
 
src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck_data.xsql
           |   36 +++++++
 4 files changed, 86 insertions(+), 0 deletions(-)

diffs (98 lines):

diff -r 6d330abd6826 -r 7719a5d32346 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheck.class
Binary file 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheck.class
 has changed
diff -r 6d330abd6826 -r 7719a5d32346 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheckData.class
Binary file 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/PaymentGLItemCheckData.class
 has changed
diff -r 6d330abd6826 -r 7719a5d32346 
src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck.java
        Wed May 19 17:24:09 2010 +0530
@@ -0,0 +1,50 @@
+/*
+ *************************************************************************
+ * 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) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.buildvalidation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openbravo.database.ConnectionProvider;
+
+/**
+ * This validation is related to this issue: 
https://issues.openbravo.com/view.php?id=12929 The
+ * constraint C_BANKSTATLN_PA_GLITEM_ID_CHK was made more restrictive, and it 
will fail if the data
+ * is not correct and is not fixed before updating.
+ */
+public class PaymentGLItemCheck extends BuildValidation {
+
+  @Override
+  public List<String> execute() {
+    ConnectionProvider cp = getConnectionProvider();
+    ArrayList<String> errors = new ArrayList<String>();
+    try {
+      int a = Integer.parseInt(PaymentGLItemCheckData.countWithConstraint(cp));
+      int b = 
Integer.parseInt(PaymentGLItemCheckData.countWithoutConstraint(cp));
+      if (a != b) {
+        errors
+            .add("Due to a database constraint modification, is no longer 
allowed you select a debt payment and g/l item at same time in bank statement 
line. There exists data in your database that do not fit this new constraint. 
Please fix it before updating the database.");
+      }
+    } catch (Exception e) {
+      return handleError(e);
+    }
+    return errors;
+  }
+
+}
diff -r 6d330abd6826 -r 7719a5d32346 
src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck_data.xsql
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/buildvalidation/src/org/openbravo/buildvalidation/PaymentGLItemCheck_data.xsql
   Wed May 19 17:24:09 2010 +0530
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+
+<SqlClass name="PaymentGLItemCheckData" 
package="org.openbravo.buildvalidation">
+  <SqlMethod name="countWithConstraint" type="preparedStatement" 
return="string">
+      <SqlMethodComment>This query counts the number of rows in 
c_bankstatementline with constraint</SqlMethodComment>
+      <Sql><![CDATA[
+         SELECT count(*) as count FROM c_bankstatementline where 
((C_DEBT_PAYMENT_ID IS NOT NULL) AND (C_GLITEM_ID IS NULL)) OR 
(C_DEBT_PAYMENT_ID IS NULL)
+          ]]>
+      </Sql>
+  </SqlMethod>
+  <SqlMethod name="countWithoutConstraint" type="preparedStatement" 
return="string">
+      <SqlMethodComment>This query counts the number of rows in 
c_bankstatementline without constraint</SqlMethodComment>
+      <Sql><![CDATA[
+         SELECT count(*) as count FROM c_bankstatementline
+          ]]>
+      </Sql>
+  </SqlMethod>
+</SqlClass>

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

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

Reply via email to