details:   /erp/devel/pi/rev/d01a4c3322d5
changeset: 6445:d01a4c3322d5
user:      Rajagopal Baskaran <rajagopal.baskaran <at> openbravo.com>
date:      Wed Feb 17 16:33:08 2010 +0530
summary:   Fixes issue 12010: Account selector is slow with more than 20.000

diffstat:

 src/org/openbravo/erpCommon/info/Account.html |  33 ++++++++++++++++++++------
 src/org/openbravo/erpCommon/info/Account.java |  28 ++++++++++++----------
 src/org/openbravo/erpCommon/info/Account.xml  |   1 +
 3 files changed, 41 insertions(+), 21 deletions(-)

diffs (122 lines):

diff -r e18ac7648234 -r d01a4c3322d5 
src/org/openbravo/erpCommon/info/Account.html
--- a/src/org/openbravo/erpCommon/info/Account.html     Tue Feb 16 16:52:57 
2010 +0100
+++ b/src/org/openbravo/erpCommon/info/Account.html     Wed Feb 17 16:33:08 
2010 +0530
@@ -52,7 +52,7 @@
 }
 
 function onloadFunctions() {
-       
+         keyArray[keyArray.length] = new keyArrayItem("ENTER", 
"openSearch(null, null, '../info/AccountElementValue.html', 
'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmSelector', 'inpAccount', 
'inpAccount_DES',document.frmSelector.inpAccount_DES.value, 'Command', 
'KEY');", "inpAccount_DES", "null");
 }
 </script>
 <script language="JavaScript" type="text/javascript" id="selectedColumn">  
@@ -229,13 +229,30 @@
                                                        <div 
id="reportAD_Org_ID"></div>
                                                </select>
                                        </td>
-                                       <td class="TitleCell"><span 
class="LabelText">Account</span></td>
-                                       <td class="Combo_ContentCell" 
colspan="2">
-                                               <select class="Combo 
Combo_TwoCells_width required" required="true" name="inpAccount" 
id="inpAccount">
-                                                       <option 
value=""></option>
-                                                       <div 
id="reportAccount_ID"></div>
-                                               </select>
-                                       </td>
+                                   <td class="TitleCell"><span 
class="LabelText">Account</span></td>                               
+                        <td class="TextBox_btn_ContentCell" colspan="2">
+                            <table border="0" cellspacing="0" cellpadding="0" 
summary=""  style="padding-top: 0px;">
+                                <tr>
+                                    <td class="TextBox_ContentCell">
+                                        <input type="hidden" 
name="inpAcctSchema" id="inpAcctSchema" value=""></input>
+                                        <input type="hidden" name="inpAccount" 
id="inpAccount" value=""></input>
+                                        <input class="dojoValidateValid 
TextBox_btn_TwoCells_width" type="text"  name="inpAccount_DES" 
id="inpAccount_DES" maxlength="20" value=""></input>
+                                    </td>
+                        <td class="FieldButton_ContentCell">
+                         <a class="FieldButtonLink" href="#" 
onfocus="setWindowElementFocus(this); window.status='Account'; return true;" 
onblur="window.status=''; return true;" 
onkeypress="this.className='FieldButtonLink_active'; return true;" 
onkeyup="this.className='FieldButtonLink_focus'; return true;" 
onclick="openSearch(null, null, '../info/AccountElementValue.html', 
'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmSelector', 'inpAccount', 
'inpAccount_DES', document.frmSelector.inpAccount_DES.value, 'inpAcctSchema', 
document.frmSelector.inpAcctSchema.value);return false;">
+                            <table class="FieldButton"  
onmouseout="this.className='FieldButton';window.status='';return true;" 
onmouseover="this.className='FieldButton_hover';window.status='Search';return 
true;" onmousedown="this.className='FieldButton_active';return true;" 
onmouseup="this.className='FieldButton';return true;">
+                                <tr>
+                                    <td class="FieldButton_bg">
+                                        <img alt="Account" 
class="FieldButton_Icon FieldButton_Icon_Account" title="Account" 
src="../../../../../web/images/blank.gif" border="0"></img>
+                                    </td>
+                                </tr>
+                            </table>
+                        </a>
+                        </td>
+                        </tr>
+                        </table>
+                        </td>
+                                       
                                </tr>
                                <tr>
                                        <td class="TitleCell"><span 
