fixed bug 15217: Moving forward / back arrows not working in Reconciliation tab
authorAsier Lostalé <asier.lostale@openbravo.com>
Tue, 14 Dec 2010 15:57:09 +0100
changeset 9128 17b85f344d49
parent 9127 81d93d29ae90
child 9129 dad0e6a90725
fixed bug 15217: Moving forward / back arrows not working in Reconciliation tab
src/org/openbravo/erpCommon/utility/TableSQLData.java
--- a/src/org/openbravo/erpCommon/utility/TableSQLData.java	Tue Dec 14 14:12:48 2010 +0100
+++ b/src/org/openbravo/erpCommon/utility/TableSQLData.java	Tue Dec 14 15:57:09 2010 +0100
@@ -2145,13 +2145,32 @@
        * executable sql statement and uses this instead of the bigger one.
        */
       if (onlyId) {
-        txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
-        txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
-        int pos = txtAuxWhere.indexOf("SELECT");
-        txtAuxWhere.delete(0, pos);
-        // replace the previously built sql-text with our version
-        // completely
-        text = txtAuxWhere;
+        if (getPool().getRDBMS().equalsIgnoreCase("ORACLE")) {
+          txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
+          txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
+          int pos = txtAuxWhere.indexOf("FROM");
+          txtAuxWhere.delete(0, pos);
+          // replace the previously built sql-text with our version
+          // completely
+
+          text = txtAuxWhere;
+
+          if (hasRange) {
+            // don't add alias as it is already done in the subquery
+            text.insert(0, "SELECT " + keyColumns + " \n");
+          } else {
+            // add alias
+            text.insert(0, "SELECT " + keyColumnsTable + " \n");
+          }
+        } else {
+          txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
+          txtAuxWhere.deleteCharAt(txtAuxWhere.length() - 1);
+          int pos = txtAuxWhere.indexOf("SELECT");
+          txtAuxWhere.delete(0, pos);
+          // replace the previously built sql-text with our version
+          // completely
+          text = txtAuxWhere;
+        }
       } else {
         // old behavior for !onlyId case
         text.append("WHERE ").append(txtAuxWhere.toString());