class="LabelText">Product</span></td>
diff -r e18ac7648234 -r d01a4c3322d5 
src/org/openbravo/erpCommon/info/Account.java
--- a/src/org/openbravo/erpCommon/info/Account.java     Tue Feb 16 16:52:57 
2010 +0100
+++ b/src/org/openbravo/erpCommon/info/Account.java     Wed Feb 17 16:33:08 
2010 +0530
@@ -266,6 +266,7 @@
     xmlDocument.setParameter("grid_SortCols", "1");
     xmlDocument.setParameter("grid_SortDirs", "ASC");
     xmlDocument.setParameter("grid_Default", "0");
+    xmlDocument.setParameter("inpAcctSchema", strAcctSchema);
 
     response.setContentType("text/html; charset=UTF-8");
     PrintWriter out = response.getWriter();
@@ -347,8 +348,8 @@
         String strOrderBy = SelectorUtility.buildOrderByClause(strOrderCols, 
strOrderDirs);
         page = TableSQLData.calcAndGetBackendPage(vars, 
"DebtPaymentInfo.currentPage");
         if (vars.getStringParameter("movePage", "").length() > 0) {
-        // on movePage action force executing countRows again
-           strNewFilter = "";
+          // on movePage action force executing countRows again
+          strNewFilter = "";
         }
         int oldOffset = offset;
         offset = (page * TableSQLData.maxRowsPerGridPage) + offset;
@@ -358,18 +359,18 @@
           // or
           // first
           // load
-               String rownum = "0", oraLimit1 = null, oraLimit2 = null, 
pgLimit = null;
-            if (this.myPool.getRDBMS().equalsIgnoreCase("ORACLE")) {
-               oraLimit1 = String.valueOf(offset + 
TableSQLData.maxRowsPerGridPage);
-               oraLimit2 = (offset + 1) + " AND " + oraLimit1;
-               rownum = "ROWNUM";
-            } else {
-                pgLimit = TableSQLData.maxRowsPerGridPage + " OFFSET " + 
offset;
-            }
-          strNumRows = AccountData.countRows(this, rownum,strAcctSchema, 
strAlias, strCombination,
+          String rownum = "0", oraLimit1 = null, oraLimit2 = null, pgLimit = 
null;
+          if (this.myPool.getRDBMS().equalsIgnoreCase("ORACLE")) {
+            oraLimit1 = String.valueOf(offset + 
TableSQLData.maxRowsPerGridPage);
+            oraLimit2 = (offset + 1) + " AND " + oraLimit1;
+            rownum = "ROWNUM";
+          } else {
+            pgLimit = TableSQLData.maxRowsPerGridPage + " OFFSET " + offset;
+          }
+          strNumRows = AccountData.countRows(this, rownum, strAcctSchema, 
strAlias, strCombination,
               strOrganization, strAccount, strProduct, strBPartner, 
strProject, strCampaign, "",
               Utility.getContext(this, vars, "#User_Client", "Account"), 
Utility.getContext(this,
-                  vars, "#User_Org", "Account"),pgLimit, oraLimit1, oraLimit2);
+                  vars, "#User_Org", "Account"), pgLimit, oraLimit1, 
oraLimit2);
           vars.setSessionValue("AccountInfo.numrows", strNumRows);
         } else {
           strNumRows = vars.getSessionValue("AccountInfo.numrows");
@@ -430,7 +431,8 @@
     strRowsData.append("    <title>").append(title).append("</title>\n");
     strRowsData.append("    
<description>").append(description).append("</description>\n");
     strRowsData.append("  </status>\n");
-    strRowsData.append("  <rows numRows=\"").append(strNumRows).append("\" 
backendPage=\"" + page + "\">\n");
+    strRowsData.append("  <rows numRows=\"").append(strNumRows).append(
+        "\" backendPage=\"" + page + "\">\n");
     if (data != null && data.length > 0) {
       for (int j = 0; j < data.length; j++) {
         strRowsData.append("    <tr>\n");
diff -r e18ac7648234 -r d01a4c3322d5 
src/org/openbravo/erpCommon/info/Account.xml
--- a/src/org/openbravo/erpCommon/info/Account.xml      Tue Feb 16 16:52:57 
2010 +0100
+++ b/src/org/openbravo/erpCommon/info/Account.xml      Wed Feb 17 16:33:08 
2010 +0530
@@ -30,6 +30,7 @@
        <PARAMETER id="grid" name="grid_SortCols" attribute="sortcols" />
        <PARAMETER id="grid" name="grid_SortDirs" attribute="sortdirs" />
        <PARAMETER id="grid" name="grid_Default" attribute="defaultrow" />
+    <PARAMETER id="inpAcctSchema" name="inpAcctSchema" attribute="value"/>
        <structure name="structure1">
                <FIELD id="fieldValidCombination" 
attribute="value">cValidcombinationId</FIELD>
                <FIELD id="fieldAlias" attribute="value">alias</FIELD>

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to